matplotlib-rs 0.0.8__cp315-cp315-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. docs/releases/0.0.1.md +268 -0
  2. docs/releases/0.0.2.md +69 -0
  3. docs/releases/0.0.3.md +80 -0
  4. docs/releases/0.0.4.md +73 -0
  5. docs/releases/0.0.5.md +24 -0
  6. docs/releases/0.0.6.md +24 -0
  7. docs/releases/0.0.7.md +24 -0
  8. docs/releases/0.0.8.md +16 -0
  9. licenses/LICENSE_CONTOURPY +29 -0
  10. licenses/LICENSE_CYCLER +27 -0
  11. licenses/LICENSE_DATEUTIL +54 -0
  12. licenses/LICENSE_KIWISOLVER +71 -0
  13. licenses/LICENSE_LIBWEBP +56 -0
  14. licenses/LICENSE_MATPLOTLIB +1253 -0
  15. licenses/LICENSE_PYPARSING +20 -0
  16. licenses/LICENSE_QHULL +39 -0
  17. licenses/LICENSE_SIX +18 -0
  18. matplotlib_rs/__init__.py +1683 -0
  19. matplotlib_rs/__main__.py +27 -0
  20. matplotlib_rs/_afm.py +500 -0
  21. matplotlib_rs/_animation_data.py +263 -0
  22. matplotlib_rs/_api/__init__.py +495 -0
  23. matplotlib_rs/_api/deprecation.py +534 -0
  24. matplotlib_rs/_axis_py.py +2991 -0
  25. matplotlib_rs/_blocking_input.py +31 -0
  26. matplotlib_rs/_cm.py +1500 -0
  27. matplotlib_rs/_cm_bivar.py +1289 -0
  28. matplotlib_rs/_cm_listed.py +2848 -0
  29. matplotlib_rs/_cm_multivar.py +167 -0
  30. matplotlib_rs/_color_data.py +1142 -0
  31. matplotlib_rs/_colormap.py +132 -0
  32. matplotlib_rs/_constrained_layout.py +825 -0
  33. matplotlib_rs/_contour.py +108 -0
  34. matplotlib_rs/_doc_cache.py +12214 -0
  35. matplotlib_rs/_docstring.py +142 -0
  36. matplotlib_rs/_enums.py +178 -0
  37. matplotlib_rs/_figure_rs.py +294 -0
  38. matplotlib_rs/_fontconfig_pattern.py +129 -0
  39. matplotlib_rs/_foreign.py +220 -0
  40. matplotlib_rs/_hook.py +94 -0
  41. matplotlib_rs/_image.py +160 -0
  42. matplotlib_rs/_imageio.py +229 -0
  43. matplotlib_rs/_internal_utils.py +65 -0
  44. matplotlib_rs/_kiwi.py +484 -0
  45. matplotlib_rs/_layoutgrid.py +549 -0
  46. matplotlib_rs/_live.py +192 -0
  47. matplotlib_rs/_mathtext.py +3103 -0
  48. matplotlib_rs/_mathtext_data.py +1811 -0
  49. matplotlib_rs/_mplrs.cp315-win_amd64.pyd +0 -0
  50. matplotlib_rs/_path.py +25 -0
  51. matplotlib_rs/_png.py +162 -0
  52. matplotlib_rs/_pylab_helpers.py +137 -0
  53. matplotlib_rs/_qhull.py +66 -0
  54. matplotlib_rs/_rcpush.py +84 -0
  55. matplotlib_rs/_spines_rs.py +108 -0
  56. matplotlib_rs/_style_helpers.py +52 -0
  57. matplotlib_rs/_text_helpers.py +51 -0
  58. matplotlib_rs/_tight_bbox.py +85 -0
  59. matplotlib_rs/_tight_layout.py +302 -0
  60. matplotlib_rs/_tri.py +140 -0
  61. matplotlib_rs/_type1font.py +1228 -0
  62. matplotlib_rs/_vendor/__init__.py +8 -0
  63. matplotlib_rs/_vendor/cycler.py +574 -0
  64. matplotlib_rs/_vendor/dateutil/__init__.py +27 -0
  65. matplotlib_rs/_vendor/dateutil/_common.py +44 -0
  66. matplotlib_rs/_vendor/dateutil/_tzdata_impl.py +148 -0
  67. matplotlib_rs/_vendor/dateutil/_version.py +5 -0
  68. matplotlib_rs/_vendor/dateutil/easter.py +90 -0
  69. matplotlib_rs/_vendor/dateutil/parser/__init__.py +62 -0
  70. matplotlib_rs/_vendor/dateutil/parser/_parser.py +1614 -0
  71. matplotlib_rs/_vendor/dateutil/parser/isoparser.py +417 -0
  72. matplotlib_rs/_vendor/dateutil/relativedelta.py +597 -0
  73. matplotlib_rs/_vendor/dateutil/rrule.py +1765 -0
  74. matplotlib_rs/_vendor/dateutil/tz/__init__.py +61 -0
  75. matplotlib_rs/_vendor/dateutil/tz/_common.py +420 -0
  76. matplotlib_rs/_vendor/dateutil/tz/_factories.py +81 -0
  77. matplotlib_rs/_vendor/dateutil/tz/_tzfile.py +1429 -0
  78. matplotlib_rs/_vendor/dateutil/tz/_tzpath.py +105 -0
  79. matplotlib_rs/_vendor/dateutil/tz/tz.py +1473 -0
  80. matplotlib_rs/_vendor/dateutil/tz/win.py +371 -0
  81. matplotlib_rs/_vendor/dateutil/tzwin.py +3 -0
  82. matplotlib_rs/_vendor/dateutil/utils.py +72 -0
  83. matplotlib_rs/_vendor/dateutil/zoneinfo/__init__.py +234 -0
  84. matplotlib_rs/_vendor/pyparsing/__init__.py +414 -0
  85. matplotlib_rs/_vendor/pyparsing/actions.py +265 -0
  86. matplotlib_rs/_vendor/pyparsing/common.py +571 -0
  87. matplotlib_rs/_vendor/pyparsing/core.py +6973 -0
  88. matplotlib_rs/_vendor/pyparsing/exceptions.py +354 -0
  89. matplotlib_rs/_vendor/pyparsing/helpers.py +1770 -0
  90. matplotlib_rs/_vendor/pyparsing/results.py +929 -0
  91. matplotlib_rs/_vendor/pyparsing/testing.py +399 -0
  92. matplotlib_rs/_vendor/pyparsing/unicode.py +357 -0
  93. matplotlib_rs/_vendor/pyparsing/util.py +515 -0
  94. matplotlib_rs/_vendor/pyparsing/warnings.py +11 -0
  95. matplotlib_rs/_vendor/six.py +1004 -0
  96. matplotlib_rs/animation.py +1843 -0
  97. matplotlib_rs/artist.py +2302 -0
  98. matplotlib_rs/axes/__init__.py +19 -0
  99. matplotlib_rs/axes/_axes.py +9402 -0
  100. matplotlib_rs/axes/_bar.py +185 -0
  101. matplotlib_rs/axes/_base.py +5236 -0
  102. matplotlib_rs/axes/_base_rs.py +727 -0
  103. matplotlib_rs/axes/_boxplot.py +391 -0
  104. matplotlib_rs/axes/_hist.py +99 -0
  105. matplotlib_rs/axes/_secondary_axes.py +357 -0
  106. matplotlib_rs/axis.py +1963 -0
  107. matplotlib_rs/backend_bases.py +3760 -0
  108. matplotlib_rs/backend_managers.py +388 -0
  109. matplotlib_rs/backend_tools.py +1002 -0
  110. matplotlib_rs/backends/__init__.py +6 -0
  111. matplotlib_rs/backends/_backend_pdf_ps.py +451 -0
  112. matplotlib_rs/backends/backend_agg.py +552 -0
  113. matplotlib_rs/backends/backend_mixed.py +123 -0
  114. matplotlib_rs/backends/backend_pdf.py +2711 -0
  115. matplotlib_rs/backends/backend_pgf.py +1031 -0
  116. matplotlib_rs/backends/backend_ps.py +1491 -0
  117. matplotlib_rs/backends/backend_svg.py +1395 -0
  118. matplotlib_rs/backends/backend_template.py +214 -0
  119. matplotlib_rs/backends/registry.py +423 -0
  120. matplotlib_rs/bezier.py +691 -0
  121. matplotlib_rs/category.py +236 -0
  122. matplotlib_rs/cbook.py +2762 -0
  123. matplotlib_rs/cm.py +251 -0
  124. matplotlib_rs/collections.py +2711 -0
  125. matplotlib_rs/colorbar.py +1586 -0
  126. matplotlib_rs/colorizer.py +909 -0
  127. matplotlib_rs/colors.py +4278 -0
  128. matplotlib_rs/container.py +256 -0
  129. matplotlib_rs/contour.py +1756 -0
  130. matplotlib_rs/dates.py +1847 -0
  131. matplotlib_rs/dviread.py +1386 -0
  132. matplotlib_rs/figure.py +3815 -0
  133. matplotlib_rs/font_manager.py +1855 -0
  134. matplotlib_rs/ft2font.py +515 -0
  135. matplotlib_rs/gridspec.py +808 -0
  136. matplotlib_rs/hatch.py +244 -0
  137. matplotlib_rs/image.py +1863 -0
  138. matplotlib_rs/inset.py +291 -0
  139. matplotlib_rs/layout_engine.py +310 -0
  140. matplotlib_rs/legend.py +1480 -0
  141. matplotlib_rs/legend_handler.py +812 -0
  142. matplotlib_rs/lines.py +1886 -0
  143. matplotlib_rs/markers.py +908 -0
  144. matplotlib_rs/mathtext.py +141 -0
  145. matplotlib_rs/mlab.py +959 -0
  146. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf +0 -0
  147. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf +0 -0
  148. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf +0 -0
  149. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans.ttf +0 -0
  150. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf +0 -0
  151. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf +0 -0
  152. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf +0 -0
  153. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf +0 -0
  154. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono.ttf +0 -0
  155. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf +0 -0
  156. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf +0 -0
  157. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf +0 -0
  158. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif.ttf +0 -0
  159. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf +0 -0
  160. matplotlib_rs/mpl-data/fonts/ttf/LICENSE_DEJAVU +99 -0
  161. matplotlib_rs/mpl-data/fonts/ttf/LICENSE_STIX +124 -0
  162. matplotlib_rs/mpl-data/fonts/ttf/LastResortHE-Regular.ttf +0 -0
  163. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneral.ttf +0 -0
  164. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBol.ttf +0 -0
  165. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf +0 -0
  166. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralItalic.ttf +0 -0
  167. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUni.ttf +0 -0
  168. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBol.ttf +0 -0
  169. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf +0 -0
  170. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniIta.ttf +0 -0
  171. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf +0 -0
  172. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf +0 -0
  173. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf +0 -0
  174. matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf +0 -0
  175. matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf +0 -0
  176. matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf +0 -0
  177. matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf +0 -0
  178. matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf +0 -0
  179. matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf +0 -0
  180. matplotlib_rs/mpl-data/fonts/ttf/cmb10.ttf +0 -0
  181. matplotlib_rs/mpl-data/fonts/ttf/cmex10.ttf +0 -0
  182. matplotlib_rs/mpl-data/fonts/ttf/cmmi10.ttf +0 -0
  183. matplotlib_rs/mpl-data/fonts/ttf/cmr10.ttf +0 -0
  184. matplotlib_rs/mpl-data/fonts/ttf/cmss10.ttf +0 -0
  185. matplotlib_rs/mpl-data/fonts/ttf/cmsy10.ttf +0 -0
  186. matplotlib_rs/mpl-data/fonts/ttf/cmti10.ttf +0 -0
  187. matplotlib_rs/mpl-data/fonts/ttf/cmtt10.ttf +0 -0
  188. matplotlib_rs/mpl-data/images/back-symbolic.svg +46 -0
  189. matplotlib_rs/mpl-data/images/back.pdf +0 -0
  190. matplotlib_rs/mpl-data/images/back.png +0 -0
  191. matplotlib_rs/mpl-data/images/back.svg +46 -0
  192. matplotlib_rs/mpl-data/images/back_large.png +0 -0
  193. matplotlib_rs/mpl-data/images/filesave-symbolic.svg +68 -0
  194. matplotlib_rs/mpl-data/images/filesave.pdf +72 -0
  195. matplotlib_rs/mpl-data/images/filesave.png +0 -0
  196. matplotlib_rs/mpl-data/images/filesave.svg +68 -0
  197. matplotlib_rs/mpl-data/images/filesave_large.png +0 -0
  198. matplotlib_rs/mpl-data/images/forward-symbolic.svg +46 -0
  199. matplotlib_rs/mpl-data/images/forward.pdf +0 -0
  200. matplotlib_rs/mpl-data/images/forward.png +0 -0
  201. matplotlib_rs/mpl-data/images/forward.svg +46 -0
  202. matplotlib_rs/mpl-data/images/forward_large.png +0 -0
  203. matplotlib_rs/mpl-data/images/hand.pdf +0 -0
  204. matplotlib_rs/mpl-data/images/hand.png +0 -0
  205. matplotlib_rs/mpl-data/images/hand.svg +130 -0
  206. matplotlib_rs/mpl-data/images/help-symbolic.svg +52 -0
  207. matplotlib_rs/mpl-data/images/help.pdf +71 -0
  208. matplotlib_rs/mpl-data/images/help.png +0 -0
  209. matplotlib_rs/mpl-data/images/help.svg +52 -0
  210. matplotlib_rs/mpl-data/images/help_large.png +0 -0
  211. matplotlib_rs/mpl-data/images/home-symbolic.svg +59 -0
  212. matplotlib_rs/mpl-data/images/home.pdf +0 -0
  213. matplotlib_rs/mpl-data/images/home.png +0 -0
  214. matplotlib_rs/mpl-data/images/home.svg +59 -0
  215. matplotlib_rs/mpl-data/images/home_large.png +0 -0
  216. matplotlib_rs/mpl-data/images/matplotlib.pdf +0 -0
  217. matplotlib_rs/mpl-data/images/matplotlib.png +0 -0
  218. matplotlib_rs/mpl-data/images/matplotlib.svg +3171 -0
  219. matplotlib_rs/mpl-data/images/matplotlib_large.png +0 -0
  220. matplotlib_rs/mpl-data/images/move-symbolic.svg +73 -0
  221. matplotlib_rs/mpl-data/images/move.pdf +0 -0
  222. matplotlib_rs/mpl-data/images/move.png +0 -0
  223. matplotlib_rs/mpl-data/images/move.svg +73 -0
  224. matplotlib_rs/mpl-data/images/move_large.png +0 -0
  225. matplotlib_rs/mpl-data/images/qt4_editor_options.pdf +0 -0
  226. matplotlib_rs/mpl-data/images/qt4_editor_options.png +0 -0
  227. matplotlib_rs/mpl-data/images/qt4_editor_options.svg +48 -0
  228. matplotlib_rs/mpl-data/images/qt4_editor_options_large.png +0 -0
  229. matplotlib_rs/mpl-data/images/subplots-symbolic.svg +81 -0
  230. matplotlib_rs/mpl-data/images/subplots.pdf +0 -0
  231. matplotlib_rs/mpl-data/images/subplots.png +0 -0
  232. matplotlib_rs/mpl-data/images/subplots.svg +81 -0
  233. matplotlib_rs/mpl-data/images/subplots_large.png +0 -0
  234. matplotlib_rs/mpl-data/images/zoom_to_rect-symbolic.svg +40 -0
  235. matplotlib_rs/mpl-data/images/zoom_to_rect.pdf +69 -0
  236. matplotlib_rs/mpl-data/images/zoom_to_rect.png +0 -0
  237. matplotlib_rs/mpl-data/images/zoom_to_rect.svg +40 -0
  238. matplotlib_rs/mpl-data/images/zoom_to_rect_large.png +0 -0
  239. matplotlib_rs/mpl-data/kpsewhich.lua +4 -0
  240. matplotlib_rs/mpl-data/matplotlibrc +849 -0
  241. matplotlib_rs/mpl-data/plot_directive/plot_directive.css +16 -0
  242. matplotlib_rs/mpl-data/sample_data/Minduka_Present_Blue_Pack.png +0 -0
  243. matplotlib_rs/mpl-data/sample_data/README.txt +2 -0
  244. matplotlib_rs/mpl-data/sample_data/Stocks.csv +526 -0
  245. matplotlib_rs/mpl-data/sample_data/axes_grid/bivariate_normal.npy +0 -0
  246. matplotlib_rs/mpl-data/sample_data/data_x_x2_x3.csv +11 -0
  247. matplotlib_rs/mpl-data/sample_data/eeg.dat +0 -0
  248. matplotlib_rs/mpl-data/sample_data/embedding_in_wx3.xrc +65 -0
  249. matplotlib_rs/mpl-data/sample_data/goog.npz +0 -0
  250. matplotlib_rs/mpl-data/sample_data/grace_hopper.jpg +0 -0
  251. matplotlib_rs/mpl-data/sample_data/jacksboro_fault_dem.npz +0 -0
  252. matplotlib_rs/mpl-data/sample_data/logo2.png +0 -0
  253. matplotlib_rs/mpl-data/sample_data/membrane.dat +0 -0
  254. matplotlib_rs/mpl-data/sample_data/msft.csv +66 -0
  255. matplotlib_rs/mpl-data/sample_data/s1045.ima.gz +0 -0
  256. matplotlib_rs/mpl-data/sample_data/topobathy.npz +0 -0
  257. matplotlib_rs/mpl-data/stylelib/Solarize_Light2.mplstyle +53 -0
  258. matplotlib_rs/mpl-data/stylelib/_classic_test_patch.mplstyle +8 -0
  259. matplotlib_rs/mpl-data/stylelib/_mpl-gallery-nogrid.mplstyle +19 -0
  260. matplotlib_rs/mpl-data/stylelib/_mpl-gallery.mplstyle +19 -0
  261. matplotlib_rs/mpl-data/stylelib/bmh.mplstyle +27 -0
  262. matplotlib_rs/mpl-data/stylelib/classic.mplstyle +491 -0
  263. matplotlib_rs/mpl-data/stylelib/dark_background.mplstyle +26 -0
  264. matplotlib_rs/mpl-data/stylelib/fast.mplstyle +11 -0
  265. matplotlib_rs/mpl-data/stylelib/fivethirtyeight.mplstyle +37 -0
  266. matplotlib_rs/mpl-data/stylelib/ggplot.mplstyle +39 -0
  267. matplotlib_rs/mpl-data/stylelib/grayscale.mplstyle +29 -0
  268. matplotlib_rs/mpl-data/stylelib/petroff10.mplstyle +5 -0
  269. matplotlib_rs/mpl-data/stylelib/petroff6.mplstyle +5 -0
  270. matplotlib_rs/mpl-data/stylelib/petroff8.mplstyle +5 -0
  271. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-bright.mplstyle +3 -0
  272. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-colorblind.mplstyle +3 -0
  273. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark-palette.mplstyle +3 -0
  274. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark.mplstyle +30 -0
  275. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-darkgrid.mplstyle +30 -0
  276. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-deep.mplstyle +3 -0
  277. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-muted.mplstyle +3 -0
  278. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-notebook.mplstyle +21 -0
  279. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-paper.mplstyle +21 -0
  280. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-pastel.mplstyle +3 -0
  281. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-poster.mplstyle +21 -0
  282. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-talk.mplstyle +21 -0
  283. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-ticks.mplstyle +30 -0
  284. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-white.mplstyle +30 -0
  285. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-whitegrid.mplstyle +30 -0
  286. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8.mplstyle +57 -0
  287. matplotlib_rs/mpl-data/stylelib/tableau-colorblind10.mplstyle +3 -0
  288. matplotlib_rs/mpl_toolkits/__init__.py +3 -0
  289. matplotlib_rs/mpl_toolkits/axes_grid1/__init__.py +11 -0
  290. matplotlib_rs/mpl_toolkits/axes_grid1/anchored_artists.py +415 -0
  291. matplotlib_rs/mpl_toolkits/axes_grid1/axes_divider.py +619 -0
  292. matplotlib_rs/mpl_toolkits/axes_grid1/axes_grid.py +565 -0
  293. matplotlib_rs/mpl_toolkits/axes_grid1/axes_rgb.py +158 -0
  294. matplotlib_rs/mpl_toolkits/axes_grid1/axes_size.py +272 -0
  295. matplotlib_rs/mpl_toolkits/axes_grid1/inset_locator.py +525 -0
  296. matplotlib_rs/mpl_toolkits/axes_grid1/mpl_axes.py +129 -0
  297. matplotlib_rs/mpl_toolkits/axes_grid1/parasite_axes.py +261 -0
  298. matplotlib_rs/mpl_toolkits/axisartist/__init__.py +15 -0
  299. matplotlib_rs/mpl_toolkits/axisartist/angle_helper.py +396 -0
  300. matplotlib_rs/mpl_toolkits/axisartist/axes_divider.py +3 -0
  301. matplotlib_rs/mpl_toolkits/axisartist/axis_artist.py +1148 -0
  302. matplotlib_rs/mpl_toolkits/axisartist/axisline_style.py +193 -0
  303. matplotlib_rs/mpl_toolkits/axisartist/axislines.py +475 -0
  304. matplotlib_rs/mpl_toolkits/axisartist/floating_axes.py +265 -0
  305. matplotlib_rs/mpl_toolkits/axisartist/grid_finder.py +329 -0
  306. matplotlib_rs/mpl_toolkits/axisartist/grid_helper_curvelinear.py +353 -0
  307. matplotlib_rs/mpl_toolkits/axisartist/parasite_axes.py +8 -0
  308. matplotlib_rs/mpl_toolkits/mplot3d/__init__.py +4 -0
  309. matplotlib_rs/mpl_toolkits/mplot3d/art3d.py +1758 -0
  310. matplotlib_rs/mpl_toolkits/mplot3d/axes3d.py +4462 -0
  311. matplotlib_rs/mpl_toolkits/mplot3d/axis3d.py +807 -0
  312. matplotlib_rs/mpl_toolkits/mplot3d/proj3d.py +270 -0
  313. matplotlib_rs/offsetbox.py +1726 -0
  314. matplotlib_rs/patches.py +5049 -0
  315. matplotlib_rs/path.py +1147 -0
  316. matplotlib_rs/patheffects.py +512 -0
  317. matplotlib_rs/projections/__init__.py +126 -0
  318. matplotlib_rs/projections/geo.py +512 -0
  319. matplotlib_rs/projections/polar.py +1518 -0
  320. matplotlib_rs/pylab.py +68 -0
  321. matplotlib_rs/pyplot.py +4834 -0
  322. matplotlib_rs/quiver.py +1236 -0
  323. matplotlib_rs/rcsetup.py +3435 -0
  324. matplotlib_rs/sankey.py +815 -0
  325. matplotlib_rs/scale.py +1002 -0
  326. matplotlib_rs/spines.py +618 -0
  327. matplotlib_rs/stackplot.py +144 -0
  328. matplotlib_rs/streamplot.py +768 -0
  329. matplotlib_rs/style/__init__.py +269 -0
  330. matplotlib_rs/style/core.py +28 -0
  331. matplotlib_rs/table.py +860 -0
  332. matplotlib_rs/texmanager.py +375 -0
  333. matplotlib_rs/text.py +2412 -0
  334. matplotlib_rs/textpath.py +377 -0
  335. matplotlib_rs/ticker.py +3111 -0
  336. matplotlib_rs/transforms.py +3069 -0
  337. matplotlib_rs/tri/__init__.py +24 -0
  338. matplotlib_rs/tri/_triangulation.py +248 -0
  339. matplotlib_rs/tri/_tricontour.py +271 -0
  340. matplotlib_rs/tri/_trifinder.py +97 -0
  341. matplotlib_rs/tri/_triinterpolate.py +1575 -0
  342. matplotlib_rs/tri/_tripcolor.py +170 -0
  343. matplotlib_rs/tri/_triplot.py +87 -0
  344. matplotlib_rs/tri/_trirefine.py +308 -0
  345. matplotlib_rs/tri/_tritools.py +264 -0
  346. matplotlib_rs/typing.py +597 -0
  347. matplotlib_rs/units.py +196 -0
  348. matplotlib_rs/widgets.py +4455 -0
  349. matplotlib_rs-0.0.8.dist-info/METADATA +392 -0
  350. matplotlib_rs-0.0.8.dist-info/RECORD +352 -0
  351. matplotlib_rs-0.0.8.dist-info/WHEEL +4 -0
  352. matplotlib_rs-0.0.8.dist-info/sboms/matplotlib-rs.cyclonedx.json +4390 -0
@@ -0,0 +1,691 @@
1
+ # Vendored from matplotlib 3.11 (see licenses/LICENSE_MATPLOTLIB), adapted for matplotlib_rs.
2
+ """
3
+ A module providing some utility functions regarding Bézier path manipulation.
4
+ """
5
+
6
+ from functools import lru_cache
7
+ import math
8
+ import warnings
9
+
10
+ import numpy as np
11
+
12
+ from . import _api
13
+
14
+
15
+ def _quadratic_roots_in_01(c0, c1, c2):
16
+ """Real roots of c0 + c1*x + c2*x**2 in [0, 1]."""
17
+ if abs(c2) < 1e-12: # Linear
18
+ if abs(c1) < 1e-12:
19
+ return np.array([])
20
+ root = -c0 / c1
21
+ return np.array([root]) if 0 <= root <= 1 else np.array([])
22
+
23
+ disc = c1 * c1 - 4 * c2 * c0
24
+ if disc < 0:
25
+ return np.array([])
26
+
27
+ sqrt_disc = np.sqrt(disc)
28
+ # Numerically stable quadratic formula
29
+ if c1 >= 0:
30
+ q = -0.5 * (c1 + sqrt_disc)
31
+ else:
32
+ q = -0.5 * (c1 - sqrt_disc)
33
+
34
+ roots = []
35
+ if abs(q) > 1e-12:
36
+ roots.append(c0 / q)
37
+ if abs(c2) > 1e-12:
38
+ roots.append(q / c2)
39
+
40
+ roots = np.asarray(roots)
41
+ return roots[(roots >= 0) & (roots <= 1)]
42
+
43
+
44
+ def _real_roots_in_01(coeffs):
45
+ """
46
+ Find real roots of a polynomial in the interval [0, 1].
47
+
48
+ For polynomials of degree <= 2, closed-form solutions are used.
49
+ For higher degrees, `numpy.roots` is used as a fallback. In practice,
50
+ matplotlib only ever uses cubic bezier curves and axis_aligned_extrema()
51
+ differentiates, so we only ever find roots for degree <= 2.
52
+
53
+ Parameters
54
+ ----------
55
+ coeffs : array-like
56
+ Polynomial coefficients in ascending order:
57
+ ``c[0] + c[1]*x + c[2]*x**2 + ...``
58
+ Note this is the opposite convention from `numpy.roots`.
59
+
60
+ Returns
61
+ -------
62
+ roots : ndarray
63
+ Sorted array of real roots in [0, 1].
64
+ """
65
+ coeffs = np.asarray(coeffs, dtype=float)
66
+
67
+ # Trim trailing near-zeros to get actual degree
68
+ deg = len(coeffs) - 1
69
+ while deg > 0 and abs(coeffs[deg]) < 1e-12:
70
+ deg -= 1
71
+
72
+ if deg <= 0:
73
+ return np.array([])
74
+ elif deg == 1:
75
+ root = -coeffs[0] / coeffs[1]
76
+ return np.array([root]) if 0 <= root <= 1 else np.array([])
77
+ elif deg == 2:
78
+ roots = _quadratic_roots_in_01(coeffs[0], coeffs[1], coeffs[2])
79
+ else:
80
+ # np.roots expects descending order (highest power first)
81
+ eps = 1e-10
82
+ all_roots = np.roots(coeffs[deg::-1])
83
+ real_mask = np.abs(all_roots.imag) < eps
84
+ real_roots = all_roots[real_mask].real
85
+ in_range = (real_roots >= -eps) & (real_roots <= 1 + eps)
86
+ roots = np.clip(real_roots[in_range], 0, 1)
87
+
88
+ return np.sort(roots)
89
+
90
+
91
+ @lru_cache(maxsize=16)
92
+ def _get_coeff_matrix(n):
93
+ """
94
+ Compute the matrix for converting Bezier control points to polynomial
95
+ coefficients for a curve of degree n.
96
+
97
+ The matrix M is such that M @ control_points gives polynomial coefficients.
98
+ Entry M[j, i] = C(n, j) * (-1)^(i+j) * C(j, i) where C is the binomial
99
+ coefficient.
100
+ """
101
+ def _comb(n, k):
102
+ return np.vectorize(math.comb)(n, k)
103
+
104
+ j = np.arange(n + 1)[:, None]
105
+ i = np.arange(n + 1)[None, :] # _comb is non-zero for i <= j
106
+ prefactor = (-1) ** (i + j) * _comb(j, i) # j on axis 0, i on axis 1
107
+ return (_comb(n, j) * prefactor).astype(float)
108
+
109
+
110
+ class NonIntersectingPathException(ValueError):
111
+ pass
112
+
113
+
114
+ # some functions
115
+
116
+
117
+ def get_intersection(cx1, cy1, cos_t1, sin_t1,
118
+ cx2, cy2, cos_t2, sin_t2):
119
+ """
120
+ Return the intersection between the line through (*cx1*, *cy1*) at angle
121
+ *t1* and the line through (*cx2*, *cy2*) at angle *t2*.
122
+ """
123
+
124
+ # line1 => sin_t1 * (x - cx1) - cos_t1 * (y - cy1) = 0.
125
+ # line1 => sin_t1 * x + cos_t1 * y = sin_t1*cx1 - cos_t1*cy1
126
+
127
+ line1_rhs = sin_t1 * cx1 - cos_t1 * cy1
128
+ line2_rhs = sin_t2 * cx2 - cos_t2 * cy2
129
+
130
+ # rhs matrix
131
+ a, b = sin_t1, -cos_t1
132
+ c, d = sin_t2, -cos_t2
133
+
134
+ ad_bc = a * d - b * c
135
+ if abs(ad_bc) < 1e-12:
136
+ raise ValueError("Given lines do not intersect. Please verify that "
137
+ "the angles are not equal or differ by 180 degrees.")
138
+
139
+ # rhs_inverse
140
+ a_, b_ = d, -b
141
+ c_, d_ = -c, a
142
+ a_, b_, c_, d_ = (k / ad_bc for k in [a_, b_, c_, d_])
143
+
144
+ x = a_ * line1_rhs + b_ * line2_rhs
145
+ y = c_ * line1_rhs + d_ * line2_rhs
146
+
147
+ return x, y
148
+
149
+
150
+ def get_normal_points(cx, cy, cos_t, sin_t, length):
151
+ """
152
+ For a line passing through (*cx*, *cy*) and having an angle *t*, return
153
+ locations of the two points located along its perpendicular line at the
154
+ distance of *length*.
155
+ """
156
+
157
+ if length == 0.:
158
+ return cx, cy, cx, cy
159
+
160
+ cos_t1, sin_t1 = sin_t, -cos_t
161
+ cos_t2, sin_t2 = -sin_t, cos_t
162
+
163
+ x1, y1 = length * cos_t1 + cx, length * sin_t1 + cy
164
+ x2, y2 = length * cos_t2 + cx, length * sin_t2 + cy
165
+
166
+ return x1, y1, x2, y2
167
+
168
+
169
+ # BEZIER routines
170
+
171
+ # subdividing bezier curve
172
+ # http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/Bezier/bezier-sub.html
173
+
174
+
175
+ def _de_casteljau1(beta, t):
176
+ next_beta = beta[:-1] * (1 - t) + beta[1:] * t
177
+ return next_beta
178
+
179
+
180
+ def split_de_casteljau(beta, t):
181
+ """
182
+ Split a Bézier segment defined by its control points *beta* into two
183
+ separate segments divided at *t* and return their control points.
184
+ """
185
+ beta = np.asarray(beta)
186
+ beta_list = [beta]
187
+ while True:
188
+ beta = _de_casteljau1(beta, t)
189
+ beta_list.append(beta)
190
+ if len(beta) == 1:
191
+ break
192
+ left_beta = [beta[0] for beta in beta_list]
193
+ right_beta = [beta[-1] for beta in reversed(beta_list)]
194
+
195
+ return left_beta, right_beta
196
+
197
+
198
+ def find_bezier_t_intersecting_with_closedpath(
199
+ bezier_point_at_t, inside_closedpath, t0=0., t1=1., tolerance=0.01):
200
+ """
201
+ Find the intersection of the Bézier curve with a closed path.
202
+
203
+ The intersection point *t* is approximated by two parameters *t0*, *t1*
204
+ such that *t0* <= *t* <= *t1*.
205
+
206
+ Search starts from *t0* and *t1* and uses a simple bisecting algorithm
207
+ therefore one of the end points must be inside the path while the other
208
+ doesn't. The search stops when the distance of the points parametrized by
209
+ *t0* and *t1* gets smaller than the given *tolerance*.
210
+
211
+ Parameters
212
+ ----------
213
+ bezier_point_at_t : callable
214
+ A function returning x, y coordinates of the Bézier at parameter *t*.
215
+ It must have the signature::
216
+
217
+ bezier_point_at_t(t: float) -> tuple[float, float]
218
+
219
+ inside_closedpath : callable
220
+ A function returning True if a given point (x, y) is inside the
221
+ closed path. It must have the signature::
222
+
223
+ inside_closedpath(point: tuple[float, float]) -> bool
224
+
225
+ t0, t1 : float
226
+ Start parameters for the search.
227
+
228
+ tolerance : float
229
+ Maximal allowed distance between the final points.
230
+
231
+ Returns
232
+ -------
233
+ t0, t1 : float
234
+ The Bézier path parameters.
235
+ """
236
+ start = bezier_point_at_t(t0)
237
+ end = bezier_point_at_t(t1)
238
+
239
+ start_inside = inside_closedpath(start)
240
+ end_inside = inside_closedpath(end)
241
+
242
+ if start_inside == end_inside and start != end:
243
+ raise NonIntersectingPathException(
244
+ "Both points are on the same side of the closed path")
245
+
246
+ while True:
247
+
248
+ # return if the distance is smaller than the tolerance
249
+ if np.hypot(start[0] - end[0], start[1] - end[1]) < tolerance:
250
+ return t0, t1
251
+
252
+ # calculate the middle point
253
+ middle_t = 0.5 * (t0 + t1)
254
+ middle = bezier_point_at_t(middle_t)
255
+ middle_inside = inside_closedpath(middle)
256
+
257
+ if start_inside ^ middle_inside:
258
+ t1 = middle_t
259
+ if end == middle:
260
+ # Edge case where infinite loop is possible
261
+ # Caused by large numbers relative to tolerance
262
+ return t0, t1
263
+ end = middle
264
+ else:
265
+ t0 = middle_t
266
+ if start == middle:
267
+ # Edge case where infinite loop is possible
268
+ # Caused by large numbers relative to tolerance
269
+ return t0, t1
270
+ start = middle
271
+ start_inside = middle_inside
272
+
273
+
274
+ class BezierSegment:
275
+ """
276
+ A d-dimensional Bézier segment.
277
+
278
+ A BezierSegment can be called with an argument, either a scalar or an array-like
279
+ object, to evaluate the curve at that/those location(s).
280
+
281
+ Parameters
282
+ ----------
283
+ control_points : (N, d) array
284
+ Location of the *N* control points.
285
+ """
286
+
287
+ def __init__(self, control_points):
288
+ self._cpoints = np.asarray(control_points)
289
+ self._N, self._d = self._cpoints.shape
290
+ self._orders = np.arange(self._N)
291
+ coeff = [math.factorial(self._N - 1)
292
+ // (math.factorial(i) * math.factorial(self._N - 1 - i))
293
+ for i in range(self._N)]
294
+ self._px = (self._cpoints.T * coeff).T
295
+
296
+ def __call__(self, t):
297
+ """
298
+ Evaluate the Bézier curve at point(s) *t* in [0, 1].
299
+
300
+ Parameters
301
+ ----------
302
+ t : (k,) array-like
303
+ Points at which to evaluate the curve.
304
+
305
+ Returns
306
+ -------
307
+ (k, d) array
308
+ Value of the curve for each point in *t*.
309
+ """
310
+ t = np.asarray(t)
311
+ return (np.power.outer(1 - t, self._orders[::-1])
312
+ * np.power.outer(t, self._orders)) @ self._px
313
+
314
+ @_api.deprecated(
315
+ "3.11", alternative="Call the BezierSegment object with an argument.")
316
+ def point_at_t(self, t):
317
+ """
318
+ Evaluate the curve at a single point, returning a tuple of *d* floats.
319
+ """
320
+ return tuple(self(t))
321
+
322
+ @property
323
+ def control_points(self):
324
+ """The control points of the curve."""
325
+ return self._cpoints
326
+
327
+ @property
328
+ def dimension(self):
329
+ """The dimension of the curve."""
330
+ return self._d
331
+
332
+ @property
333
+ def degree(self):
334
+ """Degree of the polynomial. One less the number of control points."""
335
+ return self._N - 1
336
+
337
+ @property
338
+ def polynomial_coefficients(self):
339
+ r"""
340
+ The polynomial coefficients of the Bézier curve.
341
+
342
+ .. warning:: Follows opposite convention from `numpy.polyval`.
343
+
344
+ Returns
345
+ -------
346
+ (n+1, d) array
347
+ Coefficients after expanding in polynomial basis, where :math:`n`
348
+ is the degree of the Bézier curve and :math:`d` its dimension.
349
+ These are the numbers (:math:`C_j`) such that the curve can be
350
+ written :math:`\sum_{j=0}^n C_j t^j`.
351
+
352
+ Notes
353
+ -----
354
+ The coefficients are calculated as
355
+
356
+ .. math::
357
+
358
+ {n \choose j} \sum_{i=0}^j (-1)^{i+j} {j \choose i} P_i
359
+
360
+ where :math:`P_i` are the control points of the curve.
361
+ """
362
+ n = self.degree
363
+ # matplotlib uses n <= 4. overflow plausible starting around n = 15.
364
+ if n > 10:
365
+ warnings.warn("Polynomial coefficients formula unstable for high "
366
+ "order Bezier curves!", RuntimeWarning)
367
+ return _get_coeff_matrix(n) @ self.control_points
368
+
369
+ def axis_aligned_extrema(self):
370
+ """
371
+ Return the dimension and location of the curve's interior extrema.
372
+
373
+ The extrema are the points along the curve where one of its partial
374
+ derivatives is zero.
375
+
376
+ Returns
377
+ -------
378
+ dims : array of int
379
+ Index :math:`i` of the partial derivative which is zero at each
380
+ interior extrema.
381
+ dzeros : array of float
382
+ Of same size as dims. The :math:`t` such that :math:`d/dx_i B(t) =
383
+ 0`
384
+ """
385
+ n = self.degree
386
+ if n <= 1:
387
+ return np.array([]), np.array([])
388
+ Cj = self.polynomial_coefficients
389
+ dCj = np.arange(1, n + 1)[:, None] * Cj[1:]
390
+
391
+ all_dims = []
392
+ all_roots = []
393
+
394
+ for i, pi in enumerate(dCj.T):
395
+ r = _real_roots_in_01(pi)
396
+ if len(r) > 0:
397
+ all_roots.append(r)
398
+ all_dims.append(np.full(len(r), i))
399
+
400
+ if not all_roots:
401
+ return np.array([]), np.array([])
402
+
403
+ return np.concatenate(all_dims), np.concatenate(all_roots)
404
+
405
+
406
+ def split_bezier_intersecting_with_closedpath(
407
+ bezier, inside_closedpath, tolerance=0.01):
408
+ """
409
+ Split a Bézier curve into two at the intersection with a closed path.
410
+
411
+ Parameters
412
+ ----------
413
+ bezier : (N, 2) array-like
414
+ Control points of the Bézier segment. See `.BezierSegment`.
415
+ inside_closedpath : callable
416
+ A function returning True if a given point (x, y) is inside the
417
+ closed path. See also `.find_bezier_t_intersecting_with_closedpath`.
418
+ tolerance : float
419
+ The tolerance for the intersection. See also
420
+ `.find_bezier_t_intersecting_with_closedpath`.
421
+
422
+ Returns
423
+ -------
424
+ left, right
425
+ Lists of control points for the two Bézier segments.
426
+ """
427
+
428
+ bz = BezierSegment(bezier)
429
+
430
+ t0, t1 = find_bezier_t_intersecting_with_closedpath(
431
+ lambda t: tuple(bz(t)), inside_closedpath, tolerance=tolerance)
432
+
433
+ _left, _right = split_de_casteljau(bezier, (t0 + t1) / 2.)
434
+ return _left, _right
435
+
436
+
437
+ # matplotlib specific
438
+
439
+
440
+ def split_path_inout(path, inside, tolerance=0.01, reorder_inout=False):
441
+ """
442
+ Divide a path into two segments at the point where ``inside(x, y)`` becomes
443
+ False.
444
+ """
445
+ from .path import Path
446
+ path_iter = path.iter_segments()
447
+
448
+ ctl_points, command = next(path_iter)
449
+ begin_inside = inside(ctl_points[-2:]) # true if begin point is inside
450
+
451
+ ctl_points_old = ctl_points
452
+
453
+ iold = 0
454
+ i = 1
455
+
456
+ for ctl_points, command in path_iter:
457
+ iold = i
458
+ i += len(ctl_points) // 2
459
+ if inside(ctl_points[-2:]) != begin_inside:
460
+ bezier_path = np.concatenate([ctl_points_old[-2:], ctl_points])
461
+ break
462
+ ctl_points_old = ctl_points
463
+ else:
464
+ raise ValueError("The path does not intersect with the patch")
465
+
466
+ bp = bezier_path.reshape((-1, 2))
467
+ left, right = split_bezier_intersecting_with_closedpath(
468
+ bp, inside, tolerance)
469
+ if len(left) == 2:
470
+ codes_left = [Path.LINETO]
471
+ codes_right = [Path.MOVETO, Path.LINETO]
472
+ elif len(left) == 3:
473
+ codes_left = [Path.CURVE3, Path.CURVE3]
474
+ codes_right = [Path.MOVETO, Path.CURVE3, Path.CURVE3]
475
+ elif len(left) == 4:
476
+ codes_left = [Path.CURVE4, Path.CURVE4, Path.CURVE4]
477
+ codes_right = [Path.MOVETO, Path.CURVE4, Path.CURVE4, Path.CURVE4]
478
+ else:
479
+ raise AssertionError("This should never be reached")
480
+
481
+ verts_left = left[1:]
482
+ verts_right = right[:]
483
+
484
+ if path.codes is None:
485
+ path_in = Path(np.concatenate([path.vertices[:i], verts_left]))
486
+ path_out = Path(np.concatenate([verts_right, path.vertices[i:]]))
487
+
488
+ else:
489
+ path_in = Path(np.concatenate([path.vertices[:iold], verts_left]),
490
+ np.concatenate([path.codes[:iold], codes_left]))
491
+
492
+ path_out = Path(np.concatenate([verts_right, path.vertices[i:]]),
493
+ np.concatenate([codes_right, path.codes[i:]]))
494
+
495
+ if reorder_inout and not begin_inside:
496
+ path_in, path_out = path_out, path_in
497
+
498
+ return path_in, path_out
499
+
500
+
501
+ def inside_circle(cx, cy, r):
502
+ """
503
+ Return a function that checks whether a point is in a circle with center
504
+ (*cx*, *cy*) and radius *r*.
505
+
506
+ The returned function has the signature::
507
+
508
+ f(xy: tuple[float, float]) -> bool
509
+ """
510
+ r2 = r ** 2
511
+
512
+ def _f(xy):
513
+ x, y = xy
514
+ return (x - cx) ** 2 + (y - cy) ** 2 < r2
515
+ return _f
516
+
517
+
518
+ # quadratic Bezier lines
519
+
520
+ def get_cos_sin(x0, y0, x1, y1):
521
+ dx, dy = x1 - x0, y1 - y0
522
+ d = (dx * dx + dy * dy) ** .5
523
+ # Account for divide by zero
524
+ if d == 0:
525
+ return 0.0, 0.0
526
+ return dx / d, dy / d
527
+
528
+
529
+ def check_if_parallel(dx1, dy1, dx2, dy2, tolerance=1.e-5):
530
+ """
531
+ Check if two lines are parallel.
532
+
533
+ Parameters
534
+ ----------
535
+ dx1, dy1, dx2, dy2 : float
536
+ The gradients *dy*/*dx* of the two lines.
537
+ tolerance : float
538
+ The angular tolerance in radians up to which the lines are considered
539
+ parallel.
540
+
541
+ Returns
542
+ -------
543
+ is_parallel
544
+ - 1 if two lines are parallel in same direction.
545
+ - -1 if two lines are parallel in opposite direction.
546
+ - False otherwise.
547
+ """
548
+ theta1 = np.arctan2(dx1, dy1)
549
+ theta2 = np.arctan2(dx2, dy2)
550
+ dtheta = abs(theta1 - theta2)
551
+ if dtheta < tolerance:
552
+ return 1
553
+ elif abs(dtheta - np.pi) < tolerance:
554
+ return -1
555
+ else:
556
+ return False
557
+
558
+
559
+ def get_parallels(bezier2, width):
560
+ """
561
+ Given the quadratic Bézier control points *bezier2*, returns
562
+ control points of quadratic Bézier lines roughly parallel to given
563
+ one separated by *width*.
564
+ """
565
+
566
+ # The parallel Bezier lines are constructed by following ways.
567
+ # c1 and c2 are control points representing the start and end of the
568
+ # Bezier line.
569
+ # cm is the middle point
570
+
571
+ c1x, c1y = bezier2[0]
572
+ cmx, cmy = bezier2[1]
573
+ c2x, c2y = bezier2[2]
574
+
575
+ parallel_test = check_if_parallel(c1x - cmx, c1y - cmy,
576
+ cmx - c2x, cmy - c2y)
577
+
578
+ if parallel_test == -1:
579
+ _api.warn_external(
580
+ "Lines do not intersect. A straight line is used instead.")
581
+ cos_t1, sin_t1 = get_cos_sin(c1x, c1y, c2x, c2y)
582
+ cos_t2, sin_t2 = cos_t1, sin_t1
583
+ else:
584
+ # t1 and t2 is the angle between c1 and cm, cm, c2. They are
585
+ # also an angle of the tangential line of the path at c1 and c2
586
+ cos_t1, sin_t1 = get_cos_sin(c1x, c1y, cmx, cmy)
587
+ cos_t2, sin_t2 = get_cos_sin(cmx, cmy, c2x, c2y)
588
+
589
+ # find c1_left, c1_right which are located along the lines
590
+ # through c1 and perpendicular to the tangential lines of the
591
+ # Bezier path at a distance of width. Same thing for c2_left and
592
+ # c2_right with respect to c2.
593
+ c1x_left, c1y_left, c1x_right, c1y_right = (
594
+ get_normal_points(c1x, c1y, cos_t1, sin_t1, width)
595
+ )
596
+ c2x_left, c2y_left, c2x_right, c2y_right = (
597
+ get_normal_points(c2x, c2y, cos_t2, sin_t2, width)
598
+ )
599
+
600
+ # find cm_left which is the intersecting point of a line through
601
+ # c1_left with angle t1 and a line through c2_left with angle
602
+ # t2. Same with cm_right.
603
+ try:
604
+ cmx_left, cmy_left = get_intersection(c1x_left, c1y_left, cos_t1,
605
+ sin_t1, c2x_left, c2y_left,
606
+ cos_t2, sin_t2)
607
+ cmx_right, cmy_right = get_intersection(c1x_right, c1y_right, cos_t1,
608
+ sin_t1, c2x_right, c2y_right,
609
+ cos_t2, sin_t2)
610
+ except ValueError:
611
+ # Special case straight lines, i.e., angle between two lines is
612
+ # less than the threshold used by get_intersection (we don't use
613
+ # check_if_parallel as the threshold is not the same).
614
+ cmx_left, cmy_left = (
615
+ 0.5 * (c1x_left + c2x_left), 0.5 * (c1y_left + c2y_left)
616
+ )
617
+ cmx_right, cmy_right = (
618
+ 0.5 * (c1x_right + c2x_right), 0.5 * (c1y_right + c2y_right)
619
+ )
620
+
621
+ # the parallel Bezier lines are created with control points of
622
+ # [c1_left, cm_left, c2_left] and [c1_right, cm_right, c2_right]
623
+ path_left = [(c1x_left, c1y_left),
624
+ (cmx_left, cmy_left),
625
+ (c2x_left, c2y_left)]
626
+ path_right = [(c1x_right, c1y_right),
627
+ (cmx_right, cmy_right),
628
+ (c2x_right, c2y_right)]
629
+
630
+ return path_left, path_right
631
+
632
+
633
+ def find_control_points(c1x, c1y, mmx, mmy, c2x, c2y):
634
+ """
635
+ Find control points of the Bézier curve passing through (*c1x*, *c1y*),
636
+ (*mmx*, *mmy*), and (*c2x*, *c2y*), at parametric values 0, 0.5, and 1.
637
+ """
638
+ cmx = .5 * (4 * mmx - (c1x + c2x))
639
+ cmy = .5 * (4 * mmy - (c1y + c2y))
640
+ return [(c1x, c1y), (cmx, cmy), (c2x, c2y)]
641
+
642
+
643
+ def make_wedged_bezier2(bezier2, width, w1=1., wm=0.5, w2=0.):
644
+ """
645
+ Being similar to `get_parallels`, returns control points of two quadratic
646
+ Bézier lines having a width roughly parallel to given one separated by
647
+ *width*.
648
+ """
649
+
650
+ # c1, cm, c2
651
+ c1x, c1y = bezier2[0]
652
+ cmx, cmy = bezier2[1]
653
+ c3x, c3y = bezier2[2]
654
+
655
+ # t1 and t2 is the angle between c1 and cm, cm, c3.
656
+ # They are also an angle of the tangential line of the path at c1 and c3
657
+ cos_t1, sin_t1 = get_cos_sin(c1x, c1y, cmx, cmy)
658
+ cos_t2, sin_t2 = get_cos_sin(cmx, cmy, c3x, c3y)
659
+
660
+ # find c1_left, c1_right which are located along the lines
661
+ # through c1 and perpendicular to the tangential lines of the
662
+ # Bezier path at a distance of width. Same thing for c3_left and
663
+ # c3_right with respect to c3.
664
+ c1x_left, c1y_left, c1x_right, c1y_right = (
665
+ get_normal_points(c1x, c1y, cos_t1, sin_t1, width * w1)
666
+ )
667
+ c3x_left, c3y_left, c3x_right, c3y_right = (
668
+ get_normal_points(c3x, c3y, cos_t2, sin_t2, width * w2)
669
+ )
670
+
671
+ # find c12, c23 and c123 which are middle points of c1-cm, cm-c3 and
672
+ # c12-c23
673
+ c12x, c12y = (c1x + cmx) * .5, (c1y + cmy) * .5
674
+ c23x, c23y = (cmx + c3x) * .5, (cmy + c3y) * .5
675
+ c123x, c123y = (c12x + c23x) * .5, (c12y + c23y) * .5
676
+
677
+ # tangential angle of c123 (angle between c12 and c23)
678
+ cos_t123, sin_t123 = get_cos_sin(c12x, c12y, c23x, c23y)
679
+
680
+ c123x_left, c123y_left, c123x_right, c123y_right = (
681
+ get_normal_points(c123x, c123y, cos_t123, sin_t123, width * wm)
682
+ )
683
+
684
+ path_left = find_control_points(c1x_left, c1y_left,
685
+ c123x_left, c123y_left,
686
+ c3x_left, c3y_left)
687
+ path_right = find_control_points(c1x_right, c1y_right,
688
+ c123x_right, c123y_right,
689
+ c3x_right, c3y_right)
690
+
691
+ return path_left, path_right