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.
- ultraplot/__init__.py +115 -0
- ultraplot/__init__.py.rej +58 -0
- ultraplot/axes/__init__.py +42 -0
- ultraplot/axes/base.py +3240 -0
- ultraplot/axes/cartesian.py +1425 -0
- ultraplot/axes/geo.py +1675 -0
- ultraplot/axes/plot.py +4569 -0
- ultraplot/axes/polar.py +381 -0
- ultraplot/axes/shared.py +186 -0
- ultraplot/axes/three.py +34 -0
- ultraplot/cmaps/Algae.rgb +256 -0
- ultraplot/cmaps/Amp.rgb +256 -0
- ultraplot/cmaps/BR.rgb +256 -0
- ultraplot/cmaps/Balance.rgb +256 -0
- ultraplot/cmaps/Blues1_r.xml +17 -0
- ultraplot/cmaps/Blues2.xml +16 -0
- ultraplot/cmaps/Blues3.xml +25 -0
- ultraplot/cmaps/Blues4_r.xml +17 -0
- ultraplot/cmaps/Blues5.xml +16 -0
- ultraplot/cmaps/Blues6.xml +25 -0
- ultraplot/cmaps/Blues7.xml +16 -0
- ultraplot/cmaps/Blues8.xml +17 -0
- ultraplot/cmaps/Blues9.xml +1 -0
- ultraplot/cmaps/Boreal.json +53 -0
- ultraplot/cmaps/Browns1.xml +16 -0
- ultraplot/cmaps/Browns2.xml +26 -0
- ultraplot/cmaps/Browns3.xml +17 -0
- ultraplot/cmaps/Browns4.xml +17 -0
- ultraplot/cmaps/Browns5.xml +26 -0
- ultraplot/cmaps/Browns6.xml +17 -0
- ultraplot/cmaps/Browns7.xml +19 -0
- ultraplot/cmaps/Browns8.xml +11 -0
- ultraplot/cmaps/Browns9.xml +1 -0
- ultraplot/cmaps/ColdHot.rgb +229 -0
- ultraplot/cmaps/Crest.rgb +256 -0
- ultraplot/cmaps/Curl.rgb +512 -0
- ultraplot/cmaps/Deep.rgb +256 -0
- ultraplot/cmaps/Delta.rgb +512 -0
- ultraplot/cmaps/Dense.rgb +256 -0
- ultraplot/cmaps/Div.json +71 -0
- ultraplot/cmaps/DryWet.json +73 -0
- ultraplot/cmaps/Dusk.json +53 -0
- ultraplot/cmaps/Fire.json +53 -0
- ultraplot/cmaps/Flare.rgb +256 -0
- ultraplot/cmaps/Glacial.json +53 -0
- ultraplot/cmaps/Greens1_r.xml +26 -0
- ultraplot/cmaps/Greens2.xml +28 -0
- ultraplot/cmaps/Greens3_r.xml +28 -0
- ultraplot/cmaps/Greens4.xml +17 -0
- ultraplot/cmaps/Greens5.xml +16 -0
- ultraplot/cmaps/Greens6_r.xml +16 -0
- ultraplot/cmaps/Greens7.xml +16 -0
- ultraplot/cmaps/Greens8.xml +26 -0
- ultraplot/cmaps/Haline.rgb +256 -0
- ultraplot/cmaps/Ice.rgb +256 -0
- ultraplot/cmaps/IceFire.rgb +256 -0
- ultraplot/cmaps/Mako.rgb +256 -0
- ultraplot/cmaps/Marine.json +53 -0
- ultraplot/cmaps/Matter.rgb +256 -0
- ultraplot/cmaps/Mono.txt +256 -0
- ultraplot/cmaps/MonoCycle.txt +256 -0
- ultraplot/cmaps/NegPos.json +71 -0
- ultraplot/cmaps/Oranges1.xml +27 -0
- ultraplot/cmaps/Oranges2.xml +26 -0
- ultraplot/cmaps/Oranges3.xml +15 -0
- ultraplot/cmaps/Oranges4.xml +23 -0
- ultraplot/cmaps/Oxy.rgb +256 -0
- ultraplot/cmaps/Phase.rgb +256 -0
- ultraplot/cmaps/Purples1_r.xml +16 -0
- ultraplot/cmaps/Purples2.xml +17 -0
- ultraplot/cmaps/Purples3.xml +18 -0
- ultraplot/cmaps/Reds1.xml +26 -0
- ultraplot/cmaps/Reds2.xml +22 -0
- ultraplot/cmaps/Reds3.xml +23 -0
- ultraplot/cmaps/Reds4.xml +26 -0
- ultraplot/cmaps/Reds5.xml +17 -0
- ultraplot/cmaps/Rocket.rgb +256 -0
- ultraplot/cmaps/Solar.rgb +256 -0
- ultraplot/cmaps/Speed.rgb +256 -0
- ultraplot/cmaps/Stellar.json +53 -0
- ultraplot/cmaps/Sunrise.json +53 -0
- ultraplot/cmaps/Sunset.json +53 -0
- ultraplot/cmaps/Tempo.rgb +256 -0
- ultraplot/cmaps/Thermal.rgb +256 -0
- ultraplot/cmaps/Turbid.rgb +256 -0
- ultraplot/cmaps/Vivid.xml +11 -0
- ultraplot/cmaps/Vlag.rgb +256 -0
- ultraplot/cmaps/Yellows1.xml +17 -0
- ultraplot/cmaps/Yellows2.xml +17 -0
- ultraplot/cmaps/Yellows3.xml +17 -0
- ultraplot/cmaps/Yellows4.xml +17 -0
- ultraplot/cmaps/acton.txt +256 -0
- ultraplot/cmaps/bam.txt +256 -0
- ultraplot/cmaps/bamO.txt +256 -0
- ultraplot/cmaps/bamako.txt +256 -0
- ultraplot/cmaps/batlow.txt +256 -0
- ultraplot/cmaps/batlowK.txt +256 -0
- ultraplot/cmaps/batlowW.txt +256 -0
- ultraplot/cmaps/berlin.txt +256 -0
- ultraplot/cmaps/bilbao.txt +256 -0
- ultraplot/cmaps/broc.txt +256 -0
- ultraplot/cmaps/brocO.txt +256 -0
- ultraplot/cmaps/buda.txt +256 -0
- ultraplot/cmaps/bukavu.txt +256 -0
- ultraplot/cmaps/cork.txt +256 -0
- ultraplot/cmaps/corkO.txt +256 -0
- ultraplot/cmaps/davos.txt +256 -0
- ultraplot/cmaps/devon.txt +256 -0
- ultraplot/cmaps/fes.txt +256 -0
- ultraplot/cmaps/hawaii.txt +256 -0
- ultraplot/cmaps/imola.txt +256 -0
- ultraplot/cmaps/lajolla.txt +256 -0
- ultraplot/cmaps/lapaz.txt +256 -0
- ultraplot/cmaps/lisbon.txt +256 -0
- ultraplot/cmaps/nuuk.txt +256 -0
- ultraplot/cmaps/oleron.txt +256 -0
- ultraplot/cmaps/oslo.txt +256 -0
- ultraplot/cmaps/roma.txt +256 -0
- ultraplot/cmaps/romaO.txt +256 -0
- ultraplot/cmaps/tofino.txt +256 -0
- ultraplot/cmaps/tokyo.txt +256 -0
- ultraplot/cmaps/turku.txt +256 -0
- ultraplot/cmaps/vanimo.txt +256 -0
- ultraplot/cmaps/vik.txt +256 -0
- ultraplot/cmaps/vikO.txt +256 -0
- ultraplot/colors/opencolor.txt +132 -0
- ultraplot/colors/xkcd.txt +951 -0
- ultraplot/colors.py +3241 -0
- ultraplot/colors.py.rej +243 -0
- ultraplot/config.py +1809 -0
- ultraplot/constructor.py +1633 -0
- ultraplot/cycles/538.hex +2 -0
- ultraplot/cycles/FlatUI.hex +1 -0
- ultraplot/cycles/Qual1.rgb +7 -0
- ultraplot/cycles/Qual2.rgb +13 -0
- ultraplot/cycles/bmh.hex +2 -0
- ultraplot/cycles/classic.hex +2 -0
- ultraplot/cycles/colorblind.hex +2 -0
- ultraplot/cycles/colorblind10.hex +2 -0
- ultraplot/cycles/default.hex +2 -0
- ultraplot/cycles/ggplot.hex +1 -0
- ultraplot/cycles/seaborn.hex +2 -0
- ultraplot/cycles/tableau.hex +2 -0
- ultraplot/demos.py +1201 -0
- ultraplot/externals/__init__.py +5 -0
- ultraplot/externals/hsluv.py +330 -0
- ultraplot/figure.py +2102 -0
- ultraplot/fonts/FiraMath-Bold.ttf +0 -0
- ultraplot/fonts/FiraMath-ExtraLight.ttf +0 -0
- ultraplot/fonts/FiraMath-Heavy.ttf +0 -0
- ultraplot/fonts/FiraMath-Light.ttf +0 -0
- ultraplot/fonts/FiraMath-Medium.ttf +0 -0
- ultraplot/fonts/FiraMath-Regular.ttf +0 -0
- ultraplot/fonts/FiraMath-SemiBold.ttf +0 -0
- ultraplot/fonts/FiraMath-UltraLight.ttf +0 -0
- ultraplot/fonts/FiraSans-Black.ttf +0 -0
- ultraplot/fonts/FiraSans-BlackItalic.ttf +0 -0
- ultraplot/fonts/FiraSans-Bold.ttf +0 -0
- ultraplot/fonts/FiraSans-BoldItalic.ttf +0 -0
- ultraplot/fonts/FiraSans-ExtraBold.ttf +0 -0
- ultraplot/fonts/FiraSans-ExtraBoldItalic.ttf +0 -0
- ultraplot/fonts/FiraSans-ExtraLight.ttf +0 -0
- ultraplot/fonts/FiraSans-ExtraLightItalic.ttf +0 -0
- ultraplot/fonts/FiraSans-Italic.ttf +0 -0
- ultraplot/fonts/FiraSans-Light.ttf +0 -0
- ultraplot/fonts/FiraSans-LightItalic.ttf +0 -0
- ultraplot/fonts/FiraSans-Medium.ttf +0 -0
- ultraplot/fonts/FiraSans-MediumItalic.ttf +0 -0
- ultraplot/fonts/FiraSans-Regular.ttf +0 -0
- ultraplot/fonts/FiraSans-SemiBold.ttf +0 -0
- ultraplot/fonts/FiraSans-SemiBoldItalic.ttf +0 -0
- ultraplot/fonts/LICENSE_FIRAMATH.txt +92 -0
- ultraplot/fonts/LICENSE_FIRASANS.txt +97 -0
- ultraplot/fonts/LICENSE_NOTOSANS.txt +202 -0
- ultraplot/fonts/LICENSE_NOTOSERIF.txt +93 -0
- ultraplot/fonts/LICENSE_OPENSANS.txt +202 -0
- ultraplot/fonts/LICENSE_ROBOTO.txt +202 -0
- ultraplot/fonts/LICENSE_SOURCESANS.txt +93 -0
- ultraplot/fonts/LICENSE_SOURCESERIF.txt +93 -0
- ultraplot/fonts/LICENSE_TEXGYRE.txt +29 -0
- ultraplot/fonts/LICENSE_UBUNTU.txt +96 -0
- ultraplot/fonts/NotoSans-Bold.ttf +0 -0
- ultraplot/fonts/NotoSans-BoldItalic.ttf +0 -0
- ultraplot/fonts/NotoSans-Italic.ttf +0 -0
- ultraplot/fonts/NotoSans-Regular.ttf +0 -0
- ultraplot/fonts/NotoSerif-Bold.ttf +0 -0
- ultraplot/fonts/NotoSerif-BoldItalic.ttf +0 -0
- ultraplot/fonts/NotoSerif-Italic.ttf +0 -0
- ultraplot/fonts/NotoSerif-Regular.ttf +0 -0
- ultraplot/fonts/OpenSans-Bold.ttf +0 -0
- ultraplot/fonts/OpenSans-BoldItalic.ttf +0 -0
- ultraplot/fonts/OpenSans-Italic.ttf +0 -0
- ultraplot/fonts/OpenSans-Regular.ttf +0 -0
- ultraplot/fonts/OpenSans-Semibold.ttf +0 -0
- ultraplot/fonts/OpenSans-SemiboldItalic.ttf +0 -0
- ultraplot/fonts/Roboto-Black.ttf +0 -0
- ultraplot/fonts/Roboto-BlackItalic.ttf +0 -0
- ultraplot/fonts/Roboto-Bold.ttf +0 -0
- ultraplot/fonts/Roboto-BoldItalic.ttf +0 -0
- ultraplot/fonts/Roboto-Italic.ttf +0 -0
- ultraplot/fonts/Roboto-Light.ttf +0 -0
- ultraplot/fonts/Roboto-LightItalic.ttf +0 -0
- ultraplot/fonts/Roboto-Medium.ttf +0 -0
- ultraplot/fonts/Roboto-MediumItalic.ttf +0 -0
- ultraplot/fonts/Roboto-Regular.ttf +0 -0
- ultraplot/fonts/SourceSansPro-Black.ttf +0 -0
- ultraplot/fonts/SourceSansPro-BlackItalic.ttf +0 -0
- ultraplot/fonts/SourceSansPro-Bold.ttf +0 -0
- ultraplot/fonts/SourceSansPro-BoldItalic.ttf +0 -0
- ultraplot/fonts/SourceSansPro-ExtraLight.ttf +0 -0
- ultraplot/fonts/SourceSansPro-ExtraLightItalic.ttf +0 -0
- ultraplot/fonts/SourceSansPro-Italic.ttf +0 -0
- ultraplot/fonts/SourceSansPro-Light.ttf +0 -0
- ultraplot/fonts/SourceSansPro-LightItalic.ttf +0 -0
- ultraplot/fonts/SourceSansPro-Regular.ttf +0 -0
- ultraplot/fonts/SourceSansPro-SemiBold.ttf +0 -0
- ultraplot/fonts/SourceSansPro-SemiBoldItalic.ttf +0 -0
- ultraplot/fonts/SourceSerifPro-Black.ttf +0 -0
- ultraplot/fonts/SourceSerifPro-BlackItalic.ttf +0 -0
- ultraplot/fonts/SourceSerifPro-Bold.ttf +0 -0
- ultraplot/fonts/SourceSerifPro-BoldItalic.ttf +0 -0
- ultraplot/fonts/SourceSerifPro-ExtraLight.ttf +0 -0
- ultraplot/fonts/SourceSerifPro-ExtraLightItalic.ttf +0 -0
- ultraplot/fonts/SourceSerifPro-Italic.ttf +0 -0
- ultraplot/fonts/SourceSerifPro-Light.ttf +0 -0
- ultraplot/fonts/SourceSerifPro-LightItalic.ttf +0 -0
- ultraplot/fonts/SourceSerifPro-Regular.ttf +0 -0
- ultraplot/fonts/SourceSerifPro-SemiBold.ttf +0 -0
- ultraplot/fonts/SourceSerifPro-SemiBoldItalic.ttf +0 -0
- ultraplot/fonts/Ubuntu-Bold.ttf +0 -0
- ultraplot/fonts/Ubuntu-BoldItalic.ttf +0 -0
- ultraplot/fonts/Ubuntu-Italic.ttf +0 -0
- ultraplot/fonts/Ubuntu-Light.ttf +0 -0
- ultraplot/fonts/Ubuntu-LightItalic.ttf +0 -0
- ultraplot/fonts/Ubuntu-Medium.ttf +0 -0
- ultraplot/fonts/Ubuntu-MediumItalic.ttf +0 -0
- ultraplot/fonts/Ubuntu-Regular.ttf +0 -0
- ultraplot/fonts/texgyreadventor-bold.ttf +0 -0
- ultraplot/fonts/texgyreadventor-bolditalic.ttf +0 -0
- ultraplot/fonts/texgyreadventor-italic.ttf +0 -0
- ultraplot/fonts/texgyreadventor-regular.ttf +0 -0
- ultraplot/fonts/texgyrebonum-bold.ttf +0 -0
- ultraplot/fonts/texgyrebonum-bolditalic.ttf +0 -0
- ultraplot/fonts/texgyrebonum-italic.ttf +0 -0
- ultraplot/fonts/texgyrebonum-regular.ttf +0 -0
- ultraplot/fonts/texgyrechorus-mediumitalic.ttf +0 -0
- ultraplot/fonts/texgyrecursor-bold.ttf +0 -0
- ultraplot/fonts/texgyrecursor-bolditalic.ttf +0 -0
- ultraplot/fonts/texgyrecursor-italic.ttf +0 -0
- ultraplot/fonts/texgyrecursor-regular.ttf +0 -0
- ultraplot/fonts/texgyreheros-bold.ttf +0 -0
- ultraplot/fonts/texgyreheros-bolditalic.ttf +0 -0
- ultraplot/fonts/texgyreheros-italic.ttf +0 -0
- ultraplot/fonts/texgyreheros-regular.ttf +0 -0
- ultraplot/fonts/texgyrepagella-bold.ttf +0 -0
- ultraplot/fonts/texgyrepagella-bolditalic.ttf +0 -0
- ultraplot/fonts/texgyrepagella-italic.ttf +0 -0
- ultraplot/fonts/texgyrepagella-regular.ttf +0 -0
- ultraplot/fonts/texgyreschola-bold.ttf +0 -0
- ultraplot/fonts/texgyreschola-bolditalic.ttf +0 -0
- ultraplot/fonts/texgyreschola-italic.ttf +0 -0
- ultraplot/fonts/texgyreschola-regular.ttf +0 -0
- ultraplot/fonts/texgyretermes-bold.ttf +0 -0
- ultraplot/fonts/texgyretermes-bolditalic.ttf +0 -0
- ultraplot/fonts/texgyretermes-italic.ttf +0 -0
- ultraplot/fonts/texgyretermes-regular.ttf +0 -0
- ultraplot/gridspec.py +1698 -0
- ultraplot/internals/__init__.py +529 -0
- ultraplot/internals/benchmarks.py +26 -0
- ultraplot/internals/context.py +44 -0
- ultraplot/internals/docstring.py +139 -0
- ultraplot/internals/fonts.py +75 -0
- ultraplot/internals/guides.py +167 -0
- ultraplot/internals/inputs.py +862 -0
- ultraplot/internals/labels.py +85 -0
- ultraplot/internals/rcsetup.py +1933 -0
- ultraplot/internals/versions.py +61 -0
- ultraplot/internals/warnings.py +122 -0
- ultraplot/proj.py +325 -0
- ultraplot/scale.py +966 -0
- ultraplot/tests/__init__.py +28 -0
- ultraplot/tests/baseline/test_align_labels.png +0 -0
- ultraplot/tests/baseline/test_aligned_outer_guides.png +0 -0
- ultraplot/tests/baseline/test_aspect_ratios.png +0 -0
- ultraplot/tests/baseline/test_auto_diverging1.png +0 -0
- ultraplot/tests/baseline/test_auto_legend.png +0 -0
- ultraplot/tests/baseline/test_auto_reverse.png +0 -0
- ultraplot/tests/baseline/test_autodiverging3.png +0 -0
- ultraplot/tests/baseline/test_autodiverging4.png +0 -0
- ultraplot/tests/baseline/test_autodiverging5.png +0 -0
- ultraplot/tests/baseline/test_axes_colors.png +0 -0
- ultraplot/tests/baseline/test_bar_vectors.png +0 -0
- ultraplot/tests/baseline/test_bar_width.png +0 -0
- ultraplot/tests/baseline/test_both_ticklabels.png +0 -0
- ultraplot/tests/baseline/test_bounds_ticks.png +0 -0
- ultraplot/tests/baseline/test_boxplot_colors.png +0 -0
- ultraplot/tests/baseline/test_boxplot_vectors.png +0 -0
- ultraplot/tests/baseline/test_cartopy_contours.png +0 -0
- ultraplot/tests/baseline/test_cartopy_labels.png +0 -0
- ultraplot/tests/baseline/test_cartopy_manual.png +0 -0
- ultraplot/tests/baseline/test_centered_legends.png +0 -0
- ultraplot/tests/baseline/test_cmap_cycles.png +0 -0
- ultraplot/tests/baseline/test_colorbar.png +0 -0
- ultraplot/tests/baseline/test_colorbar_ticks.png +0 -0
- ultraplot/tests/baseline/test_colormap_mode.png +0 -0
- ultraplot/tests/baseline/test_column_iteration.png +0 -0
- ultraplot/tests/baseline/test_complex_ticks.png +0 -0
- ultraplot/tests/baseline/test_contour_labels.png +0 -0
- ultraplot/tests/baseline/test_contour_legend_with_label.png +0 -0
- ultraplot/tests/baseline/test_contour_legend_without_label.png +0 -0
- ultraplot/tests/baseline/test_contour_negative.png +0 -0
- ultraplot/tests/baseline/test_contour_single.png +0 -0
- ultraplot/tests/baseline/test_cutoff_ticks.png +0 -0
- ultraplot/tests/baseline/test_data_keyword.png +0 -0
- ultraplot/tests/baseline/test_discrete_ticks.png +0 -0
- ultraplot/tests/baseline/test_discrete_vs_fixed.png +0 -0
- ultraplot/tests/baseline/test_drawing_in_projection_with_globe.png +0 -0
- ultraplot/tests/baseline/test_drawing_in_projection_without_globe.png +0 -0
- ultraplot/tests/baseline/test_edge_fix.png +0 -0
- ultraplot/tests/baseline/test_flow_functions.png +0 -0
- ultraplot/tests/baseline/test_font_adjustments.png +0 -0
- ultraplot/tests/baseline/test_geographic_multiple_projections.png +0 -0
- ultraplot/tests/baseline/test_geographic_single_projection.png +0 -0
- ultraplot/tests/baseline/test_gray_adjustment.png +0 -0
- ultraplot/tests/baseline/test_histogram_legend.png +0 -0
- ultraplot/tests/baseline/test_histogram_types.png +0 -0
- ultraplot/tests/baseline/test_ignore_message.png +0 -0
- ultraplot/tests/baseline/test_inbounds_data.png +0 -0
- ultraplot/tests/baseline/test_init_format.png +0 -0
- ultraplot/tests/baseline/test_inner_title_zorder.png +0 -0
- ultraplot/tests/baseline/test_inset_basic.png +0 -0
- ultraplot/tests/baseline/test_inset_colorbars.png +0 -0
- ultraplot/tests/baseline/test_inset_colors_1.png +0 -0
- ultraplot/tests/baseline/test_inset_colors_2.png +0 -0
- ultraplot/tests/baseline/test_inset_zoom_update.png +0 -0
- ultraplot/tests/baseline/test_invalid_dist.png +0 -0
- ultraplot/tests/baseline/test_invalid_plot.png +0 -0
- ultraplot/tests/baseline/test_keep_guide_labels.png +0 -0
- ultraplot/tests/baseline/test_label_settings.png +0 -0
- ultraplot/tests/baseline/test_level_restriction.png +0 -0
- ultraplot/tests/baseline/test_levels_with_vmin_vmax.png +0 -0
- ultraplot/tests/baseline/test_locale_formatting.png +0 -0
- ultraplot/tests/baseline/test_locale_formatting_en_US.UTF-8.png +0 -0
- ultraplot/tests/baseline/test_manual_labels.png +0 -0
- ultraplot/tests/baseline/test_multi_formatting.png +0 -0
- ultraplot/tests/baseline/test_multiple_calls.png +0 -0
- ultraplot/tests/baseline/test_on_the_fly_mappable.png +0 -0
- ultraplot/tests/baseline/test_outer_align.png +0 -0
- ultraplot/tests/baseline/test_panel_dist.png +0 -0
- ultraplot/tests/baseline/test_panels_suplabels_three_hor_panels.png +0 -0
- ultraplot/tests/baseline/test_panels_with_sharing.png +0 -0
- ultraplot/tests/baseline/test_panels_without_sharing_1.png +0 -0
- ultraplot/tests/baseline/test_panels_without_sharing_2.png +0 -0
- ultraplot/tests/baseline/test_parametric_colors.png +0 -0
- ultraplot/tests/baseline/test_parametric_labels.png +0 -0
- ultraplot/tests/baseline/test_patch_format.png +0 -0
- ultraplot/tests/baseline/test_pie_charts.png +0 -0
- ultraplot/tests/baseline/test_pint_quantities.png +0 -0
- ultraplot/tests/baseline/test_polar_projections.png +0 -0
- ultraplot/tests/baseline/test_projection_dicts.png +0 -0
- ultraplot/tests/baseline/test_qualitative_colormaps_1.png +0 -0
- ultraplot/tests/baseline/test_qualitative_colormaps_2.png +0 -0
- ultraplot/tests/baseline/test_reversed_levels.png +0 -0
- ultraplot/tests/baseline/test_scatter_alpha.png +0 -0
- ultraplot/tests/baseline/test_scatter_args.png +0 -0
- ultraplot/tests/baseline/test_scatter_cycle.png +0 -0
- ultraplot/tests/baseline/test_scatter_inbounds.png +0 -0
- ultraplot/tests/baseline/test_scatter_sizes.png +0 -0
- ultraplot/tests/baseline/test_seaborn_heatmap.png +0 -0
- ultraplot/tests/baseline/test_seaborn_hist.png +0 -0
- ultraplot/tests/baseline/test_seaborn_relational.png +0 -0
- ultraplot/tests/baseline/test_seaborn_swarmplot.png +0 -0
- ultraplot/tests/baseline/test_segmented_norm.png +0 -0
- ultraplot/tests/baseline/test_segmented_norm_ticks.png +0 -0
- ultraplot/tests/baseline/test_share_all_basic.png +0 -0
- ultraplot/tests/baseline/test_singleton_legend.png +0 -0
- ultraplot/tests/baseline/test_span_labels.png +0 -0
- ultraplot/tests/baseline/test_spine_offset.png +0 -0
- ultraplot/tests/baseline/test_spine_side.png +0 -0
- ultraplot/tests/baseline/test_standardized_input.png +0 -0
- ultraplot/tests/baseline/test_statistical_boxplot.png +0 -0
- ultraplot/tests/baseline/test_three_axes.png +0 -0
- ultraplot/tests/baseline/test_tick_direction.png +0 -0
- ultraplot/tests/baseline/test_tick_labels.png +0 -0
- ultraplot/tests/baseline/test_tick_length.png +0 -0
- ultraplot/tests/baseline/test_tick_width.png +0 -0
- ultraplot/tests/baseline/test_title_deflection.png +0 -0
- ultraplot/tests/baseline/test_triangular_functions.png +0 -0
- ultraplot/tests/baseline/test_tuple_handles.png +0 -0
- ultraplot/tests/baseline/test_twin_axes_1.png +0 -0
- ultraplot/tests/baseline/test_twin_axes_2.png +0 -0
- ultraplot/tests/baseline/test_twin_axes_3.png +0 -0
- ultraplot/tests/baseline/test_uneven_levels.png +0 -0
- ultraplot/tests/test_1dplots.py +373 -0
- ultraplot/tests/test_2dplots.py +354 -0
- ultraplot/tests/test_axes.py +179 -0
- ultraplot/tests/test_colorbar.py +253 -0
- ultraplot/tests/test_docs.py +78 -0
- ultraplot/tests/test_format.py +340 -0
- ultraplot/tests/test_geographic.py +116 -0
- ultraplot/tests/test_imshow.py +110 -0
- ultraplot/tests/test_inset.py +28 -0
- ultraplot/tests/test_integration.py +149 -0
- ultraplot/tests/test_legend.py +181 -0
- ultraplot/tests/test_projections.py +138 -0
- ultraplot/tests/test_statistical_plotting.py +77 -0
- ultraplot/tests/test_subplots.py +174 -0
- ultraplot/ticker.py +879 -0
- ultraplot/ui.py +233 -0
- ultraplot/utils.py +912 -0
- ultraplot-0.99.3.dist-info/LICENSE.txt +427 -0
- ultraplot-0.99.3.dist-info/METADATA +88 -0
- ultraplot-0.99.3.dist-info/RECORD +416 -0
- ultraplot-0.99.3.dist-info/WHEEL +5 -0
- ultraplot-0.99.3.dist-info/entry_points.txt +2 -0
- 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
|