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,354 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Test 2D plotting overrides.
4
+ """
5
+ import numpy as np
6
+ import pytest
7
+ import xarray as xr
8
+
9
+ import ultraplot as pplt
10
+
11
+ state = np.random.RandomState(51423)
12
+
13
+
14
+ @pytest.mark.skip("not sure what this does")
15
+ @pytest.mark.mpl_image_compare
16
+ def test_colormap_vcenter():
17
+ """
18
+ Test colormap vcenter.
19
+ """
20
+ fig, axs = pplt.subplots(ncols=3)
21
+ data = 10 * state.rand(10, 10) - 3
22
+ axs[0].pcolor(data, vcenter=0)
23
+ axs[1].pcolor(data, vcenter=1)
24
+ axs[2].pcolor(data, vcenter=2)
25
+ return fig
26
+
27
+
28
+ @pytest.mark.mpl_image_compare
29
+ def test_auto_diverging1():
30
+ """
31
+ Test that auto diverging works.
32
+ """
33
+ # Test with basic data
34
+ fig = pplt.figure()
35
+ # fig.format(collabels=('Auto sequential', 'Auto diverging'), suptitle='Default')
36
+ ax = fig.subplot(121)
37
+ ax.pcolor(state.rand(10, 10) * 5, colorbar="b")
38
+ ax = fig.subplot(122)
39
+ ax.pcolor(state.rand(10, 10) * 5 - 3.5, colorbar="b")
40
+ fig.format(toplabels=("Sequential", "Diverging"))
41
+ return fig
42
+
43
+
44
+ @pytest.mark.skip("Not sure what this does")
45
+ @pytest.mark.mpl_image_compare
46
+ def test_autodiverging2():
47
+ # Test with explicit vcenter
48
+ fig, axs = pplt.subplots(ncols=3)
49
+ data = 5 * state.rand(10, 10)
50
+ axs[0].pcolor(data, vcenter=0, colorbar="b") # otherwise should be disabled
51
+ axs[1].pcolor(data, vcenter=1.5, colorbar="b")
52
+ axs[2].pcolor(data, vcenter=4, colorbar="b", symmetric=True)
53
+ return fig
54
+
55
+
56
+ @pytest.mark.mpl_image_compare
57
+ def test_autodiverging3():
58
+ # Test when cmap input disables auto diverging.
59
+ fig, axs = pplt.subplots(ncols=2, nrows=2, refwidth=2)
60
+ cmap = pplt.Colormap(
61
+ ("red7", "red3", "red1", "blue1", "blue3", "blue7"), listmode="discrete"
62
+ ) # noqa: E501
63
+ data1 = 10 * state.rand(10, 10)
64
+ data2 = data1 - 2
65
+ for i, cmap in enumerate(("RdBu_r", cmap)):
66
+ for j, data in enumerate((data1, data2)):
67
+ cmap = pplt.Colormap(pplt.Colormap(cmap))
68
+ axs[i, j].pcolormesh(data, cmap=cmap, colorbar="b")
69
+ return fig
70
+
71
+
72
+ @pytest.mark.mpl_image_compare
73
+ def test_autodiverging4():
74
+ fig, axs = pplt.subplots(ncols=3)
75
+ data = state.rand(5, 5) * 10 - 5
76
+ for i, ax in enumerate(axs[:2]):
77
+ ax.pcolor(data, sequential=bool(i), colorbar="b")
78
+ axs[2].pcolor(data, diverging=False, colorbar="b") # should have same effect
79
+ return fig
80
+
81
+
82
+ @pytest.mark.mpl_image_compare
83
+ def test_autodiverging5():
84
+ fig, axs = pplt.subplots(ncols=2)
85
+ data = state.rand(5, 5) * 10 + 2
86
+ for ax, norm in zip(axs, (None, "div")):
87
+ ax.pcolor(data, norm=norm, colorbar="b")
88
+ return fig
89
+
90
+
91
+ @pytest.mark.mpl_image_compare
92
+ def test_colormap_mode():
93
+ """
94
+ Test auto extending, auto discrete. Should issue warnings.
95
+ """
96
+ fig, axs = pplt.subplots(ncols=2, nrows=2, share=False)
97
+ axs[0].pcolor(state.rand(5, 5) % 0.3, extend="both", cyclic=True, colorbar="b")
98
+ axs[1].pcolor(state.rand(5, 5), sequential=True, diverging=True, colorbar="b")
99
+ axs[2].pcolor(state.rand(5, 5), discrete=False, qualitative=True, colorbar="b")
100
+ pplt.rc["cmap.discrete"] = False # should be ignored below
101
+ axs[3].contourf(state.rand(5, 5), colorbar="b")
102
+ return fig
103
+
104
+
105
+ @pytest.mark.mpl_image_compare
106
+ def test_contour_labels():
107
+ """
108
+ Test contour labels. We use a separate `contour` object when adding labels to
109
+ filled contours or else weird stuff happens (see below). We could just modify
110
+ filled contour edges when not adding labels but that would be inconsistent with
111
+ behavior when labels are active.
112
+ """
113
+ data = state.rand(5, 5) * 10 - 5
114
+ fig, axs = pplt.subplots(ncols=2)
115
+ ax = axs[0]
116
+ ax.contourf(
117
+ data,
118
+ edgecolor="k",
119
+ linewidth=1.5,
120
+ labels=True,
121
+ labels_kw={"color": "k", "size": "large"},
122
+ )
123
+ ax = axs[1]
124
+ m = ax.contourf(data)
125
+ ax.clabel(m, colors="black", fontsize="large") # looks fine without this
126
+ for o in m.collections:
127
+ o.set_linewidth(1.5)
128
+ o.set_edgecolor("k")
129
+ return fig
130
+
131
+
132
+ @pytest.mark.mpl_image_compare
133
+ def test_contour_negative():
134
+ """
135
+ Ensure `cmap.monochrome` properly assigned.
136
+ """
137
+ fig = pplt.figure(share=False)
138
+ ax = fig.subplot(131)
139
+ data = state.rand(10, 10) * 10 - 5
140
+ ax.contour(data, color="k")
141
+ ax = fig.subplot(132)
142
+ ax.tricontour(*(state.rand(3, 20) * 10 - 5), color="k")
143
+ ax = fig.subplot(133)
144
+ ax.contour(data, cmap=["black"]) # fails but that's ok
145
+ return fig
146
+
147
+
148
+ @pytest.mark.mpl_image_compare
149
+ def test_contour_single():
150
+ """
151
+ Test whether single contour works.
152
+ """
153
+ da = xr.DataArray(
154
+ np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]]), dims=["y", "x"]
155
+ )
156
+ fig, ax = pplt.subplots()
157
+ ax.contour(da, levels=[5.0], color="r")
158
+ return fig
159
+
160
+
161
+ @pytest.mark.mpl_image_compare
162
+ def test_edge_fix():
163
+ """
164
+ Test edge fix applied to 1D plotting utilities.
165
+ """
166
+ # Test basic application
167
+ # TODO: This should make no difference for PNG plots?
168
+ pplt.rc.edgefix = 1
169
+ fig, axs = pplt.subplots(ncols=2, share=False)
170
+ axs.format(grid=False)
171
+ axs[0].bar(
172
+ state.rand(
173
+ 10,
174
+ )
175
+ * 10
176
+ - 5,
177
+ width=1,
178
+ negpos=True,
179
+ )
180
+ axs[1].area(state.rand(5, 3), stack=True)
181
+
182
+ # Test whether ignored for transparent colorbars
183
+ data = state.rand(10, 10)
184
+ cmap = "magma"
185
+ fig, axs = pplt.subplots(nrows=3, ncols=2, refwidth=2.5, share=False)
186
+ for i, iaxs in enumerate((axs[:2], axs[2:4])):
187
+ if i == 0:
188
+ cmap = pplt.Colormap("magma", alpha=0.5)
189
+ alpha = None
190
+ iaxs.format(title="Colormap alpha")
191
+ else:
192
+ cmap = "magma"
193
+ alpha = 0.5
194
+ iaxs.format(title="Single alpha")
195
+ iaxs[0].contourf(data, cmap=cmap, colorbar="b", alpha=alpha)
196
+ iaxs[1].pcolormesh(data, cmap=cmap, colorbar="b", alpha=alpha)
197
+ axs[4].bar(data[:3, :3], alpha=0.5)
198
+ axs[5].area(data[:3, :3], alpha=0.5, stack=True)
199
+ return fig
200
+
201
+
202
+ @pytest.mark.mpl_image_compare
203
+ def test_flow_functions():
204
+ """
205
+ These are seldom used and missing from documentation. Be careful
206
+ not to break anything basic.
207
+ """
208
+ fig, ax = pplt.subplots()
209
+ for _ in range(2):
210
+ ax.streamplot(state.rand(10, 10), 5 * state.rand(10, 10), label="label")
211
+
212
+ fig, axs = pplt.subplots(ncols=2)
213
+ ax = axs[0]
214
+ ax.quiver(
215
+ state.rand(10, 10), 5 * state.rand(10, 10), c=state.rand(10, 10), label="label"
216
+ )
217
+ ax = axs[1]
218
+ ax.quiver(state.rand(10), state.rand(10), label="single")
219
+ return fig
220
+
221
+
222
+ @pytest.mark.mpl_image_compare
223
+ def test_gray_adjustment():
224
+ """
225
+ Test gray adjustments when creating segmented colormaps.
226
+ """
227
+ fig, ax = pplt.subplots()
228
+ data = state.rand(5, 5) * 10 - 5
229
+ cmap = pplt.Colormap(["blue", "grey3", "red"])
230
+ ax.pcolor(data, cmap=cmap, colorbar="b")
231
+ return fig
232
+
233
+
234
+ @pytest.mark.mpl_image_compare
235
+ def test_ignore_message():
236
+ """
237
+ Test various ignored argument warnings.
238
+ """
239
+ warning = pplt.internals.UltraplotWarning
240
+ fig, axs = pplt.subplots(ncols=2, nrows=2)
241
+ with pytest.warns(warning):
242
+ axs[0].contour(state.rand(5, 5) * 10, levels=pplt.arange(10), symmetric=True)
243
+ with pytest.warns(warning):
244
+ axs[1].contourf(
245
+ state.rand(10, 10), levels=np.linspace(0, 1, 10), locator=5, locator_kw={}
246
+ )
247
+ with pytest.warns(warning):
248
+ axs[2].contourf(
249
+ state.rand(10, 10),
250
+ levels=pplt.arange(0, 1, 0.2),
251
+ vmin=0,
252
+ vmax=2,
253
+ locator=3,
254
+ colorbar="b",
255
+ )
256
+ with pytest.warns(warning):
257
+ axs[3].hexbin(
258
+ state.rand(1000),
259
+ state.rand(1000),
260
+ levels=pplt.arange(0, 20),
261
+ gridsize=10,
262
+ locator=2,
263
+ colorbar="b",
264
+ cmap="blues",
265
+ )
266
+ return fig
267
+
268
+
269
+ @pytest.mark.mpl_image_compare
270
+ def test_levels_with_vmin_vmax():
271
+ """
272
+ Make sure `vmin` and `vmax` go into level generation algorithm.
273
+ """
274
+ # Sample data
275
+ state = np.random.RandomState(51423)
276
+ x = y = np.array([-10, -5, 0, 5, 10])
277
+ data = state.rand(y.size, x.size)
278
+
279
+ # Figure
280
+ fig = pplt.figure(refwidth=2.3, share=False)
281
+ axs = fig.subplots()
282
+ m = axs.pcolormesh(x, y, data, vmax=1.35123)
283
+ axs.colorbar([m], loc="r")
284
+ return fig
285
+
286
+
287
+ @pytest.mark.mpl_image_compare
288
+ def test_level_restriction():
289
+ """
290
+ Test `negative`, `positive`, and `symmetric` with and without discrete.
291
+ """
292
+ fig, axs = pplt.subplots(ncols=3, nrows=2)
293
+ data = 20 * state.rand(10, 10) - 5
294
+ keys = ("negative", "positive", "symmetric")
295
+ for i, grp in enumerate((axs[:3], axs[3:])):
296
+ for j, ax in enumerate(grp):
297
+ kw = {keys[j]: True, "discrete": bool(1 - i)}
298
+ ax.pcolor(data, **kw, colorbar="b")
299
+ return fig
300
+
301
+
302
+ @pytest.mark.mpl_image_compare
303
+ def test_qualitative_colormaps_1():
304
+ """
305
+ Test both `colors` and `cmap` input and ensure extend setting is used for
306
+ extreme only if unset.
307
+ """
308
+ fig, axs = pplt.subplots(ncols=2)
309
+ data = state.rand(5, 5)
310
+ colors = pplt.get_colors("set3")
311
+ for ax, extend in zip(axs, ("both", "neither")):
312
+ ax.pcolor(data, extend=extend, colors=colors, colorbar="b")
313
+ return fig
314
+
315
+
316
+ @pytest.mark.mpl_image_compare
317
+ def test_qualitative_colormaps_2():
318
+ fig, axs = pplt.subplots(ncols=2)
319
+ data = state.rand(5, 5)
320
+ cmap = pplt.Colormap("set3")
321
+ cmap.set_under("black") # does not overwrite
322
+ for ax, extend in zip(axs, ("both", "neither")):
323
+ ax.pcolor(data, extend=extend, cmap=cmap, colorbar="b")
324
+ return fig
325
+
326
+
327
+ @pytest.mark.mpl_image_compare
328
+ def test_segmented_norm():
329
+ """
330
+ Test segmented norm with non-discrete levels.
331
+ """
332
+ fig, ax = pplt.subplots()
333
+ ax.pcolor(
334
+ state.rand(5, 5) * 10,
335
+ discrete=False,
336
+ norm="segmented",
337
+ norm_kw={"levels": [0, 2, 10]},
338
+ colorbar="b",
339
+ )
340
+ return fig
341
+
342
+
343
+ @pytest.mark.mpl_image_compare
344
+ def test_triangular_functions():
345
+ """
346
+ Test triangular functions. Here there is no remotely sensible way to infer
347
+ """
348
+ fig, ax = pplt.subplots()
349
+ N = 30
350
+ y = state.rand(N) * 20
351
+ x = state.rand(N) * 50
352
+ da = xr.DataArray(state.rand(N), dims=("x",), coords={"x": x, "y": ("x", y)})
353
+ ax.tricontour(da.x, da.y, da, labels=True)
354
+ return fig
@@ -0,0 +1,179 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Test twin, inset, and panel axes.
4
+ """
5
+ import numpy as np
6
+ import pytest
7
+ import ultraplot as pplt
8
+
9
+ state = np.random.RandomState(51423)
10
+
11
+
12
+ def test_axis_access():
13
+ # attempt to access the ax object 2d and linearly
14
+ fix, ax = pplt.subplots(ncols=2, nrows=2)
15
+ ax[0, 0]
16
+ ax[1, 0]
17
+ with pytest.raises(IndexError):
18
+ ax[0, 3]
19
+ ax[3]
20
+
21
+
22
+ @pytest.mark.mpl_image_compare
23
+ def test_inset_colors_1():
24
+ """
25
+ Test color application for zoom boxes.
26
+ """
27
+ fig, ax = pplt.subplots()
28
+ ax.format(xlim=(0, 100), ylim=(0, 100))
29
+ ix = ax.inset_axes(
30
+ (0.5, 0.5, 0.3, 0.3), zoom=True, zoom_kw={"color": "r", "fc": "r", "ec": "b"}
31
+ ) # zoom_kw={'alpha': 1})
32
+ # ix = ax.inset_axes((40, 40, 20, 20), zoom=True, transform='data')
33
+ ix.format(xlim=(10, 20), ylim=(10, 20), grid=False)
34
+ return fig
35
+
36
+
37
+ @pytest.mark.mpl_image_compare
38
+ def test_inset_colors_2():
39
+ fig, ax = pplt.subplots()
40
+ ax.format(xlim=(0, 100), ylim=(0, 100))
41
+ ix = ax.inset_axes(
42
+ (0.3, 0.5, 0.5, 0.3),
43
+ zoom=True,
44
+ zoom_kw={"lw": 3, "ec": "red9", "a": 1, "c": pplt.set_alpha("red4", 0.5)},
45
+ )
46
+ ix.format(xlim=(10, 20), ylim=(10, 20))
47
+ return fig
48
+
49
+
50
+ @pytest.mark.mpl_image_compare
51
+ def test_inset_zoom_update():
52
+ """
53
+ Test automatic limit adjusment with successive changes. Without the extra
54
+ lines in `draw()` and `get_tight_bbox()` this fails.
55
+ """
56
+ fig, ax = pplt.subplots()
57
+ ax.format(xlim=(0, 100), ylim=(0, 100))
58
+ ix = ax.inset_axes((40, 40, 20, 20), zoom=True, transform="data")
59
+ ix.format(xlim=(10, 20), ylim=(10, 20), grid=False)
60
+ ix.format(xlim=(10, 20), ylim=(10, 30))
61
+ ax.format(ylim=(0, 300))
62
+ return fig
63
+
64
+
65
+ @pytest.mark.mpl_image_compare
66
+ def test_panels_with_sharing():
67
+ """
68
+ Previously the below text would hide the second y label.
69
+ """
70
+ fig, axs = pplt.subplots(ncols=2, share=False, refwidth=1.5)
71
+ axs.panel("left")
72
+ fig.format(ylabel="ylabel", xlabel="xlabel")
73
+ return fig
74
+
75
+
76
+ @pytest.mark.mpl_image_compare
77
+ def test_panels_without_sharing_1():
78
+ """
79
+ What should happen if `share=False` but figure-wide sharing enabled?
80
+ Strange use case but behavior appears "correct."
81
+ """
82
+ fig, axs = pplt.subplots(ncols=2, share=True, refwidth=1.5, includepanels=False)
83
+ axs.panel("left", share=False)
84
+ fig.format(ylabel="ylabel", xlabel="xlabel")
85
+ return fig
86
+
87
+
88
+ @pytest.mark.mpl_image_compare
89
+ def test_panels_without_sharing_2():
90
+ fig, axs = pplt.subplots(ncols=2, refwidth=1.5, includepanels=True)
91
+ for _ in range(3):
92
+ p = axs[0].panel("l", space=0)
93
+ p.format(xlabel="label")
94
+ fig.format(xlabel="xlabel")
95
+ return fig
96
+
97
+
98
+ @pytest.mark.mpl_image_compare
99
+ def test_panels_suplabels_three_hor_panels():
100
+ """
101
+ Test label sharing for `includepanels=True`.
102
+ Test for 1 subplot with 3 left panels
103
+ Include here centers the x label to include the panels
104
+ The xlabel should be centered along the main plot with the included side panels
105
+ """
106
+ fig = pplt.figure()
107
+ ax = fig.subplots(refwidth=1.5, includepanels=True)
108
+ for _ in range(3):
109
+ ax[0].panel("l")
110
+ ax.format(xlabel="xlabel", ylabel="ylabel\nylabel\nylabel", suptitle="sup")
111
+ return fig
112
+
113
+
114
+ def test_panels_suplabels_three_hor_panels_donotinlcude():
115
+ """
116
+ Test label sharing for `includepanels=True`.
117
+ Test for 1 subplot with 3 left panels
118
+ The xlabel should be centered on the main plot
119
+ """
120
+ fig = pplt.figure()
121
+ ax = fig.subplots(refwidth=1.5, includepanels=False)
122
+ for _ in range(3):
123
+ ax[0].panel("l")
124
+ ax.format(
125
+ xlabel="xlabel",
126
+ ylabel="ylabel\nylabel\nylabel",
127
+ suptitle="sup",
128
+ )
129
+ return fig
130
+
131
+
132
+ @pytest.mark.mpl_image_compare
133
+ def test_twin_axes_1():
134
+ """
135
+ Adjust twin axis positions. Should allow easily switching the location.
136
+ """
137
+ # Test basic twin creation and tick, spine, label location changes
138
+ fig = pplt.figure()
139
+ ax = fig.subplot()
140
+ ax.format(
141
+ ycolor="blue",
142
+ ylabel="orig",
143
+ ylabelcolor="blue9",
144
+ yspineloc="l",
145
+ labelweight="bold",
146
+ xlabel="xlabel",
147
+ xtickloc="t",
148
+ xlabelloc="b",
149
+ )
150
+ ax.alty(loc="r", color="r", labelcolor="red9", label="other", labelweight="bold")
151
+ return fig
152
+
153
+
154
+ @pytest.mark.mpl_image_compare
155
+ def test_twin_axes_2():
156
+ # Simple example but doesn't quite work. Figure out how to specify left vs. right
157
+ # spines for 'offset' locations... maybe needs another keyword.
158
+ fig, ax = pplt.subplots()
159
+ ax.format(ymax=10, ylabel="Reference")
160
+ ax.alty(color="green", label="Green", max=8)
161
+ ax.alty(color="red", label="Red", max=15, loc=("axes", -0.2))
162
+ ax.alty(color="blue", label="Blue", max=5, loc=("axes", 1.2), ticklabeldir="out")
163
+ return fig
164
+
165
+
166
+ @pytest.mark.mpl_image_compare
167
+ def test_twin_axes_3():
168
+ # A worked example from Riley Brady
169
+ # Uses auto-adjusting limits
170
+ fig, ax = pplt.subplots()
171
+ axs = [ax, ax.twinx(), ax.twinx()]
172
+ axs[-1].spines["right"].set_position(("axes", 1.2))
173
+ colors = ("Green", "Red", "Blue")
174
+ for ax, color in zip(axs, colors):
175
+ data = state.random(1) * state.random(10)
176
+ ax.plot(data, marker="o", linestyle="none", color=color)
177
+ ax.format(ylabel="%s Thing" % color, ycolor=color)
178
+ axs[0].format(xlabel="xlabel")
179
+ return fig