ultraplot 0.99.3__py3-none-any.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 (416) hide show
  1. ultraplot/__init__.py +115 -0
  2. ultraplot/__init__.py.rej +58 -0
  3. ultraplot/axes/__init__.py +42 -0
  4. ultraplot/axes/base.py +3240 -0
  5. ultraplot/axes/cartesian.py +1425 -0
  6. ultraplot/axes/geo.py +1675 -0
  7. ultraplot/axes/plot.py +4569 -0
  8. ultraplot/axes/polar.py +381 -0
  9. ultraplot/axes/shared.py +186 -0
  10. ultraplot/axes/three.py +34 -0
  11. ultraplot/cmaps/Algae.rgb +256 -0
  12. ultraplot/cmaps/Amp.rgb +256 -0
  13. ultraplot/cmaps/BR.rgb +256 -0
  14. ultraplot/cmaps/Balance.rgb +256 -0
  15. ultraplot/cmaps/Blues1_r.xml +17 -0
  16. ultraplot/cmaps/Blues2.xml +16 -0
  17. ultraplot/cmaps/Blues3.xml +25 -0
  18. ultraplot/cmaps/Blues4_r.xml +17 -0
  19. ultraplot/cmaps/Blues5.xml +16 -0
  20. ultraplot/cmaps/Blues6.xml +25 -0
  21. ultraplot/cmaps/Blues7.xml +16 -0
  22. ultraplot/cmaps/Blues8.xml +17 -0
  23. ultraplot/cmaps/Blues9.xml +1 -0
  24. ultraplot/cmaps/Boreal.json +53 -0
  25. ultraplot/cmaps/Browns1.xml +16 -0
  26. ultraplot/cmaps/Browns2.xml +26 -0
  27. ultraplot/cmaps/Browns3.xml +17 -0
  28. ultraplot/cmaps/Browns4.xml +17 -0
  29. ultraplot/cmaps/Browns5.xml +26 -0
  30. ultraplot/cmaps/Browns6.xml +17 -0
  31. ultraplot/cmaps/Browns7.xml +19 -0
  32. ultraplot/cmaps/Browns8.xml +11 -0
  33. ultraplot/cmaps/Browns9.xml +1 -0
  34. ultraplot/cmaps/ColdHot.rgb +229 -0
  35. ultraplot/cmaps/Crest.rgb +256 -0
  36. ultraplot/cmaps/Curl.rgb +512 -0
  37. ultraplot/cmaps/Deep.rgb +256 -0
  38. ultraplot/cmaps/Delta.rgb +512 -0
  39. ultraplot/cmaps/Dense.rgb +256 -0
  40. ultraplot/cmaps/Div.json +71 -0
  41. ultraplot/cmaps/DryWet.json +73 -0
  42. ultraplot/cmaps/Dusk.json +53 -0
  43. ultraplot/cmaps/Fire.json +53 -0
  44. ultraplot/cmaps/Flare.rgb +256 -0
  45. ultraplot/cmaps/Glacial.json +53 -0
  46. ultraplot/cmaps/Greens1_r.xml +26 -0
  47. ultraplot/cmaps/Greens2.xml +28 -0
  48. ultraplot/cmaps/Greens3_r.xml +28 -0
  49. ultraplot/cmaps/Greens4.xml +17 -0
  50. ultraplot/cmaps/Greens5.xml +16 -0
  51. ultraplot/cmaps/Greens6_r.xml +16 -0
  52. ultraplot/cmaps/Greens7.xml +16 -0
  53. ultraplot/cmaps/Greens8.xml +26 -0
  54. ultraplot/cmaps/Haline.rgb +256 -0
  55. ultraplot/cmaps/Ice.rgb +256 -0
  56. ultraplot/cmaps/IceFire.rgb +256 -0
  57. ultraplot/cmaps/Mako.rgb +256 -0
  58. ultraplot/cmaps/Marine.json +53 -0
  59. ultraplot/cmaps/Matter.rgb +256 -0
  60. ultraplot/cmaps/Mono.txt +256 -0
  61. ultraplot/cmaps/MonoCycle.txt +256 -0
  62. ultraplot/cmaps/NegPos.json +71 -0
  63. ultraplot/cmaps/Oranges1.xml +27 -0
  64. ultraplot/cmaps/Oranges2.xml +26 -0
  65. ultraplot/cmaps/Oranges3.xml +15 -0
  66. ultraplot/cmaps/Oranges4.xml +23 -0
  67. ultraplot/cmaps/Oxy.rgb +256 -0
  68. ultraplot/cmaps/Phase.rgb +256 -0
  69. ultraplot/cmaps/Purples1_r.xml +16 -0
  70. ultraplot/cmaps/Purples2.xml +17 -0
  71. ultraplot/cmaps/Purples3.xml +18 -0
  72. ultraplot/cmaps/Reds1.xml +26 -0
  73. ultraplot/cmaps/Reds2.xml +22 -0
  74. ultraplot/cmaps/Reds3.xml +23 -0
  75. ultraplot/cmaps/Reds4.xml +26 -0
  76. ultraplot/cmaps/Reds5.xml +17 -0
  77. ultraplot/cmaps/Rocket.rgb +256 -0
  78. ultraplot/cmaps/Solar.rgb +256 -0
  79. ultraplot/cmaps/Speed.rgb +256 -0
  80. ultraplot/cmaps/Stellar.json +53 -0
  81. ultraplot/cmaps/Sunrise.json +53 -0
  82. ultraplot/cmaps/Sunset.json +53 -0
  83. ultraplot/cmaps/Tempo.rgb +256 -0
  84. ultraplot/cmaps/Thermal.rgb +256 -0
  85. ultraplot/cmaps/Turbid.rgb +256 -0
  86. ultraplot/cmaps/Vivid.xml +11 -0
  87. ultraplot/cmaps/Vlag.rgb +256 -0
  88. ultraplot/cmaps/Yellows1.xml +17 -0
  89. ultraplot/cmaps/Yellows2.xml +17 -0
  90. ultraplot/cmaps/Yellows3.xml +17 -0
  91. ultraplot/cmaps/Yellows4.xml +17 -0
  92. ultraplot/cmaps/acton.txt +256 -0
  93. ultraplot/cmaps/bam.txt +256 -0
  94. ultraplot/cmaps/bamO.txt +256 -0
  95. ultraplot/cmaps/bamako.txt +256 -0
  96. ultraplot/cmaps/batlow.txt +256 -0
  97. ultraplot/cmaps/batlowK.txt +256 -0
  98. ultraplot/cmaps/batlowW.txt +256 -0
  99. ultraplot/cmaps/berlin.txt +256 -0
  100. ultraplot/cmaps/bilbao.txt +256 -0
  101. ultraplot/cmaps/broc.txt +256 -0
  102. ultraplot/cmaps/brocO.txt +256 -0
  103. ultraplot/cmaps/buda.txt +256 -0
  104. ultraplot/cmaps/bukavu.txt +256 -0
  105. ultraplot/cmaps/cork.txt +256 -0
  106. ultraplot/cmaps/corkO.txt +256 -0
  107. ultraplot/cmaps/davos.txt +256 -0
  108. ultraplot/cmaps/devon.txt +256 -0
  109. ultraplot/cmaps/fes.txt +256 -0
  110. ultraplot/cmaps/hawaii.txt +256 -0
  111. ultraplot/cmaps/imola.txt +256 -0
  112. ultraplot/cmaps/lajolla.txt +256 -0
  113. ultraplot/cmaps/lapaz.txt +256 -0
  114. ultraplot/cmaps/lisbon.txt +256 -0
  115. ultraplot/cmaps/nuuk.txt +256 -0
  116. ultraplot/cmaps/oleron.txt +256 -0
  117. ultraplot/cmaps/oslo.txt +256 -0
  118. ultraplot/cmaps/roma.txt +256 -0
  119. ultraplot/cmaps/romaO.txt +256 -0
  120. ultraplot/cmaps/tofino.txt +256 -0
  121. ultraplot/cmaps/tokyo.txt +256 -0
  122. ultraplot/cmaps/turku.txt +256 -0
  123. ultraplot/cmaps/vanimo.txt +256 -0
  124. ultraplot/cmaps/vik.txt +256 -0
  125. ultraplot/cmaps/vikO.txt +256 -0
  126. ultraplot/colors/opencolor.txt +132 -0
  127. ultraplot/colors/xkcd.txt +951 -0
  128. ultraplot/colors.py +3241 -0
  129. ultraplot/colors.py.rej +243 -0
  130. ultraplot/config.py +1809 -0
  131. ultraplot/constructor.py +1633 -0
  132. ultraplot/cycles/538.hex +2 -0
  133. ultraplot/cycles/FlatUI.hex +1 -0
  134. ultraplot/cycles/Qual1.rgb +7 -0
  135. ultraplot/cycles/Qual2.rgb +13 -0
  136. ultraplot/cycles/bmh.hex +2 -0
  137. ultraplot/cycles/classic.hex +2 -0
  138. ultraplot/cycles/colorblind.hex +2 -0
  139. ultraplot/cycles/colorblind10.hex +2 -0
  140. ultraplot/cycles/default.hex +2 -0
  141. ultraplot/cycles/ggplot.hex +1 -0
  142. ultraplot/cycles/seaborn.hex +2 -0
  143. ultraplot/cycles/tableau.hex +2 -0
  144. ultraplot/demos.py +1201 -0
  145. ultraplot/externals/__init__.py +5 -0
  146. ultraplot/externals/hsluv.py +330 -0
  147. ultraplot/figure.py +2102 -0
  148. ultraplot/fonts/FiraMath-Bold.ttf +0 -0
  149. ultraplot/fonts/FiraMath-ExtraLight.ttf +0 -0
  150. ultraplot/fonts/FiraMath-Heavy.ttf +0 -0
  151. ultraplot/fonts/FiraMath-Light.ttf +0 -0
  152. ultraplot/fonts/FiraMath-Medium.ttf +0 -0
  153. ultraplot/fonts/FiraMath-Regular.ttf +0 -0
  154. ultraplot/fonts/FiraMath-SemiBold.ttf +0 -0
  155. ultraplot/fonts/FiraMath-UltraLight.ttf +0 -0
  156. ultraplot/fonts/FiraSans-Black.ttf +0 -0
  157. ultraplot/fonts/FiraSans-BlackItalic.ttf +0 -0
  158. ultraplot/fonts/FiraSans-Bold.ttf +0 -0
  159. ultraplot/fonts/FiraSans-BoldItalic.ttf +0 -0
  160. ultraplot/fonts/FiraSans-ExtraBold.ttf +0 -0
  161. ultraplot/fonts/FiraSans-ExtraBoldItalic.ttf +0 -0
  162. ultraplot/fonts/FiraSans-ExtraLight.ttf +0 -0
  163. ultraplot/fonts/FiraSans-ExtraLightItalic.ttf +0 -0
  164. ultraplot/fonts/FiraSans-Italic.ttf +0 -0
  165. ultraplot/fonts/FiraSans-Light.ttf +0 -0
  166. ultraplot/fonts/FiraSans-LightItalic.ttf +0 -0
  167. ultraplot/fonts/FiraSans-Medium.ttf +0 -0
  168. ultraplot/fonts/FiraSans-MediumItalic.ttf +0 -0
  169. ultraplot/fonts/FiraSans-Regular.ttf +0 -0
  170. ultraplot/fonts/FiraSans-SemiBold.ttf +0 -0
  171. ultraplot/fonts/FiraSans-SemiBoldItalic.ttf +0 -0
  172. ultraplot/fonts/LICENSE_FIRAMATH.txt +92 -0
  173. ultraplot/fonts/LICENSE_FIRASANS.txt +97 -0
  174. ultraplot/fonts/LICENSE_NOTOSANS.txt +202 -0
  175. ultraplot/fonts/LICENSE_NOTOSERIF.txt +93 -0
  176. ultraplot/fonts/LICENSE_OPENSANS.txt +202 -0
  177. ultraplot/fonts/LICENSE_ROBOTO.txt +202 -0
  178. ultraplot/fonts/LICENSE_SOURCESANS.txt +93 -0
  179. ultraplot/fonts/LICENSE_SOURCESERIF.txt +93 -0
  180. ultraplot/fonts/LICENSE_TEXGYRE.txt +29 -0
  181. ultraplot/fonts/LICENSE_UBUNTU.txt +96 -0
  182. ultraplot/fonts/NotoSans-Bold.ttf +0 -0
  183. ultraplot/fonts/NotoSans-BoldItalic.ttf +0 -0
  184. ultraplot/fonts/NotoSans-Italic.ttf +0 -0
  185. ultraplot/fonts/NotoSans-Regular.ttf +0 -0
  186. ultraplot/fonts/NotoSerif-Bold.ttf +0 -0
  187. ultraplot/fonts/NotoSerif-BoldItalic.ttf +0 -0
  188. ultraplot/fonts/NotoSerif-Italic.ttf +0 -0
  189. ultraplot/fonts/NotoSerif-Regular.ttf +0 -0
  190. ultraplot/fonts/OpenSans-Bold.ttf +0 -0
  191. ultraplot/fonts/OpenSans-BoldItalic.ttf +0 -0
  192. ultraplot/fonts/OpenSans-Italic.ttf +0 -0
  193. ultraplot/fonts/OpenSans-Regular.ttf +0 -0
  194. ultraplot/fonts/OpenSans-Semibold.ttf +0 -0
  195. ultraplot/fonts/OpenSans-SemiboldItalic.ttf +0 -0
  196. ultraplot/fonts/Roboto-Black.ttf +0 -0
  197. ultraplot/fonts/Roboto-BlackItalic.ttf +0 -0
  198. ultraplot/fonts/Roboto-Bold.ttf +0 -0
  199. ultraplot/fonts/Roboto-BoldItalic.ttf +0 -0
  200. ultraplot/fonts/Roboto-Italic.ttf +0 -0
  201. ultraplot/fonts/Roboto-Light.ttf +0 -0
  202. ultraplot/fonts/Roboto-LightItalic.ttf +0 -0
  203. ultraplot/fonts/Roboto-Medium.ttf +0 -0
  204. ultraplot/fonts/Roboto-MediumItalic.ttf +0 -0
  205. ultraplot/fonts/Roboto-Regular.ttf +0 -0
  206. ultraplot/fonts/SourceSansPro-Black.ttf +0 -0
  207. ultraplot/fonts/SourceSansPro-BlackItalic.ttf +0 -0
  208. ultraplot/fonts/SourceSansPro-Bold.ttf +0 -0
  209. ultraplot/fonts/SourceSansPro-BoldItalic.ttf +0 -0
  210. ultraplot/fonts/SourceSansPro-ExtraLight.ttf +0 -0
  211. ultraplot/fonts/SourceSansPro-ExtraLightItalic.ttf +0 -0
  212. ultraplot/fonts/SourceSansPro-Italic.ttf +0 -0
  213. ultraplot/fonts/SourceSansPro-Light.ttf +0 -0
  214. ultraplot/fonts/SourceSansPro-LightItalic.ttf +0 -0
  215. ultraplot/fonts/SourceSansPro-Regular.ttf +0 -0
  216. ultraplot/fonts/SourceSansPro-SemiBold.ttf +0 -0
  217. ultraplot/fonts/SourceSansPro-SemiBoldItalic.ttf +0 -0
  218. ultraplot/fonts/SourceSerifPro-Black.ttf +0 -0
  219. ultraplot/fonts/SourceSerifPro-BlackItalic.ttf +0 -0
  220. ultraplot/fonts/SourceSerifPro-Bold.ttf +0 -0
  221. ultraplot/fonts/SourceSerifPro-BoldItalic.ttf +0 -0
  222. ultraplot/fonts/SourceSerifPro-ExtraLight.ttf +0 -0
  223. ultraplot/fonts/SourceSerifPro-ExtraLightItalic.ttf +0 -0
  224. ultraplot/fonts/SourceSerifPro-Italic.ttf +0 -0
  225. ultraplot/fonts/SourceSerifPro-Light.ttf +0 -0
  226. ultraplot/fonts/SourceSerifPro-LightItalic.ttf +0 -0
  227. ultraplot/fonts/SourceSerifPro-Regular.ttf +0 -0
  228. ultraplot/fonts/SourceSerifPro-SemiBold.ttf +0 -0
  229. ultraplot/fonts/SourceSerifPro-SemiBoldItalic.ttf +0 -0
  230. ultraplot/fonts/Ubuntu-Bold.ttf +0 -0
  231. ultraplot/fonts/Ubuntu-BoldItalic.ttf +0 -0
  232. ultraplot/fonts/Ubuntu-Italic.ttf +0 -0
  233. ultraplot/fonts/Ubuntu-Light.ttf +0 -0
  234. ultraplot/fonts/Ubuntu-LightItalic.ttf +0 -0
  235. ultraplot/fonts/Ubuntu-Medium.ttf +0 -0
  236. ultraplot/fonts/Ubuntu-MediumItalic.ttf +0 -0
  237. ultraplot/fonts/Ubuntu-Regular.ttf +0 -0
  238. ultraplot/fonts/texgyreadventor-bold.ttf +0 -0
  239. ultraplot/fonts/texgyreadventor-bolditalic.ttf +0 -0
  240. ultraplot/fonts/texgyreadventor-italic.ttf +0 -0
  241. ultraplot/fonts/texgyreadventor-regular.ttf +0 -0
  242. ultraplot/fonts/texgyrebonum-bold.ttf +0 -0
  243. ultraplot/fonts/texgyrebonum-bolditalic.ttf +0 -0
  244. ultraplot/fonts/texgyrebonum-italic.ttf +0 -0
  245. ultraplot/fonts/texgyrebonum-regular.ttf +0 -0
  246. ultraplot/fonts/texgyrechorus-mediumitalic.ttf +0 -0
  247. ultraplot/fonts/texgyrecursor-bold.ttf +0 -0
  248. ultraplot/fonts/texgyrecursor-bolditalic.ttf +0 -0
  249. ultraplot/fonts/texgyrecursor-italic.ttf +0 -0
  250. ultraplot/fonts/texgyrecursor-regular.ttf +0 -0
  251. ultraplot/fonts/texgyreheros-bold.ttf +0 -0
  252. ultraplot/fonts/texgyreheros-bolditalic.ttf +0 -0
  253. ultraplot/fonts/texgyreheros-italic.ttf +0 -0
  254. ultraplot/fonts/texgyreheros-regular.ttf +0 -0
  255. ultraplot/fonts/texgyrepagella-bold.ttf +0 -0
  256. ultraplot/fonts/texgyrepagella-bolditalic.ttf +0 -0
  257. ultraplot/fonts/texgyrepagella-italic.ttf +0 -0
  258. ultraplot/fonts/texgyrepagella-regular.ttf +0 -0
  259. ultraplot/fonts/texgyreschola-bold.ttf +0 -0
  260. ultraplot/fonts/texgyreschola-bolditalic.ttf +0 -0
  261. ultraplot/fonts/texgyreschola-italic.ttf +0 -0
  262. ultraplot/fonts/texgyreschola-regular.ttf +0 -0
  263. ultraplot/fonts/texgyretermes-bold.ttf +0 -0
  264. ultraplot/fonts/texgyretermes-bolditalic.ttf +0 -0
  265. ultraplot/fonts/texgyretermes-italic.ttf +0 -0
  266. ultraplot/fonts/texgyretermes-regular.ttf +0 -0
  267. ultraplot/gridspec.py +1698 -0
  268. ultraplot/internals/__init__.py +529 -0
  269. ultraplot/internals/benchmarks.py +26 -0
  270. ultraplot/internals/context.py +44 -0
  271. ultraplot/internals/docstring.py +139 -0
  272. ultraplot/internals/fonts.py +75 -0
  273. ultraplot/internals/guides.py +167 -0
  274. ultraplot/internals/inputs.py +862 -0
  275. ultraplot/internals/labels.py +85 -0
  276. ultraplot/internals/rcsetup.py +1933 -0
  277. ultraplot/internals/versions.py +61 -0
  278. ultraplot/internals/warnings.py +122 -0
  279. ultraplot/proj.py +325 -0
  280. ultraplot/scale.py +966 -0
  281. ultraplot/tests/__init__.py +28 -0
  282. ultraplot/tests/baseline/test_align_labels.png +0 -0
  283. ultraplot/tests/baseline/test_aligned_outer_guides.png +0 -0
  284. ultraplot/tests/baseline/test_aspect_ratios.png +0 -0
  285. ultraplot/tests/baseline/test_auto_diverging1.png +0 -0
  286. ultraplot/tests/baseline/test_auto_legend.png +0 -0
  287. ultraplot/tests/baseline/test_auto_reverse.png +0 -0
  288. ultraplot/tests/baseline/test_autodiverging3.png +0 -0
  289. ultraplot/tests/baseline/test_autodiverging4.png +0 -0
  290. ultraplot/tests/baseline/test_autodiverging5.png +0 -0
  291. ultraplot/tests/baseline/test_axes_colors.png +0 -0
  292. ultraplot/tests/baseline/test_bar_vectors.png +0 -0
  293. ultraplot/tests/baseline/test_bar_width.png +0 -0
  294. ultraplot/tests/baseline/test_both_ticklabels.png +0 -0
  295. ultraplot/tests/baseline/test_bounds_ticks.png +0 -0
  296. ultraplot/tests/baseline/test_boxplot_colors.png +0 -0
  297. ultraplot/tests/baseline/test_boxplot_vectors.png +0 -0
  298. ultraplot/tests/baseline/test_cartopy_contours.png +0 -0
  299. ultraplot/tests/baseline/test_cartopy_labels.png +0 -0
  300. ultraplot/tests/baseline/test_cartopy_manual.png +0 -0
  301. ultraplot/tests/baseline/test_centered_legends.png +0 -0
  302. ultraplot/tests/baseline/test_cmap_cycles.png +0 -0
  303. ultraplot/tests/baseline/test_colorbar.png +0 -0
  304. ultraplot/tests/baseline/test_colorbar_ticks.png +0 -0
  305. ultraplot/tests/baseline/test_colormap_mode.png +0 -0
  306. ultraplot/tests/baseline/test_column_iteration.png +0 -0
  307. ultraplot/tests/baseline/test_complex_ticks.png +0 -0
  308. ultraplot/tests/baseline/test_contour_labels.png +0 -0
  309. ultraplot/tests/baseline/test_contour_legend_with_label.png +0 -0
  310. ultraplot/tests/baseline/test_contour_legend_without_label.png +0 -0
  311. ultraplot/tests/baseline/test_contour_negative.png +0 -0
  312. ultraplot/tests/baseline/test_contour_single.png +0 -0
  313. ultraplot/tests/baseline/test_cutoff_ticks.png +0 -0
  314. ultraplot/tests/baseline/test_data_keyword.png +0 -0
  315. ultraplot/tests/baseline/test_discrete_ticks.png +0 -0
  316. ultraplot/tests/baseline/test_discrete_vs_fixed.png +0 -0
  317. ultraplot/tests/baseline/test_drawing_in_projection_with_globe.png +0 -0
  318. ultraplot/tests/baseline/test_drawing_in_projection_without_globe.png +0 -0
  319. ultraplot/tests/baseline/test_edge_fix.png +0 -0
  320. ultraplot/tests/baseline/test_flow_functions.png +0 -0
  321. ultraplot/tests/baseline/test_font_adjustments.png +0 -0
  322. ultraplot/tests/baseline/test_geographic_multiple_projections.png +0 -0
  323. ultraplot/tests/baseline/test_geographic_single_projection.png +0 -0
  324. ultraplot/tests/baseline/test_gray_adjustment.png +0 -0
  325. ultraplot/tests/baseline/test_histogram_legend.png +0 -0
  326. ultraplot/tests/baseline/test_histogram_types.png +0 -0
  327. ultraplot/tests/baseline/test_ignore_message.png +0 -0
  328. ultraplot/tests/baseline/test_inbounds_data.png +0 -0
  329. ultraplot/tests/baseline/test_init_format.png +0 -0
  330. ultraplot/tests/baseline/test_inner_title_zorder.png +0 -0
  331. ultraplot/tests/baseline/test_inset_basic.png +0 -0
  332. ultraplot/tests/baseline/test_inset_colorbars.png +0 -0
  333. ultraplot/tests/baseline/test_inset_colors_1.png +0 -0
  334. ultraplot/tests/baseline/test_inset_colors_2.png +0 -0
  335. ultraplot/tests/baseline/test_inset_zoom_update.png +0 -0
  336. ultraplot/tests/baseline/test_invalid_dist.png +0 -0
  337. ultraplot/tests/baseline/test_invalid_plot.png +0 -0
  338. ultraplot/tests/baseline/test_keep_guide_labels.png +0 -0
  339. ultraplot/tests/baseline/test_label_settings.png +0 -0
  340. ultraplot/tests/baseline/test_level_restriction.png +0 -0
  341. ultraplot/tests/baseline/test_levels_with_vmin_vmax.png +0 -0
  342. ultraplot/tests/baseline/test_locale_formatting.png +0 -0
  343. ultraplot/tests/baseline/test_locale_formatting_en_US.UTF-8.png +0 -0
  344. ultraplot/tests/baseline/test_manual_labels.png +0 -0
  345. ultraplot/tests/baseline/test_multi_formatting.png +0 -0
  346. ultraplot/tests/baseline/test_multiple_calls.png +0 -0
  347. ultraplot/tests/baseline/test_on_the_fly_mappable.png +0 -0
  348. ultraplot/tests/baseline/test_outer_align.png +0 -0
  349. ultraplot/tests/baseline/test_panel_dist.png +0 -0
  350. ultraplot/tests/baseline/test_panels_suplabels_three_hor_panels.png +0 -0
  351. ultraplot/tests/baseline/test_panels_with_sharing.png +0 -0
  352. ultraplot/tests/baseline/test_panels_without_sharing_1.png +0 -0
  353. ultraplot/tests/baseline/test_panels_without_sharing_2.png +0 -0
  354. ultraplot/tests/baseline/test_parametric_colors.png +0 -0
  355. ultraplot/tests/baseline/test_parametric_labels.png +0 -0
  356. ultraplot/tests/baseline/test_patch_format.png +0 -0
  357. ultraplot/tests/baseline/test_pie_charts.png +0 -0
  358. ultraplot/tests/baseline/test_pint_quantities.png +0 -0
  359. ultraplot/tests/baseline/test_polar_projections.png +0 -0
  360. ultraplot/tests/baseline/test_projection_dicts.png +0 -0
  361. ultraplot/tests/baseline/test_qualitative_colormaps_1.png +0 -0
  362. ultraplot/tests/baseline/test_qualitative_colormaps_2.png +0 -0
  363. ultraplot/tests/baseline/test_reversed_levels.png +0 -0
  364. ultraplot/tests/baseline/test_scatter_alpha.png +0 -0
  365. ultraplot/tests/baseline/test_scatter_args.png +0 -0
  366. ultraplot/tests/baseline/test_scatter_cycle.png +0 -0
  367. ultraplot/tests/baseline/test_scatter_inbounds.png +0 -0
  368. ultraplot/tests/baseline/test_scatter_sizes.png +0 -0
  369. ultraplot/tests/baseline/test_seaborn_heatmap.png +0 -0
  370. ultraplot/tests/baseline/test_seaborn_hist.png +0 -0
  371. ultraplot/tests/baseline/test_seaborn_relational.png +0 -0
  372. ultraplot/tests/baseline/test_seaborn_swarmplot.png +0 -0
  373. ultraplot/tests/baseline/test_segmented_norm.png +0 -0
  374. ultraplot/tests/baseline/test_segmented_norm_ticks.png +0 -0
  375. ultraplot/tests/baseline/test_share_all_basic.png +0 -0
  376. ultraplot/tests/baseline/test_singleton_legend.png +0 -0
  377. ultraplot/tests/baseline/test_span_labels.png +0 -0
  378. ultraplot/tests/baseline/test_spine_offset.png +0 -0
  379. ultraplot/tests/baseline/test_spine_side.png +0 -0
  380. ultraplot/tests/baseline/test_standardized_input.png +0 -0
  381. ultraplot/tests/baseline/test_statistical_boxplot.png +0 -0
  382. ultraplot/tests/baseline/test_three_axes.png +0 -0
  383. ultraplot/tests/baseline/test_tick_direction.png +0 -0
  384. ultraplot/tests/baseline/test_tick_labels.png +0 -0
  385. ultraplot/tests/baseline/test_tick_length.png +0 -0
  386. ultraplot/tests/baseline/test_tick_width.png +0 -0
  387. ultraplot/tests/baseline/test_title_deflection.png +0 -0
  388. ultraplot/tests/baseline/test_triangular_functions.png +0 -0
  389. ultraplot/tests/baseline/test_tuple_handles.png +0 -0
  390. ultraplot/tests/baseline/test_twin_axes_1.png +0 -0
  391. ultraplot/tests/baseline/test_twin_axes_2.png +0 -0
  392. ultraplot/tests/baseline/test_twin_axes_3.png +0 -0
  393. ultraplot/tests/baseline/test_uneven_levels.png +0 -0
  394. ultraplot/tests/test_1dplots.py +373 -0
  395. ultraplot/tests/test_2dplots.py +354 -0
  396. ultraplot/tests/test_axes.py +179 -0
  397. ultraplot/tests/test_colorbar.py +253 -0
  398. ultraplot/tests/test_docs.py +78 -0
  399. ultraplot/tests/test_format.py +340 -0
  400. ultraplot/tests/test_geographic.py +116 -0
  401. ultraplot/tests/test_imshow.py +110 -0
  402. ultraplot/tests/test_inset.py +28 -0
  403. ultraplot/tests/test_integration.py +149 -0
  404. ultraplot/tests/test_legend.py +181 -0
  405. ultraplot/tests/test_projections.py +138 -0
  406. ultraplot/tests/test_statistical_plotting.py +77 -0
  407. ultraplot/tests/test_subplots.py +174 -0
  408. ultraplot/ticker.py +879 -0
  409. ultraplot/ui.py +233 -0
  410. ultraplot/utils.py +912 -0
  411. ultraplot-0.99.3.dist-info/LICENSE.txt +427 -0
  412. ultraplot-0.99.3.dist-info/METADATA +88 -0
  413. ultraplot-0.99.3.dist-info/RECORD +416 -0
  414. ultraplot-0.99.3.dist-info/WHEEL +5 -0
  415. ultraplot-0.99.3.dist-info/entry_points.txt +2 -0
  416. ultraplot-0.99.3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,253 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Test colorbars.
4
+ """
5
+ import numpy as np
6
+ import pytest
7
+ import ultraplot as pplt
8
+
9
+ state = np.random.RandomState(51423)
10
+
11
+
12
+ @pytest.mark.mpl_image_compare
13
+ def test_outer_align():
14
+ """
15
+ Test various align options.
16
+ """
17
+ fig, ax = pplt.subplots()
18
+ ax.plot(np.empty((0, 4)), labels=list("abcd"))
19
+ ax.legend(loc="bottom", align="right", ncol=2)
20
+ ax.legend(loc="left", align="bottom", ncol=1)
21
+ ax.colorbar("magma", loc="r", align="top", shrink=0.5, label="label", extend="both")
22
+ ax.colorbar(
23
+ "magma",
24
+ loc="top",
25
+ ticklen=0,
26
+ tickloc="bottom",
27
+ align="left",
28
+ shrink=0.5,
29
+ label="Title",
30
+ extend="both",
31
+ labelloc="top",
32
+ labelweight="bold",
33
+ )
34
+ ax.colorbar("magma", loc="right", extend="both", label="test extensions")
35
+ fig.suptitle("Align demo")
36
+ return fig
37
+
38
+
39
+ @pytest.mark.mpl_image_compare
40
+ def test_colorbar_ticks():
41
+ """
42
+ Test ticks modification.
43
+ """
44
+ fig, axs = pplt.subplots(ncols=2)
45
+ ax = axs[0]
46
+ ax.colorbar("magma", loc="bottom", ticklen=10, linewidth=3, tickminor=True)
47
+ ax = axs[1]
48
+ ax.colorbar(
49
+ "magma", loc="bottom", ticklen=10, linewidth=3, tickwidth=1.5, tickminor=True
50
+ )
51
+ return fig
52
+
53
+
54
+ @pytest.mark.mpl_image_compare
55
+ def test_discrete_ticks():
56
+ """
57
+ Test `DiscreteLocator`.
58
+ """
59
+ levels = pplt.arange(0, 2, 0.1)
60
+ data = state.rand(5, 5) * 2
61
+ fig, axs = pplt.subplots(share=False, ncols=2, nrows=2, refwidth=2)
62
+ for i, ax in enumerate(axs):
63
+ cmd = ax.contourf if i // 2 == 0 else ax.pcolormesh
64
+ m = cmd(data, levels=levels, extend="both")
65
+ ax.colorbar(m, loc="t" if i // 2 == 0 else "b")
66
+ ax.colorbar(m, loc="l" if i % 2 == 0 else "r")
67
+ return fig
68
+
69
+
70
+ @pytest.mark.mpl_image_compare
71
+ def test_discrete_vs_fixed():
72
+ """
73
+ Test `DiscreteLocator` for numeric on-the-fly
74
+ mappable ticks and `FixedLocator` otherwise.
75
+ """
76
+ fig, axs = pplt.subplots(ncols=2, nrows=3, refwidth=1.3, share=False)
77
+ axs[0].plot(state.rand(10, 5), labels=list("xyzpq"), colorbar="b") # fixed
78
+ axs[1].plot(state.rand(10, 5), labels=np.arange(5), colorbar="b") # discrete
79
+ axs[2].contourf(
80
+ state.rand(10, 10),
81
+ colorbar="b",
82
+ colorbar_kw={"ticklabels": list("xyzpq")}, # fixed
83
+ )
84
+ axs[3].contourf(state.rand(10, 10), colorbar="b") # discrete
85
+ axs[4].pcolormesh(
86
+ state.rand(10, 10) * 20, colorbar="b", levels=[0, 2, 4, 6, 8, 10, 15, 20]
87
+ ) # fixed
88
+ axs[5].pcolormesh(
89
+ state.rand(10, 10) * 20, colorbar="b", levels=pplt.arange(0, 20, 2)
90
+ ) # discrete
91
+ return fig
92
+
93
+
94
+ @pytest.mark.mpl_image_compare
95
+ def test_uneven_levels():
96
+ """
97
+ Test even and uneven levels with discrete cmap. Ensure minor ticks are disabled.
98
+ """
99
+ N = 20
100
+ state = np.random.RandomState(51423)
101
+ data = np.cumsum(state.rand(N, N), axis=1) * 12
102
+ colors = [
103
+ "white",
104
+ "indigo1",
105
+ "indigo3",
106
+ "indigo5",
107
+ "indigo7",
108
+ "indigo9",
109
+ "yellow1",
110
+ "yellow3",
111
+ "yellow5",
112
+ "yellow7",
113
+ "yellow9",
114
+ "violet1",
115
+ "violet3",
116
+ ]
117
+ levels_even = pplt.arange(1, 12, 1)
118
+ levels_uneven = [1.0, 1.25, 1.5, 2.0, 2.5, 3.0, 3.75, 4.5, 6.0, 7.5, 9.0, 12.0]
119
+ fig, axs = pplt.subplots(ncols=2, refwidth=3.0)
120
+ axs[0].pcolor(
121
+ data, levels=levels_uneven, colors=colors, colorbar="r", extend="both"
122
+ )
123
+ axs[1].pcolor(data, levels=levels_even, colors=colors, colorbar="r", extend="both")
124
+ return fig
125
+
126
+
127
+ @pytest.mark.mpl_image_compare
128
+ def test_on_the_fly_mappable():
129
+ """
130
+ Test on-the-fly mappable generation.
131
+ """
132
+ fig, axs = pplt.subplots(ncols=2, nrows=3, space=3)
133
+ axs.format(aspect=0.5)
134
+ axs[0].colorbar("magma", vmin=None, vmax=100, values=[0, 1, 2, 3, 4], loc="bottom")
135
+ axs[1].colorbar("magma", vmin=None, vmax=100, loc="bottom")
136
+ axs[2].colorbar("colorblind", vmin=None, vmax=None, values=[0, 1, 2], loc="bottom")
137
+ axs[3].colorbar("colorblind", vmin=None, vmax=None, loc="bottom")
138
+ axs[4].colorbar(["r", "b", "g", "k", "w"], values=[0, 1, 2], loc="b")
139
+ axs[5].colorbar(["r", "b", "g", "k", "w"], loc="bottom")
140
+
141
+ # Passing labels to plot function.
142
+ fig, ax = pplt.subplots()
143
+ ax.scatter(state.rand(10, 4), labels=["foo", "bar", "baz", "xyz"], colorbar="b")
144
+
145
+ # Passing string value lists. This helps complete the analogy with legend 'labels'.
146
+ fig, ax = pplt.subplots()
147
+ hs = ax.line(state.rand(20, 5))
148
+ ax.colorbar(hs, loc="b", values=["abc", "def", "ghi", "pqr", "xyz"])
149
+ return fig
150
+
151
+
152
+ @pytest.mark.mpl_image_compare
153
+ def test_inset_colorbars():
154
+ """
155
+ Test basic functionality.
156
+ """
157
+ # Simple example
158
+ fig, ax = pplt.subplots()
159
+ ax.colorbar("magma", loc="ul")
160
+
161
+ # Colorbars from lines
162
+ fig = pplt.figure(share=False, refwidth=2)
163
+ ax = fig.subplot(121)
164
+ state = np.random.RandomState(51423)
165
+ data = 1 + (state.rand(12, 10) - 0.45).cumsum(axis=0)
166
+ cycle = pplt.Cycle("algae")
167
+ hs = ax.line(
168
+ data,
169
+ lw=4,
170
+ cycle=cycle,
171
+ colorbar="lr",
172
+ colorbar_kw={"length": "8em", "label": "line colorbar"},
173
+ )
174
+ ax.colorbar(hs, loc="t", values=np.arange(0, 10), label="line colorbar", ticks=2)
175
+
176
+ # Colorbars from a mappable
177
+ ax = fig.subplot(122)
178
+ m = ax.contourf(data.T, extend="both", cmap="algae", levels=pplt.arange(0, 3, 0.5))
179
+ fig.colorbar(
180
+ m,
181
+ loc="r",
182
+ length=1, # length is relative
183
+ label="interior ticks",
184
+ tickloc="left",
185
+ )
186
+ ax.colorbar(
187
+ m,
188
+ loc="ul",
189
+ length=6, # length is em widths
190
+ label="inset colorbar",
191
+ tickminor=True,
192
+ alpha=0.5,
193
+ )
194
+ fig.format(
195
+ suptitle="Colorbar formatting demo",
196
+ xlabel="xlabel",
197
+ ylabel="ylabel",
198
+ titleabove=False,
199
+ )
200
+ return fig
201
+
202
+
203
+ @pytest.mark.skip("not sure what this does")
204
+ @pytest.mark.mpl_image_compare
205
+ def test_segmented_norm_center():
206
+ """
207
+ Test various align options.
208
+ """
209
+ fig, ax = pplt.subplots()
210
+ cmap = pplt.Colormap("NegPos", cut=0.1)
211
+ data = state.rand(10, 10) * 10 - 2
212
+ levels = [-4, -3, -2, -1, 0, 1, 2, 4, 8, 16, 32, 64, 128]
213
+ norm = pplt.SegmentedNorm(levels, vcenter=0, fair=1)
214
+ ax.pcolormesh(data, levels=levels, norm=norm, cmap=cmap, colorbar="b")
215
+ return fig
216
+
217
+
218
+ @pytest.mark.mpl_image_compare
219
+ def test_segmented_norm_ticks():
220
+ """
221
+ Ensure segmented norm ticks show up in center when `values` are passed.
222
+ """
223
+ fig, ax = pplt.subplots()
224
+ data = state.rand(10, 10) * 10
225
+ values = (1, 5, 5.5, 6, 10)
226
+ ax.contourf(
227
+ data,
228
+ values=values,
229
+ colorbar="ll",
230
+ colorbar_kw={"tickminor": True, "minorlocator": np.arange(-20, 20, 0.5)},
231
+ )
232
+ return fig
233
+
234
+
235
+ @pytest.mark.mpl_image_compare
236
+ def test_reversed_levels():
237
+ """
238
+ Test negative levels with a discrete norm and segmented norm.
239
+ """
240
+ fig, axs = pplt.subplots(ncols=4, nrows=2, refwidth=1.8)
241
+ data = state.rand(20, 20).cumsum(axis=0)
242
+ i = 0
243
+ for stride in (1, -1):
244
+ for key in ("levels", "values"):
245
+ for levels in (
246
+ np.arange(0, 15, 1), # with Normalizer
247
+ [0, 1, 2, 5, 10, 15], # with LinearSegmentedNorm
248
+ ):
249
+ ax = axs[i]
250
+ kw = {key: levels[::stride]}
251
+ ax.pcolormesh(data, colorbar="b", **kw)
252
+ i += 1
253
+ return fig
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Automatically build pytests from jupytext py:percent documentation files.
4
+ """
5
+ # import glob
6
+ # import os
7
+
8
+ # import jupytext
9
+ # import pytest
10
+
11
+ # from ultraplot.config import rc
12
+ # from ultraplot.tests import SAVEFIG_KWARGS, TOLERANCE, VERSION_STRING
13
+
14
+
15
+ # def _init_tests():
16
+ # """
17
+ # Construct tests from the jupytext docs examples.
18
+ # """
19
+ # # WARNING: This will only work if all jupytext examples consist of single code
20
+ # # cells or adjacent code cells without intervening markdown or ReST cells.
21
+ # # Alternative would be to define the entire file as a single test but that
22
+ # # would make testing and debugging more difficult.
23
+ # base = os.path.dirname(__file__)
24
+ # paths = glob.glob(f'{base}/../../docs/*.py')
25
+ # for path in sorted(paths):
26
+ # if os.path.basename(path) == 'conf.py':
27
+ # continue
28
+ # baseline, _ = os.path.splitext(os.path.basename(path))
29
+ # result = jupytext.read(path, fmt='py:percent')
30
+ # cells = result['cells']
31
+ # source = ''
32
+ # num = 1
33
+ # for i, cell in enumerate(cells):
34
+ # type_ = cell['cell_type']
35
+ # if type_ == 'code':
36
+ # source += '\n' + cell['source']
37
+ # if not source:
38
+ # continue
39
+ # if i == len(cells) - 1 or type_ != 'code': # end of example definition
40
+ # _make_cell_test(num, baseline, source)
41
+ # num += 1
42
+ # print(f'\nMade {num} tests from file: {path}', end='')
43
+
44
+
45
+ # def _make_cell_test(num, baseline, cell_source):
46
+ # """
47
+ # Add a test using the jupytext docs cell.
48
+ # """
49
+ # # WARNING: Ugly kludge to replace e.g. backend='basemap' with backend='cartopy'
50
+ # # for matplotlib versions incompatible with basemap. Generally these examples
51
+ # # test basemap and cartopy side-by-side so this will effectively duplicate the
52
+ # # cartopy tests but keep us from having to dump them.
53
+ # if baseline == 'test_projections' and VERSION_STRING == 'mpl32':
54
+ # cell_source = cell_source.replace("'basemap'", "'cartopy'")
55
+ # if 'pplt.Proj' in cell_source or 'Table' in cell_source:
56
+ # return # examples that cannot be naively converted
57
+
58
+ # def run_test():
59
+ # rc.reset()
60
+ # exec(cell_source)
61
+
62
+ # name = f'{baseline}_cell_{num:02d}'
63
+ # decorator = pytest.mark.mpl_image_compare(
64
+ # run_test,
65
+ # filename=f'{name}_{VERSION_STRING}.png',
66
+ # baseline_dir='images_docs',
67
+ # savefig_kwargs=SAVEFIG_KWARGS,
68
+ # tolerance=TOLERANCE,
69
+ # style={}, # no mpl style
70
+ # )
71
+ # test = decorator(run_test)
72
+ # name = f'test_{name}'
73
+ # test.__name__ = test.__qualname__ = name
74
+ # globals()[name] = test # for pytest detection
75
+
76
+
77
+ # # Initialize functions
78
+ # _init_tests()
@@ -0,0 +1,340 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Test format and rc behavior.
4
+ """
5
+ import locale, numpy as np, ultraplot as pplt, pytest
6
+ import warnings
7
+
8
+ state = np.random.RandomState(51423)
9
+
10
+
11
+ # def test_colormap_assign():
12
+ # """
13
+ # Test below line is possible and naming schemes.
14
+ # """
15
+ # pplt.rc["image.cmap"] = pplt.Colormap("phase", shift=180, left=0.2)
16
+ # assert pplt.rc["cmap"] == pplt.rc["cmap.sequential"] == "_Phase_copy_s"
17
+ # pplt.rc["image.cmap"] = pplt.Colormap("magma", reverse=True, right=0.8)
18
+ # assert pplt.rc["image.cmap"] == pplt.rc["cmap.sequential"] == "_magma_copy_r"
19
+
20
+
21
+ def test_ignored_keywords():
22
+ """
23
+ Test ignored keywords and functions.
24
+ """
25
+ with warnings.catch_warnings(record=True) as record:
26
+ fig, ax = pplt.subplots(
27
+ gridspec_kw={"left": 3},
28
+ subplot_kw={"proj": "cart"},
29
+ subplotpars={"left": 0.2},
30
+ )
31
+ assert len(record) == 3
32
+ with warnings.catch_warnings(record=True) as record:
33
+ fig.subplots_adjust(left=0.2)
34
+ assert len(record) == 1
35
+
36
+
37
+ @pytest.mark.mpl_image_compare
38
+ def test_init_format():
39
+ """
40
+ Test application of format args on initialization.
41
+ """
42
+ fig, axs = pplt.subplots(
43
+ ncols=2,
44
+ xlim=(0, 10),
45
+ xlabel="xlabel",
46
+ abc=True,
47
+ title="Subplot title",
48
+ collabels=["Column 1", "Column 2"],
49
+ suptitle="Figure title",
50
+ )
51
+ axs[0].format(hatch="xxx", hatchcolor="k", facecolor="blue3")
52
+ return fig
53
+
54
+
55
+ @pytest.mark.mpl_image_compare
56
+ def test_patch_format():
57
+ """
58
+ Test application of patch args on initialization.
59
+ """
60
+ fig = pplt.figure(suptitle="Super title")
61
+ fig.subplot(
62
+ 121, proj="cyl", labels=True, land=True, latlines=20, abcloc="l", abc="[A]"
63
+ )
64
+ fig.subplot(
65
+ 122,
66
+ facecolor="gray1",
67
+ color="red",
68
+ titleloc="l",
69
+ title="Hello",
70
+ abcloc="l",
71
+ abc="[A]",
72
+ xticks=0.1,
73
+ yformatter="scalar",
74
+ )
75
+ return fig
76
+
77
+
78
+ @pytest.mark.mpl_image_compare
79
+ def test_multi_formatting():
80
+ """
81
+ Support formatting in multiple projections.
82
+ """
83
+ fig, axs = pplt.subplots(ncols=2, proj=("cart", "cyl"))
84
+ axs[0].pcolormesh(state.rand(5, 5))
85
+ fig.format(
86
+ land=1,
87
+ labels=1,
88
+ lonlim=(0, 90),
89
+ latlim=(0, 90),
90
+ xlim=(0, 10),
91
+ ylim=(0, 10),
92
+ )
93
+ axs[:1].format(
94
+ land=1,
95
+ labels=1,
96
+ lonlim=(0, 90),
97
+ latlim=(0, 90),
98
+ xlim=(0, 10),
99
+ ylim=(0, 10),
100
+ )
101
+ return fig
102
+
103
+
104
+ @pytest.mark.mpl_image_compare
105
+ def test_inner_title_zorder():
106
+ """
107
+ Test prominence of contour labels and whatnot.
108
+ """
109
+ fig, ax = pplt.subplots()
110
+ ax.format(
111
+ title="TITLE", titleloc="upper center", titleweight="bold", titlesize="xx-large"
112
+ )
113
+ ax.format(xlim=(0, 1), ylim=(0, 1))
114
+ ax.text(
115
+ 0.5,
116
+ 0.95,
117
+ "text",
118
+ ha="center",
119
+ va="top",
120
+ color="red",
121
+ weight="bold",
122
+ size="xx-large",
123
+ )
124
+ x = [[0.4, 0.6]] * 2
125
+ y = z = [[0.9, 0.9], [1.0, 1.0]]
126
+ ax.contour(
127
+ x,
128
+ y,
129
+ z,
130
+ color="k",
131
+ labels=True,
132
+ levels=None,
133
+ labels_kw={"color": "blue", "weight": "bold", "size": "xx-large"},
134
+ )
135
+ return fig
136
+
137
+
138
+ @pytest.mark.mpl_image_compare
139
+ def test_font_adjustments():
140
+ """
141
+ Test font name application. Somewhat hard to do.
142
+ """
143
+ fig, axs = pplt.subplots(ncols=2)
144
+ axs.format(
145
+ abc="A.",
146
+ fontsize=15,
147
+ fontname="Fira Math",
148
+ xlabel="xlabel",
149
+ ylabel="ylabel",
150
+ title="Title",
151
+ figtitle="Figure title",
152
+ collabels=["Column 1", "Column 2"],
153
+ )
154
+ return fig
155
+
156
+
157
+ @pytest.mark.mpl_image_compare
158
+ def test_axes_colors():
159
+ """
160
+ Test behavior of passing color to format.
161
+ """
162
+ fig, axs = pplt.subplots(
163
+ ncols=3,
164
+ nrows=2,
165
+ share=False,
166
+ proj=("cyl", "cart", "polar", "cyl", "cart", "polar"),
167
+ wratios=(2, 2, 1),
168
+ )
169
+ axs[:, 0].format(labels=True)
170
+ axs[:3].format(edgecolor="red", gridlabelsize="med-large", gridlabelweight="bold")
171
+ axs[:3].format(color="red") # without this just colors the edge
172
+ axs[1].format(xticklabelcolor="gray")
173
+ # axs[2].format(ticklabelcolor='red')
174
+ axs[1].format(tickcolor="blue")
175
+ axs[3:].format(color="red") # ensure propagates
176
+ # axs[-1].format(gridlabelcolor='green') # should work
177
+ return fig
178
+
179
+
180
+ @pytest.mark.parametrize("loc", ["en_US.UTF-8"])
181
+ @pytest.mark.mpl_image_compare
182
+ def test_locale_formatting(loc):
183
+ """
184
+ Ensure locale formatting works. Also zerotrim should account
185
+ for non-period decimal separators.
186
+ """
187
+ # dealing with read the docs
188
+ original_locale = locale.getlocale()
189
+ try:
190
+ try:
191
+ locale.setlocale(locale.LC_ALL, loc)
192
+ except locale.Error:
193
+ pytest.skip(f"Locale {loc} not available on this system")
194
+
195
+ # Your test code that is sensitive to the locale settings
196
+ assert locale.getlocale() == (loc.split(".")[0], loc.split(".")[1])
197
+
198
+ pplt.rc["formatter.use_locale"] = False
199
+ pplt.rc["formatter.zerotrim"] = True
200
+ with pplt.rc.context({"formatter.use_locale": True}):
201
+ fig, ax = pplt.subplots()
202
+ ticks = pplt.arange(-1, 1, 0.1)
203
+ ax.format(ylim=(min(ticks), max(ticks)), yticks=ticks)
204
+ return fig
205
+ finally:
206
+ # Always reset to the original locale
207
+ locale.setlocale(locale.LC_ALL, original_locale)
208
+ pplt.rc["formatter.use_locale"] = False
209
+ pplt.rc["formatter.zerotrim"] = True
210
+ with pplt.rc.context({"formatter.use_locale": True}):
211
+ fig, ax = pplt.subplots()
212
+ ticks = pplt.arange(-1, 1, 0.1)
213
+ ax.format(ylim=(min(ticks), max(ticks)), yticks=ticks)
214
+ return fig
215
+
216
+
217
+ @pytest.mark.mpl_image_compare
218
+ def test_bounds_ticks():
219
+ """
220
+ Test spine bounds and location. Previously applied `fixticks`
221
+ automatically but no longer the case.
222
+ """
223
+ fig, ax = pplt.subplots()
224
+ # ax.format(xlim=(-10, 10))
225
+ ax.format(xloc="top")
226
+ ax.format(xlim=(-10, 15), xbounds=(0, 10))
227
+ return fig
228
+
229
+
230
+ @pytest.mark.mpl_image_compare
231
+ def test_cutoff_ticks():
232
+ """
233
+ Test spine cutoff ticks.
234
+ """
235
+ fig, ax = pplt.subplots()
236
+ # ax.format(xlim=(-10, 10))
237
+ ax.format(xlim=(-10, 10), xscale=("cutoff", 0, 2), xloc="top", fixticks=True)
238
+ ax.axvspan(0, 100, facecolor="k", alpha=0.1)
239
+ return fig
240
+
241
+
242
+ @pytest.mark.mpl_image_compare
243
+ def test_spine_side():
244
+ """
245
+ Test automatic spine selection when passing `xspineloc` or `yspineloc`.
246
+ """
247
+ fig, ax = pplt.subplots()
248
+ ax.plot(pplt.arange(-5, 5), (10 * state.rand(11, 5) - 5).cumsum(axis=0))
249
+ ax.format(xloc="bottom", yloc="zero")
250
+ ax.alty(loc="right")
251
+ return fig
252
+
253
+
254
+ @pytest.mark.mpl_image_compare
255
+ def test_spine_offset():
256
+ """
257
+ Test offset axes.
258
+ """
259
+ fig, ax = pplt.subplots()
260
+ ax.format(xloc="none") # test none instead of neither
261
+ ax.alty(loc=("axes", -0.2), color="red")
262
+ # ax.alty(loc=('axes', 1.2), color='blue')
263
+ ax.alty(loc=("axes", -0.4), color="blue")
264
+ ax.alty(loc=("axes", 1.1), color="green")
265
+ return fig
266
+
267
+
268
+ @pytest.mark.mpl_image_compare
269
+ def test_tick_direction():
270
+ """
271
+ Test tick direction arguments.
272
+ """
273
+ fig, axs = pplt.subplots(ncols=2)
274
+ axs[0].format(tickdir="in")
275
+ axs[1].format(xtickdirection="inout", ytickdir="out") # rc setting should be used?
276
+ return fig
277
+
278
+
279
+ @pytest.mark.mpl_image_compare
280
+ def test_tick_length():
281
+ """
282
+ Test tick length args. Ensure ratios can be applied successively.
283
+ """
284
+ fig, ax = pplt.subplots()
285
+ ax.format(yticklen=100)
286
+ ax.format(xticklen=50, yticklenratio=0.1)
287
+ return fig
288
+
289
+
290
+ @pytest.mark.mpl_image_compare
291
+ def test_tick_width():
292
+ """
293
+ Test tick width args. Ensure ratios can be applied successively, setting
294
+ width to `zero` adjusts length for label padding, and ticks can appear
295
+ without spines if requested.
296
+ """
297
+ fig, axs = pplt.subplots(ncols=2, nrows=2, share=False)
298
+ ax = axs[0]
299
+ ax.format(linewidth=2, ticklen=20, xtickwidthratio=1)
300
+ ax.format(ytickwidthratio=0.3)
301
+ ax = axs[1]
302
+ ax.format(axeslinewidth=0, ticklen=20, tickwidth=2) # should permit ticks
303
+ ax = axs[2]
304
+ ax.format(tickwidth=0, ticklen=50) # should set length to zero
305
+ ax = axs[3]
306
+ ax.format(linewidth=0, ticklen=20, tickwidth="5em") # should override linewidth
307
+ return fig
308
+
309
+
310
+ @pytest.mark.mpl_image_compare
311
+ def test_tick_labels():
312
+ """
313
+ Test default and overwriting properties of auto tick labels.
314
+ """
315
+ import pandas as pd
316
+
317
+ data = state.rand(5, 3)
318
+ data = pd.DataFrame(data, index=["foo", "bar", "baz", "bat", "bot"])
319
+ fig, axs = pplt.subplots(abc="A.", abcloc="ul", ncols=2, refwidth=3, span=False)
320
+ for i, ax in enumerate(axs):
321
+ data.index.name = "label"
322
+ if i == 1:
323
+ ax.format(xformatter="null") # overrides result
324
+ ax.bar(data, autoformat=True)
325
+ if i == 0:
326
+ data.index = ["abc", "def", "ghi", "jkl", "mno"]
327
+ data.index.name = "foobar" # label should be updated
328
+ ax.bar(-data, autoformat=True)
329
+ return fig
330
+
331
+
332
+ @pytest.mark.mpl_image_compare
333
+ def test_label_settings():
334
+ """
335
+ Test label colors and ensure color change does not erase labels.
336
+ """
337
+ fig, ax = pplt.subplots()
338
+ ax.format(xlabel="xlabel", ylabel="ylabel")
339
+ ax.format(labelcolor="red")
340
+ return fig