plot-io 0.2.0__tar.gz → 0.6.0__tar.gz
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.
- plot_io-0.6.0/API.md +2877 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/EXAMPLES.md +133 -36
- {plot_io-0.2.0 → plot_io-0.6.0}/PKG-INFO +42 -10
- {plot_io-0.2.0 → plot_io-0.6.0}/README.md +38 -7
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/annotated.py +1 -1
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/bars.py +5 -5
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/box_plots.py +1 -1
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/density.py +4 -4
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/distributions.py +3 -3
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/facets.py +3 -3
- plot_io-0.6.0/examples/genome_tracks.py +70 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/grids2d.py +4 -4
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/groups.py +2 -2
- plot_io-0.6.0/examples/heatmap.py +16 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/layouts.py +1 -1
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/scales.py +1 -1
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/scatter_groups.py +1 -2
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/shared_colorbar.py +4 -4
- plot_io-0.6.0/examples/shared_sizes.py +29 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/time_twin.py +1 -1
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/units.py +1 -1
- plot_io-0.6.0/examples/variable_fonts.py +29 -0
- plot_io-0.6.0/plot_io/__init__.py +57 -0
- plot_io-0.6.0/plot_io/_backend.py +43 -0
- plot_io-0.6.0/plot_io/_native/README.md +96 -0
- plot_io-0.6.0/plot_io/_native/__init__.py +188 -0
- plot_io-0.6.0/plot_io/_native/_api.py +365 -0
- plot_io-0.6.0/plot_io/_native/bin/linux-aarch64.so +0 -0
- plot_io-0.6.0/plot_io/_native/bin/linux-x86_64.so +0 -0
- plot_io-0.6.0/plot_io/_native/bin/macos-arm64.dylib +0 -0
- plot_io-0.6.0/plot_io/_native/bin/windows-arm64.dll +0 -0
- plot_io-0.6.0/plot_io/_native/bin/windows-x86_64.dll +0 -0
- plot_io-0.6.0/plot_io/_native/kernels.py +326 -0
- plot_io-0.6.0/plot_io/_native/manifest.json +49 -0
- plot_io-0.6.0/plot_io/_native/src/alloc.c +163 -0
- plot_io-0.6.0/plot_io/_native/src/colormap.c +205 -0
- plot_io-0.6.0/plot_io/_native/src/data.c +47 -0
- plot_io-0.6.0/plot_io/_native/src/math.c +359 -0
- plot_io-0.6.0/plot_io/_native/src/plio.h +126 -0
- plot_io-0.6.0/plot_io/_native/src/plio_api.h +246 -0
- plot_io-0.6.0/plot_io/_native/src/plot.c +1679 -0
- plot_io-0.6.0/plot_io/_native/src/rt.c +104 -0
- plot_io-0.6.0/plot_io/_native/src/signatures.c +267 -0
- plot_io-0.6.0/plot_io/_native/src/stats.c +671 -0
- plot_io-0.6.0/plot_io/_threads.py +43 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/axis.py +295 -100
- plot_io-0.6.0/plot_io/color/__init__.py +4 -0
- plot_io-0.6.0/plot_io/color/data.py +1618 -0
- plot_io-0.6.0/plot_io/color/maps.py +365 -0
- plot_io-0.6.0/plot_io/color/palettes.py +206 -0
- plot_io-0.6.0/plot_io/color/values.py +277 -0
- plot_io-0.6.0/plot_io/colorbar.py +451 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/decorations.py +38 -28
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/defaults.py +209 -204
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/density.py +8 -8
- plot_io-0.6.0/plot_io/facets.py +202 -0
- plot_io-0.6.0/plot_io/figure.py +560 -0
- plot_io-0.6.0/plot_io/genome/__init__.py +11 -0
- plot_io-0.6.0/plot_io/genome/layout.py +136 -0
- plot_io-0.6.0/plot_io/genome/pack.py +23 -0
- plot_io-0.6.0/plot_io/genome/regions.py +127 -0
- plot_io-0.6.0/plot_io/genome/scale.py +137 -0
- plot_io-0.6.0/plot_io/genome/sources.py +299 -0
- plot_io-0.6.0/plot_io/genome/tracks.py +1253 -0
- plot_io-0.6.0/plot_io/geometry.py +222 -0
- plot_io-0.6.0/plot_io/groups.py +285 -0
- plot_io-0.6.0/plot_io/kernels.py +551 -0
- plot_io-0.6.0/plot_io/labels.py +70 -0
- plot_io-0.6.0/plot_io/layers/__init__.py +66 -0
- plot_io-0.6.0/plot_io/layers/base.py +387 -0
- plot_io-0.6.0/plot_io/layers/context.py +72 -0
- plot_io-0.6.0/plot_io/layers/core.py +274 -0
- plot_io-0.6.0/plot_io/layers/geoms.py +1206 -0
- plot_io-0.2.0/plot_io/series/points.py → plot_io-0.6.0/plot_io/layers/paint.py +168 -134
- plot_io-0.6.0/plot_io/layers/pipeline.py +91 -0
- plot_io-0.6.0/plot_io/layers/positions.py +238 -0
- plot_io-0.6.0/plot_io/layers/stats.py +442 -0
- plot_io-0.6.0/plot_io/layout.py +1161 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/legend.py +200 -159
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/limits.py +2 -0
- plot_io-0.6.0/plot_io/lines.py +38 -0
- plot_io-0.6.0/plot_io/mapped.py +456 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/markers.py +7 -7
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/numbers.py +4 -23
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/occupancy.py +3 -2
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/plot.py +63 -146
- plot_io-0.6.0/plot_io/presets/__init__.py +42 -0
- plot_io-0.6.0/plot_io/presets/_util.py +260 -0
- {plot_io-0.2.0/plot_io/series → plot_io-0.6.0/plot_io/presets}/area.py +79 -83
- plot_io-0.6.0/plot_io/presets/bar.py +257 -0
- plot_io-0.6.0/plot_io/presets/box.py +382 -0
- plot_io-0.6.0/plot_io/presets/catpoints.py +174 -0
- plot_io-0.6.0/plot_io/presets/contour.py +303 -0
- plot_io-0.6.0/plot_io/presets/curves.py +30 -0
- plot_io-0.6.0/plot_io/presets/ecdf.py +97 -0
- plot_io-0.6.0/plot_io/presets/errorbar.py +119 -0
- {plot_io-0.2.0/plot_io/series → plot_io-0.6.0/plot_io/presets}/errors.py +65 -38
- plot_io-0.6.0/plot_io/presets/fill.py +94 -0
- plot_io-0.6.0/plot_io/presets/heatmap.py +289 -0
- plot_io-0.6.0/plot_io/presets/hexbin.py +183 -0
- plot_io-0.6.0/plot_io/presets/hist.py +360 -0
- plot_io-0.6.0/plot_io/presets/hist2d.py +78 -0
- plot_io-0.6.0/plot_io/presets/kde.py +166 -0
- plot_io-0.6.0/plot_io/presets/kde2d.py +126 -0
- plot_io-0.6.0/plot_io/presets/line.py +154 -0
- plot_io-0.6.0/plot_io/presets/pie.py +457 -0
- plot_io-0.6.0/plot_io/presets/regression.py +120 -0
- plot_io-0.6.0/plot_io/presets/scatter.py +125 -0
- plot_io-0.6.0/plot_io/presets/stem.py +96 -0
- plot_io-0.6.0/plot_io/presets/violin.py +301 -0
- plot_io-0.6.0/plot_io/py.typed +0 -0
- plot_io-0.6.0/plot_io/render.py +332 -0
- plot_io-0.6.0/plot_io/rows.py +399 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/scales.py +7 -6
- plot_io-0.6.0/plot_io/seams.py +119 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/settings.py +326 -121
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/shapes.py +16 -8
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/sharing.py +57 -20
- plot_io-0.6.0/plot_io/sizemaps.py +90 -0
- plot_io-0.6.0/plot_io/spec.py +202 -0
- plot_io-0.6.0/plot_io/states.py +176 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/stats.py +19 -21
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/styles/__init__.py +53 -26
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/styles/library.py +76 -30
- plot_io-0.6.0/plot_io/text.py +222 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/ticks.py +25 -2
- plot_io-0.6.0/plot_io/transform.py +108 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/units.py +143 -44
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/values.py +8 -9
- plot_io-0.6.0/pyproject.toml +40 -0
- plot_io-0.6.0/tests/fonts/PioTest-Bold.ttf +0 -0
- plot_io-0.6.0/tests/fonts/PioTest-Regular.ttf +0 -0
- plot_io-0.6.0/tests/fonts/VarTest.ttf +0 -0
- plot_io-0.6.0/tests/golden.json +111 -0
- plot_io-0.6.0/tests/helpers.py +98 -0
- plot_io-0.6.0/tests/stats_reference.json +839 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_bars.py +117 -12
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_box.py +11 -7
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_decorations.py +48 -5
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_defaults.py +47 -24
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_density.py +79 -28
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_distributions.py +13 -9
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_entry.py +20 -4
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_figure_title.py +5 -5
- plot_io-0.6.0/tests/test_fonts.py +66 -0
- plot_io-0.6.0/tests/test_genome.py +839 -0
- plot_io-0.6.0/tests/test_geometry.py +368 -0
- plot_io-0.6.0/tests/test_golden.py +186 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_grids.py +7 -6
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_heatmap.py +16 -9
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_jxl_output.py +6 -5
- plot_io-0.6.0/tests/test_layers.py +149 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_layout.py +22 -22
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_limits.py +3 -1
- plot_io-0.6.0/tests/test_maps.py +281 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_markers.py +6 -4
- plot_io-0.6.0/tests/test_native.py +94 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_numbers.py +1 -1
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_occupancy.py +12 -12
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_output.py +56 -12
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_palettes.py +49 -4
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_pie.py +2 -2
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_reflines.py +3 -3
- plot_io-0.6.0/tests/test_rows.py +138 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_series.py +15 -18
- plot_io-0.6.0/tests/test_settings.py +237 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_sharing.py +5 -2
- plot_io-0.6.0/tests/test_simplify.py +88 -0
- plot_io-0.6.0/tests/test_stats.py +98 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_style_settings.py +40 -23
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_style_types.py +2 -1
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_styles.py +15 -14
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_tables.py +110 -13
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_ticks.py +1 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_time_twin.py +3 -3
- plot_io-0.6.0/tests/test_transform.py +101 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_units.py +63 -19
- plot_io-0.6.0/tests/test_values.py +351 -0
- plot_io-0.6.0/tests/test_vocabulary.py +130 -0
- plot_io-0.6.0/tools/build_native.py +640 -0
- plot_io-0.6.0/tools/settings_doc.py +191 -0
- plot_io-0.2.0/.gitignore +0 -19
- plot_io-0.2.0/API.md +0 -1901
- plot_io-0.2.0/examples/annotated.png +0 -0
- plot_io-0.2.0/examples/bars.png +0 -0
- plot_io-0.2.0/examples/box_plots.png +0 -0
- plot_io-0.2.0/examples/density.png +0 -0
- plot_io-0.2.0/examples/distributions.png +0 -0
- plot_io-0.2.0/examples/error_bars.png +0 -0
- plot_io-0.2.0/examples/facets.png +0 -0
- plot_io-0.2.0/examples/grids2d.png +0 -0
- plot_io-0.2.0/examples/groups.png +0 -0
- plot_io-0.2.0/examples/heatmap.png +0 -0
- plot_io-0.2.0/examples/heatmap.py +0 -16
- plot_io-0.2.0/examples/large_data.png +0 -0
- plot_io-0.2.0/examples/layout_axes.png +0 -0
- plot_io-0.2.0/examples/layout_borders.png +0 -0
- plot_io-0.2.0/examples/line_band.png +0 -0
- plot_io-0.2.0/examples/scales.png +0 -0
- plot_io-0.2.0/examples/scatter_groups.png +0 -0
- plot_io-0.2.0/examples/shared_colorbar.png +0 -0
- plot_io-0.2.0/examples/styles/altair-2.png +0 -0
- plot_io-0.2.0/examples/styles/altair.png +0 -0
- plot_io-0.2.0/examples/styles/bokeh-2.png +0 -0
- plot_io-0.2.0/examples/styles/bokeh.png +0 -0
- plot_io-0.2.0/examples/styles/chartjs-2.png +0 -0
- plot_io-0.2.0/examples/styles/chartjs.png +0 -0
- plot_io-0.2.0/examples/styles/default-2.png +0 -0
- plot_io-0.2.0/examples/styles/default.png +0 -0
- plot_io-0.2.0/examples/styles/economist-2.png +0 -0
- plot_io-0.2.0/examples/styles/economist.png +0 -0
- plot_io-0.2.0/examples/styles/excel-2.png +0 -0
- plot_io-0.2.0/examples/styles/excel.png +0 -0
- plot_io-0.2.0/examples/styles/fivethirtyeight-2.png +0 -0
- plot_io-0.2.0/examples/styles/fivethirtyeight.png +0 -0
- plot_io-0.2.0/examples/styles/ggplot2-2.png +0 -0
- plot_io-0.2.0/examples/styles/ggplot2-bw-2.png +0 -0
- plot_io-0.2.0/examples/styles/ggplot2-bw.png +0 -0
- plot_io-0.2.0/examples/styles/ggplot2.png +0 -0
- plot_io-0.2.0/examples/styles/matlab-2.png +0 -0
- plot_io-0.2.0/examples/styles/matlab.png +0 -0
- plot_io-0.2.0/examples/styles/matplotlib-2.png +0 -0
- plot_io-0.2.0/examples/styles/matplotlib-classic-2.png +0 -0
- plot_io-0.2.0/examples/styles/matplotlib-classic.png +0 -0
- plot_io-0.2.0/examples/styles/matplotlib.png +0 -0
- plot_io-0.2.0/examples/styles/observable-2.png +0 -0
- plot_io-0.2.0/examples/styles/observable.png +0 -0
- plot_io-0.2.0/examples/styles/plotly-2.png +0 -0
- plot_io-0.2.0/examples/styles/plotly-white-2.png +0 -0
- plot_io-0.2.0/examples/styles/plotly-white.png +0 -0
- plot_io-0.2.0/examples/styles/plotly.png +0 -0
- plot_io-0.2.0/examples/styles/seaborn-2.png +0 -0
- plot_io-0.2.0/examples/styles/seaborn-whitegrid-2.png +0 -0
- plot_io-0.2.0/examples/styles/seaborn-whitegrid.png +0 -0
- plot_io-0.2.0/examples/styles/seaborn.png +0 -0
- plot_io-0.2.0/examples/styles/tufte-2.png +0 -0
- plot_io-0.2.0/examples/styles/tufte.png +0 -0
- plot_io-0.2.0/examples/time_twin.png +0 -0
- plot_io-0.2.0/examples/units.png +0 -0
- plot_io-0.2.0/plot_io/__init__.py +0 -66
- plot_io-0.2.0/plot_io/_backend.py +0 -114
- plot_io-0.2.0/plot_io/colorbar.py +0 -364
- plot_io-0.2.0/plot_io/enums.py +0 -64
- plot_io-0.2.0/plot_io/facets.py +0 -184
- plot_io-0.2.0/plot_io/figure.py +0 -368
- plot_io-0.2.0/plot_io/labels.py +0 -63
- plot_io-0.2.0/plot_io/maps/__init__.py +0 -379
- plot_io-0.2.0/plot_io/maps/data.py +0 -333
- plot_io-0.2.0/plot_io/palettes.py +0 -142
- plot_io-0.2.0/plot_io/render.py +0 -1209
- plot_io-0.2.0/plot_io/series/__init__.py +0 -517
- plot_io-0.2.0/plot_io/series/bar.py +0 -294
- plot_io-0.2.0/plot_io/series/box.py +0 -401
- plot_io-0.2.0/plot_io/series/catdata.py +0 -23
- plot_io-0.2.0/plot_io/series/catpoints.py +0 -185
- plot_io-0.2.0/plot_io/series/contour.py +0 -295
- plot_io-0.2.0/plot_io/series/curves.py +0 -128
- plot_io-0.2.0/plot_io/series/ecdf.py +0 -145
- plot_io-0.2.0/plot_io/series/errorbar.py +0 -112
- plot_io-0.2.0/plot_io/series/fill.py +0 -169
- plot_io-0.2.0/plot_io/series/heatmap.py +0 -305
- plot_io-0.2.0/plot_io/series/hexbin.py +0 -219
- plot_io-0.2.0/plot_io/series/hist.py +0 -390
- plot_io-0.2.0/plot_io/series/hist2d.py +0 -163
- plot_io-0.2.0/plot_io/series/kde.py +0 -237
- plot_io-0.2.0/plot_io/series/kde2d.py +0 -153
- plot_io-0.2.0/plot_io/series/line.py +0 -171
- plot_io-0.2.0/plot_io/series/pie.py +0 -323
- plot_io-0.2.0/plot_io/series/regression.py +0 -252
- plot_io-0.2.0/plot_io/series/scatter.py +0 -104
- plot_io-0.2.0/plot_io/series/stem.py +0 -113
- plot_io-0.2.0/plot_io/series/violin.py +0 -322
- plot_io-0.2.0/plot_io/slots.py +0 -62
- plot_io-0.2.0/plot_io/stacking.py +0 -63
- plot_io-0.2.0/plot_io/style.py +0 -87
- plot_io-0.2.0/plot_io/text.py +0 -111
- plot_io-0.2.0/pyproject.toml +0 -35
- plot_io-0.2.0/tests/golden.json +0 -21
- plot_io-0.2.0/tests/helpers.py +0 -17
- plot_io-0.2.0/tests/test_golden.py +0 -101
- plot_io-0.2.0/tests/test_maps.py +0 -126
- plot_io-0.2.0/tests/test_settings.py +0 -95
- plot_io-0.2.0/tests/test_simplify.py +0 -67
- plot_io-0.2.0/tests/test_values.py +0 -122
- plot_io-0.2.0/tools/bench.py +0 -225
- plot_io-0.2.0/tools/dist.py +0 -80
- plot_io-0.2.0/tools/settings_doc.py +0 -122
- {plot_io-0.2.0 → plot_io-0.6.0}/LICENSE +0 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/error_bars.py +0 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/large_data.py +0 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/line_band.py +0 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/examples/styles.py +0 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/tables.py +0 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/plot_io/times.py +0 -0
- {plot_io-0.2.0 → plot_io-0.6.0}/tests/test_docs.py +0 -0
plot_io-0.6.0/API.md
ADDED
|
@@ -0,0 +1,2877 @@
|
|
|
1
|
+
# plot_io API
|
|
2
|
+
|
|
3
|
+
Complete reference. Worked examples are in [EXAMPLES.md](EXAMPLES.md).
|
|
4
|
+
|
|
5
|
+
1. [Conventions](#1-conventions)
|
|
6
|
+
2. [Figures](#2-figures)
|
|
7
|
+
3. [Plots](#3-plots)
|
|
8
|
+
4. [Axes](#4-axes)
|
|
9
|
+
5. [Series](#5-series)
|
|
10
|
+
6. [Color and size axes](#6-color-and-size-axes)
|
|
11
|
+
7. [Colors, maps and markers](#7-colors-maps-and-markers)
|
|
12
|
+
8. [Output](#8-output)
|
|
13
|
+
9. [Genome tracks](#9-genome-tracks)
|
|
14
|
+
10. [Styles](#10-styles)
|
|
15
|
+
11. [Errors](#11-errors)
|
|
16
|
+
12. [Modules](#12-modules)
|
|
17
|
+
|
|
18
|
+
## 1. Conventions
|
|
19
|
+
|
|
20
|
+
* **Model.** A `Figure` holds plots (and colorbars) in a grid; a `Plot` holds series, two
|
|
21
|
+
axes, a title, a legend and colorbars; a series holds data and style. Nothing is
|
|
22
|
+
computed until the figure is drawn (`save`, `to_bytes`, `draw`), so settings can change
|
|
23
|
+
in any order.
|
|
24
|
+
* **Settings.** Every object takes its settings as keywords when created and in
|
|
25
|
+
`set(**settings)`, which returns the object. `set(name=None)` goes back to the inherited
|
|
26
|
+
or default value. `get(name)` returns the value as given (`"4.5pt"`, `"var(color)"`),
|
|
27
|
+
`resolve(name)` the final one (px, degrees, colors), and `explain(name)` where it comes
|
|
28
|
+
from ([values](#values)). Unknown names and invalid values raise `ValueError` naming
|
|
29
|
+
the setting (with the nearest valid name).
|
|
30
|
+
* **Inheritance.** Settings marked *inherited* in the tables (font, line width, palette,
|
|
31
|
+
alpha, `rasterize`, `simplify`) are looked up series → plot → figure → style.
|
|
32
|
+
* **Setting groups.** Settings that travel together are declared once as a group and
|
|
33
|
+
embedded by each owner: `Font` (family, size, variable-font axes), `TextStyle` (size,
|
|
34
|
+
weight, style, color of one text element), `Stroke` (color, width, dash style, caps,
|
|
35
|
+
joins), `Marker`, `FillStyle` (`fill`: on or off, an opacity or a color) and
|
|
36
|
+
`NumberFormat`. The naming rule: an owner's primary element takes a group unprefixed, a
|
|
37
|
+
secondary one prefixed, and every member's prefixed name follows its pattern. A
|
|
38
|
+
scatter's markers are `size`, `edge_color`, …; a line's are `marker_size`,
|
|
39
|
+
`marker_edge_color`; a box's whiskers are `whisker_color`, `whisker_width`,
|
|
40
|
+
`whisker_style`; an axis' tick labels are `tick_label_font_size`, `tick_label_weight`,
|
|
41
|
+
`tick_label_color`. Each table ends with the groups the class embeds and their
|
|
42
|
+
prefixes; [groups](#setting-groups) lists the members.
|
|
43
|
+
* **Defaults.** Every default is in one dict, `pl.DEFAULTS` (`plot_io/defaults.py`; read
|
|
44
|
+
it, do not change it: styles set other values): bare names for inherited settings (font size,
|
|
45
|
+
sans-serif, black text, line width, `simplify="auto"`, the palette, …),
|
|
46
|
+
`"Class.name"` for the settings of each class and `"Group.member"` for every embedding
|
|
47
|
+
of a group member (`"Marker.size"`: every marker size). A class without an entry uses
|
|
48
|
+
its base class's, then the group's. Entries are plain data: a default that follows
|
|
49
|
+
another setting is written with units, `var()` or `calc()` (a legend's font is `"1em"`,
|
|
50
|
+
a minor tick `"60%"` of the tick length), and a class default of an inherited setting
|
|
51
|
+
scales the inherited value with `inherit` (a regression line is
|
|
52
|
+
`"calc(1.4 * inherit)"`, a fill's opacity `"calc(0.3 * inherit)"`). `"XAxis.name"` and
|
|
53
|
+
`"YAxis.name"` give one axis its own default.
|
|
54
|
+
* **`"auto"`.** A setting whose default is `"auto"` documents its rule. Rules that follow
|
|
55
|
+
from the model (a colorbar's orientation from its position, a legend's inner pad from
|
|
56
|
+
its frame, a genome track's gap) are resolved with the setting: `resolve()` returns the
|
|
57
|
+
result and `get()` `"auto"`. Rules that need the data or the layout (axis limits,
|
|
58
|
+
padding, tick count and rotation, number formats, legend placement) are resolved when
|
|
59
|
+
the figure is drawn.
|
|
60
|
+
* **Resolution.** One cascade finds every value, for `resolve`, `get` and `explain`:
|
|
61
|
+
1. the value set on the object; for a plot's x or y axis, then the value set on the
|
|
62
|
+
figure's axis of that role (`fig.x_axis(…)`);
|
|
63
|
+
2. a rule of the class (a track's axis lines from its content);
|
|
64
|
+
3. the style's key for the object's class, then for its base classes (`"Series.alpha"`
|
|
65
|
+
reaches every series), stopping at a class that has a default of its own;
|
|
66
|
+
4. for inherited settings, the parent's value (unless the class default refers to it
|
|
67
|
+
with `inherit`);
|
|
68
|
+
5. the style's key for the setting's group (`"Marker.size"`);
|
|
69
|
+
6. the class default, then the group default;
|
|
70
|
+
7. for inherited settings, the style's bare name, then `DEFAULTS`'.
|
|
71
|
+
|
|
72
|
+
An owner's key always comes before its group's: `"Line.marker_size"` overrides
|
|
73
|
+
`"Marker.size"` for lines.
|
|
74
|
+
* **Styles.** `Figure(style=…)` presets settings: a style name or a dict of settings,
|
|
75
|
+
merged over the inherited defaults (the bare names of `DEFAULTS`). See [Styles](#styles).
|
|
76
|
+
* **Entry points.** `pl.Figure()`, `pl.Plot()` and the series classes (`pl.Scatter()`, …)
|
|
77
|
+
each create the levels above them: `pl.Scatter(x, y)` makes a plot (`.plot`) in a new
|
|
78
|
+
figure (`.plot.figure`). `fig.plot(…)` is `pl.Plot(figure=fig, …)` and `p.scatter(…)` is
|
|
79
|
+
`pl.Scatter(…, plot=p)`. Keywords that belong to a level above go to it when the call
|
|
80
|
+
creates that level: `pl.Scatter(x, y, width=300, title="T")` makes and sets the plot and
|
|
81
|
+
the figure. Adding to an existing plot or figure takes the new object's settings only:
|
|
82
|
+
`p.scatter(x, y, title="T")` raises `ValueError` naming `plot.set(title=…)`. A name
|
|
83
|
+
present on several levels goes to the lowest.
|
|
84
|
+
* **Units.** Lengths take units (`"1.5in"`, `"0.5em"`, `"60%"`); bare numbers are CSS px
|
|
85
|
+
(1 px = 1/96 in = 0.75 pt) everywhere. Slot widths (`Bar`, `Box`, `Violin`, `Strip`,
|
|
86
|
+
`Swarm` `width`) are `"80%"` of the slot or `"0.8d"` in data units. Positions along an
|
|
87
|
+
axis (a decoration's `min`/`max`) take bare numbers as data values. See
|
|
88
|
+
[values](#values).
|
|
89
|
+
Images are `dpi` pixels per inch: `dpi=96` gives one image pixel per px, the default 192
|
|
90
|
+
two. A dpi up to 16 is a multiple of 96: `dpi=2` is 192. PDF pages are sized in pt (× 0.75).
|
|
91
|
+
* **Data.** Sequences (`None` = missing), `array.array`, or any buffer (numpy arrays are
|
|
92
|
+
read without importing numpy). NaN or `None` values are missing: scatter skips them,
|
|
93
|
+
line and fill break there, box ignores them, heatmap cells take `nan_color`.
|
|
94
|
+
With `data=` (a table), strings in data arguments name its columns
|
|
95
|
+
([tables](#tables-data)); dates make time axes ([dates](#dates-and-times)).
|
|
96
|
+
* **Text.** Titles, axis labels and legend entries are strings or rich content: a list of
|
|
97
|
+
strings and `pl.Span` (vec_io's), e.g. `["Area (m", pl.Span("2",
|
|
98
|
+
baseline_shift="super", font_scale=0.7), ")"]`.
|
|
99
|
+
* **Named colors.** `"blue"`, `"blue 0.45"`, `"blue 45%"`: 28 scales (`red`, `orange`,
|
|
100
|
+
`amber`, `yellow`, `lime`, `green`, `emerald`, `teal`, `cyan`, `sky`, `blue`, `indigo`,
|
|
101
|
+
`violet`, `purple`, `fuchsia`, `pink`, `rose`, `slate`, `gray`/`grey`, `zinc`, `neutral`,
|
|
102
|
+
`stone`, `taupe`, `mauve`, `mist`, `olive`, `black`, `white`), Tailwind CSS 4's OKLCh
|
|
103
|
+
shades 100–900 at levels 0.1–0.9, white at 0 and black at 1, interpolated in Oklab between
|
|
104
|
+
and gamut mapped into sRGB as CSS Color 4 specifies;
|
|
105
|
+
a bare name is level 0.5. They take precedence over CSS's names (`"red"` is `#fb2c36`,
|
|
106
|
+
not `#ff0000`); other CSS names (`"navy"`) keep their CSS values. `get()` returns the
|
|
107
|
+
name as given, `resolve()` the hex color.
|
|
108
|
+
* **Colors.** Named colors (above), any color vec_io accepts: CSS names, `"#rrggbb[aa]"`, CSS Color 4 functions
|
|
109
|
+
(`"rgb(…)"`, `"hsl(…)"`, `"hwb(…)"`, `"lab(…)"`, `"lch(…)"`, `"oklab(…)"`,
|
|
110
|
+
`"oklch(64.5% 0.246 16.439)"`, `"color(display-p3 1 0 0)"`, …; colors outside sRGB are
|
|
111
|
+
gamut mapped as browsers do), tuples of numbers in [0, 1] (`(1, 0.5, 0)`; on the 0–255
|
|
112
|
+
scale write `"rgb(255 128 0)"`), `CMYK` and `Spot`; and `"C0"`, `"C1"`, … for the
|
|
113
|
+
palette's colors.
|
|
114
|
+
* **Fonts.** `font_family` is a CSS family list; weights (`font_weight`, `label_weight`,
|
|
115
|
+
`tick_label_weight`) are `normal`, `bold` or 1–1000, styles `normal`, `italic`,
|
|
116
|
+
`oblique` or `"oblique 10deg"`. With a variable font (vec_io embeds the instance used),
|
|
117
|
+
the weight sets `wght`, the inherited `font_stretch` (`"condensed"`, `"87.5%"`) sets
|
|
118
|
+
`wdth`, the style `ital` or `slnt`, `font_optical_sizing="auto"` sets `opsz` from the
|
|
119
|
+
font size, and `font_variations` (`{"GRAD": 50}`) any axis:
|
|
120
|
+
`pl.Figure(font_family="Roboto Flex", font_stretch="85%", font_variations={"GRAD": 50})`.
|
|
121
|
+
* **Text and fonts.** Text is shaped by `vec_io.text` (pairs kerned) and its fonts are
|
|
122
|
+
embedded as subsets; plot text needs an installed outline font. Each character takes
|
|
123
|
+
the first family of `font_family` that is available (output options `font_dirs`, then
|
|
124
|
+
`VEC_IO_FONT_DIRS`, then installed fonts unless `system_fonts=False`; a family that is
|
|
125
|
+
not installed tries its metric aliases first: Helvetica and Arial → Liberation Sans,
|
|
126
|
+
Arimo, …), then a generic family's list (`sans-serif`: Arial, Helvetica, Liberation
|
|
127
|
+
Sans, DejaVu Sans, Noto Sans, …), then any font with the character. The default
|
|
128
|
+
`"SF Pro, Inter, Helvetica, Arial, sans-serif"` is SF Pro where installed, else Inter,
|
|
129
|
+
else Helvetica or Arial (or an alias of theirs), else the system's sans-serif. With no
|
|
130
|
+
outline font at all, output raises `NoFontError` (a `ValueError`, from vec_io).
|
|
131
|
+
* **Names.** `pl.` holds the figure and plot classes, the plot types, the value types
|
|
132
|
+
(`ColorAxis`, `SizeAxis`, `ColorMap`, `SizeMap`, `Palette`, `Density`, `ErrorBars`,
|
|
133
|
+
`Span`), `facet`, the registries (`register_layer`, `register_marker`,
|
|
134
|
+
`register_color_map`, `register_palette`, `register_style`), `styles` (the styles
|
|
135
|
+
module), `set_style`, `use_style` and `DEFAULTS`; see [modules](#12-modules) for the
|
|
136
|
+
rest. Enum-like settings take strings.
|
|
137
|
+
|
|
138
|
+
### Values
|
|
139
|
+
|
|
140
|
+
Every length, angle and number setting takes a value with a unit, a reference to another
|
|
141
|
+
setting, or an expression:
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
pl.Plot(width="3in", font_size="9pt", title="T")
|
|
145
|
+
p.x_axis(tick_length="0.5em", minor_tick_length="50%", tick_rotation="0.125turn")
|
|
146
|
+
p.bar(days, counts, width="20h") # a duration on a time axis
|
|
147
|
+
p.box(groups, positions=[1, 4, 9], width="0.8d") # data units (default: 80% of the slot)
|
|
148
|
+
p.errorbar(x, y, y_error=e, cap_length="0.2d") # data units across the bar
|
|
149
|
+
p.title(font_size="large", color="var(--accent)")
|
|
150
|
+
p.legend(pad="calc(1em - 2px)")
|
|
151
|
+
fig.set(vars={"accent": "#c00"}) # custom variables, read by var(--name)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
| Unit | Meaning |
|
|
155
|
+
|---|---|
|
|
156
|
+
| bare number | px (lengths), degrees (angles) |
|
|
157
|
+
| `px` `pt` `pc` `in` `cm` `mm` `Q` | absolute lengths |
|
|
158
|
+
| `em` | the object's `font_size`; in a `font_size` setting, the parent's |
|
|
159
|
+
| `rem` | the figure's `font_size` |
|
|
160
|
+
| `%` | of the reference the setting's type declares and its table entry names: another setting (`minor_tick_length`: of `tick_length`), or one of the [referents](#referents) |
|
|
161
|
+
| `d`, `data` | along a data axis: data units on linear axes, categories on category axes, seconds on time axes; an error on log, symlog and logit axes. On a time axis `d` is a day |
|
|
162
|
+
| `ms` `s` `min` `h` `d` `w` | durations, as data units of time axes (a `timedelta` too) |
|
|
163
|
+
| `fr` | a share of the room left by fixed tracks, in `Figure.widths`/`heights` |
|
|
164
|
+
| `deg` `grad` `rad` `turn` | angles |
|
|
165
|
+
| `xx-small` … `xx-large`, `smaller`, `larger` | font sizes: × 0.579 … 1.728 of `rem`; ÷/× 1.2 of the parent's |
|
|
166
|
+
|
|
167
|
+
* **`var(name[, fallback])`** reads another setting of the object, resolved through the
|
|
168
|
+
usual inheritance. **`inherit`** (or `var()` of the setting's own name) reads the
|
|
169
|
+
parent's value of the same setting (`alpha="calc(inherit / 2)"`). `var(--name)` reads a custom variable: from the
|
|
170
|
+
nearest `vars` (figure or plot), else a `"--name"` key of the style. The fallback is used
|
|
171
|
+
when the value is unset. Loops raise. Text settings (titles, labels, names, formats)
|
|
172
|
+
never read `var()`.
|
|
173
|
+
* **`calc()`** takes `+ - * /`, parentheses, numbers, dimensions with any unit, `var()`
|
|
174
|
+
and `inherit`: dimensions add to dimensions and multiply or divide by numbers.
|
|
175
|
+
* **Layout.** `%` of the axes is exact with `reference="axes"` (the axes size is given)
|
|
176
|
+
and resolved in each [layout](#layout) round otherwise; it is known only while the
|
|
177
|
+
figure is drawn. A render first resolves every other setting of the figure once (the values
|
|
178
|
+
drawing reads); settings set while it runs take effect at once. `spacing`, `margin` and fixed `widths`/`heights` in `%` of the figure are solved
|
|
179
|
+
exactly when the figure size follows from its contents.
|
|
180
|
+
* **Scaling.** `Figure.scaling` multiplies every absolute length (px and physical units)
|
|
181
|
+
wherever it is given: on objects, in styles, in `DEFAULTS`; not the figure size.
|
|
182
|
+
`em`, `rem` and font keywords follow `font_size`, which is scaled; `%`, `fr` and `data`
|
|
183
|
+
are not scaled.
|
|
184
|
+
* **Reading.** `get(name)` returns the value as given, `resolve(name)` the final value
|
|
185
|
+
(`resolve(name, of=…)` for settings whose `%` reference the caller passes), and
|
|
186
|
+
`explain(name)` a trace:
|
|
187
|
+
|
|
188
|
+
#### Referents
|
|
189
|
+
|
|
190
|
+
What `%` of a length can be of, besides another setting (the tables name it per setting):
|
|
191
|
+
|
|
192
|
+
<!-- settings:referents -->
|
|
193
|
+
| Key | `%` of |
|
|
194
|
+
|---|---|
|
|
195
|
+
| `em` | the font size |
|
|
196
|
+
| `axes_width` | the axes width |
|
|
197
|
+
| `axes_height` | the axes height |
|
|
198
|
+
| `across` | the axes side across the axis |
|
|
199
|
+
| `along` | the axes side along the axis |
|
|
200
|
+
| `axes` | the axes width (across) or height (down) |
|
|
201
|
+
| `axes_length` | the axes length along the axis |
|
|
202
|
+
| `data_range` | the axis range |
|
|
203
|
+
| `bar_across` | the axes side across the colorbar |
|
|
204
|
+
| `bar_along` | the axes side along the colorbar |
|
|
205
|
+
| `figure` | the figure width (across) or height (down) |
|
|
206
|
+
| `slot` | the slot: one category, or the smallest gap between positions |
|
|
207
|
+
| `slot_part` | each series' part of a shared slot |
|
|
208
|
+
| `box_width` | the box width |
|
|
209
|
+
| `radius` | the radius |
|
|
210
|
+
<!-- /settings -->
|
|
211
|
+
|
|
212
|
+
#### Setting groups
|
|
213
|
+
|
|
214
|
+
Members, their names under a prefix `{p}`, and the group defaults (`"Group.member"` keys).
|
|
215
|
+
`"FillStyle.fill"` sets every series fill (bars, boxes, violins, pies, densities,
|
|
216
|
+
contours, genome signals and intervals); `"Marker.fill"` every marker fill.
|
|
217
|
+
|
|
218
|
+
<!-- settings:groups -->
|
|
219
|
+
| Group | Member | Under a prefix `{p}` | Default |
|
|
220
|
+
|---|---|---|---|
|
|
221
|
+
| `Font` | `font_size` | `{p}font_size` | inherited |
|
|
222
|
+
| `Font` | `font_family` | `{p}font_family` | inherited |
|
|
223
|
+
| `Font` | `font_stretch` | `{p}font_stretch` | inherited |
|
|
224
|
+
| `Font` | `font_variations` | `{p}font_variations` | inherited |
|
|
225
|
+
| `Font` | `font_optical_sizing` | `{p}font_optical_sizing` | inherited |
|
|
226
|
+
| `TextStyle` | `font_size` | `{p}font_size` | '1em' |
|
|
227
|
+
| `TextStyle` | `font_weight` | `{p}weight` | 'normal' |
|
|
228
|
+
| `TextStyle` | `font_style` | `{p}style` | 'normal' |
|
|
229
|
+
| `TextStyle` | `color` | `{p}color` | 'var(text_color)' |
|
|
230
|
+
| `Stroke` | `color` | `{p}color` | — |
|
|
231
|
+
| `Stroke` | `line_width` | `{p}width` | 0.75 |
|
|
232
|
+
| `Stroke` | `line_style` | `{p}style` | 'solid' |
|
|
233
|
+
| `Stroke` | `cap` | `{p}cap` | 'butt' |
|
|
234
|
+
| `Stroke` | `join` | `{p}join` | 'round' |
|
|
235
|
+
| `Marker` | `marker` | `marker (never prefixed)` | 'circle' |
|
|
236
|
+
| `Marker` | `size` | `{p}size` | 4.5 |
|
|
237
|
+
| `Marker` | `color` | `{p}color` | — |
|
|
238
|
+
| `Marker` | `edge_color` | `{p}edge_color` | 'auto' |
|
|
239
|
+
| `Marker` | `edge_width` | `{p}edge_width` | 0.75 |
|
|
240
|
+
| `Marker` | `fill` | `{p}fill` | True |
|
|
241
|
+
| `Marker` | `size_basis` | `size_basis (never prefixed)` | 'area' |
|
|
242
|
+
| `FillStyle` | `fill` | `{p}fill` | — |
|
|
243
|
+
| `NumberFormat` | `decimal_separator` | `{p}decimal_separator` | inherited |
|
|
244
|
+
| `NumberFormat` | `thousands_separator` | `{p}thousands_separator` | inherited |
|
|
245
|
+
| `NumberFormat` | `minus` | `{p}minus` | inherited |
|
|
246
|
+
| `NumberFormat` | `prefix` | `{p}prefix` | inherited |
|
|
247
|
+
| `NumberFormat` | `suffix` | `{p}suffix` | inherited |
|
|
248
|
+
| `NumberFormat` | `precision` | `{p}precision` | inherited |
|
|
249
|
+
<!-- /settings -->
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
>>> pl.Plot(style="matplotlib").x_axis.explain("tick_spacing")
|
|
253
|
+
Axis.tick_spacing = (46.6667px, 33.3333px) ← ('calc(3.5 * var(tick_label_font_size))', 'calc(2.5 * var(tick_label_font_size))') (default Axis.tick_spacing)
|
|
254
|
+
Axis.tick_label_font_size = 13.3333px ← '1em' (default Axis.tick_label_font_size)
|
|
255
|
+
Axis.font_size = 13.3333px ← '10.0pt' (inherited from Figure: style "matplotlib" font_size)
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## 2. Figures
|
|
259
|
+
|
|
260
|
+
```python
|
|
261
|
+
pl.Figure(**settings)
|
|
262
|
+
fig.plot(id=None, **settings) # the plot with id (created if needed), or the next one
|
|
263
|
+
fig.scatter(x, y, **settings) # any plot type: a new plot holding it
|
|
264
|
+
fig.title(text, **settings) # figure title
|
|
265
|
+
fig.x_axis(**settings) # settings of every plot's x axis (fig.y_axis: y)
|
|
266
|
+
fig.colorbar(source, id=None, **settings) # the guide of a color axis, in its own area
|
|
267
|
+
fig.color_axis(**settings) # a shared color axis (fig.size_axis: size)
|
|
268
|
+
fig.size_legend(source, id=None, values=None, title=None)
|
|
269
|
+
fig.track(**settings) # a new track (layout="tracks")
|
|
270
|
+
fig.vline(x, rows=None, **settings) # through plots and the gaps between them
|
|
271
|
+
fig.vspan(x0, x1=None, rows=None, **settings)
|
|
272
|
+
fig.group(first, last=None, label=None, letter=None)
|
|
273
|
+
fig.plots # plots in creation order
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
A plot type called on the figure (`fig.scatter(…)`, `fig.hist(…)`, `fig.bigwig(…)`) makes
|
|
277
|
+
a new plot holding it and returns the series: the plot's settings that the plot type
|
|
278
|
+
lacks, `title`, `x_axis` and `y_axis` go to the plot.
|
|
279
|
+
|
|
280
|
+
### Arrangement
|
|
281
|
+
|
|
282
|
+
* **Grid.** `layout=[[1, 1, 2], [3, 3, 2]]`: each id covers a rectangle of cells; `0` or
|
|
283
|
+
`None` leaves a cell empty. An id holds a plot or a colorbar. `fig.plot()` returns the
|
|
284
|
+
next id without a plot, in reading order.
|
|
285
|
+
* **Automatic** (`layout="auto"`, the default). Plots take positions in creation order:
|
|
286
|
+
|
|
287
|
+
| Settings | Arrangement |
|
|
288
|
+
|---|---|
|
|
289
|
+
| `cols=4` | row by row, at most 4 per row |
|
|
290
|
+
| `rows=4` | column by column, at most 4 per column |
|
|
291
|
+
| `rows=2, cols=3` | a fixed 2 × 3 grid, row by row (full: `ValueError`) |
|
|
292
|
+
| neither | ⌈√n⌉ columns, row by row, chosen when drawn (adding plots can move earlier ones) |
|
|
293
|
+
|
|
294
|
+
`fill_order` (`"row"` or `"col"`) overrides the fill direction. In automatic arrangement ids
|
|
295
|
+
are names; `fig.plot()` gives 1, 2, 3, … skipping taken ids.
|
|
296
|
+
|
|
297
|
+
* **Tracks.** `layout="tracks"`: one column of plots top to bottom in creation order
|
|
298
|
+
(`cols` 1), sharing x (`share_x="all"`), `spacing` 0 and `width` 480 px unless given;
|
|
299
|
+
each row is as high as its plot's `height` (a [track](#tracks)'s: a length, a share such
|
|
300
|
+
as `"1fr"`, or from its content), other plots `1fr`. New plots are tracks
|
|
301
|
+
(`fig.plot()`, `fig.track()`, `fig.bigwig(…)`). `pl.Tracks(region)` is this layout with
|
|
302
|
+
a genome x axis ([§9](#9-genome-tracks)).
|
|
303
|
+
|
|
304
|
+
### Sizes and alignment
|
|
305
|
+
|
|
306
|
+
* `width` × `height` is the size of the box `reference` names:
|
|
307
|
+
* `"axes"` (default): each grid cell's axes rectangle; the figure size follows;
|
|
308
|
+
* `"plot"`: each cell's whole plot box (axes and decorations); the figure size follows;
|
|
309
|
+
* `"figure"`: the whole figure; the cells share what the decorations leave.
|
|
310
|
+
|
|
311
|
+
With only one of `width` and `height`, `aspect_ratio` (width / height, default 5/4)
|
|
312
|
+
gives the other; with neither, the default is 150 × 120 px. Giving all
|
|
313
|
+
three raises `ValueError`. Plots with a `data_ratio` (and pies) take the other side from
|
|
314
|
+
it when only `width` or only `height` is given. `widths`/`heights` are the columns' and
|
|
315
|
+
rows' ratios (numbers or `fr`), or fixed lengths (`["2in", "1fr", "1fr"]`) that the
|
|
316
|
+
ratios share the rest around; a plot spanning cells gets their sizes plus the gaps
|
|
317
|
+
between them.
|
|
318
|
+
* `align="axes"` (default): axis lines line up. Between columns the gutter holds the
|
|
319
|
+
widest right margin before it, the widest left margin after it and `spacing`.
|
|
320
|
+
* `align="borders"`: plot boxes (axes and decorations) line up, and each plot's axes are
|
|
321
|
+
what its own decorations leave.
|
|
322
|
+
* `reference` and `align` combine:
|
|
323
|
+
|
|
324
|
+
| `align` \ `reference` | `"axes"` | `"plot"` | `"figure"` |
|
|
325
|
+
|---|---|---|---|
|
|
326
|
+
| `"axes"` | each cell's axes are `width` | the widest plot box of a column (axes plus the column's largest margins) is `width`; the axes are what is left | the figure is `width`; the axes share what the gutters leave |
|
|
327
|
+
| `"borders"` | a column's box is `width` plus the largest margins in it, so every axes rectangle is at least `width` | each cell's box is `width` | the figure is `width`; the boxes share what the gaps leave |
|
|
328
|
+
|
|
329
|
+
* Columns (rows) holding only vertical (horizontal) colorbars are as wide as the bar,
|
|
330
|
+
unless `widths` (`heights`) is given.
|
|
331
|
+
* Margins come from the real text metrics of tick labels, axis labels, titles, outside
|
|
332
|
+
legends and attached colorbars ([layout](#layout)).
|
|
333
|
+
|
|
334
|
+
### Layout
|
|
335
|
+
|
|
336
|
+
* **Bands.** A plot is its axes rectangle with four stacks of bands around it, from the
|
|
337
|
+
axes outward: tick marks, tick labels, the ×10ᵏ offset (above the y axis), the axis
|
|
338
|
+
label, twin axes, an outside legend, attached colorbars, the plot title (top) and the
|
|
339
|
+
plot's `space_above`; outermost on the left, the row label and group bands, as wide as the
|
|
340
|
+
widest of the plot's grid column. Each band has a thickness and an overhang along its
|
|
341
|
+
side (tick labels past the ends of the axis, a wide title). A side's margin is its
|
|
342
|
+
bands' thicknesses, at least the overhangs of the bands across it. Bands stack: each
|
|
343
|
+
starts past the ones before it (mirrored ticks included), the title past everything on
|
|
344
|
+
top; only twin axes are drawn at the axes edge.
|
|
345
|
+
* **Grid.** Each line between cells takes the largest margin of the plots there
|
|
346
|
+
(`align="axes"`), or each plot's axes are what its margins leave of its box
|
|
347
|
+
(`"borders"`). Colorbars and size legends in their own areas are cells of the grid; the
|
|
348
|
+
figure title is a band at the top of the figure.
|
|
349
|
+
* **Rounds.** Only what is circular is repeated: an axis' length sets its ticks, whose
|
|
350
|
+
labels set the margins, which (with `reference="plot"` or `"figure"`) set the length;
|
|
351
|
+
`data_ratio`; stats binned at the axes' resolution ([hexbin](#hexbin), genome
|
|
352
|
+
[bins](#9-genome-tracks)); the figure title's band in a figure of fixed height. A round
|
|
353
|
+
measures every plot for its axes size and solves the grid. Rounds stop when no axes size
|
|
354
|
+
moves by more than 1/3 px; after 5, a layout still moving (between two tick sets) keeps
|
|
355
|
+
the last. With `reference="axes"` one round suffices. `position="auto"` legends are
|
|
356
|
+
placed on the occupancy grid of the placed axes; one moved outside takes a round more.
|
|
357
|
+
* **Geometry.** The layout ends in a frozen geometry: every axes rectangle, tick mark,
|
|
358
|
+
text run, legend entry and colorbar in px. Drawing reads it and measures nothing: a text
|
|
359
|
+
run holds its shaped line (shaped once per content and font, memoized in the font
|
|
360
|
+
database), which is what is drawn; the figure title is laid out once as paragraphs.
|
|
361
|
+
* **One plot.** `p.save()` lays out the whole figure and keeps the plot at its size in it:
|
|
362
|
+
its axes (`align="axes"`), or its box (`"borders"`: the axes are what its own margins
|
|
363
|
+
leave), with its outer tick labels and its own row label band.
|
|
364
|
+
|
|
365
|
+
### Figure title
|
|
366
|
+
|
|
367
|
+
```python
|
|
368
|
+
fig.title(text, **settings) # None removes it
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
A band at the top of the figure: the title's height (all lines, wrapped within its
|
|
372
|
+
width) plus `pad`. The figure grows by the band, except with `reference="figure"`, where
|
|
373
|
+
the plots shrink by it. `over="axes"` aligns it within the leftmost to
|
|
374
|
+
rightmost axes (a left-aligned title starts at the first y axis line), `"figure"` within
|
|
375
|
+
the figure minus `margin`. Rich content styles a second line (`["Title\n",
|
|
376
|
+
pl.Span("subtitle", font_size=7, font_weight="normal")]`). It is drawn last and is not
|
|
377
|
+
part of `Plot.save`. `title=` given to `pl.Plot` sets the plot title. The figure's
|
|
378
|
+
`title_rule_color` draws a rule `title_rule_width` thick above the title, across its
|
|
379
|
+
width.
|
|
380
|
+
|
|
381
|
+
<!-- settings:FigureTitle -->
|
|
382
|
+
| Setting | Default | Meaning |
|
|
383
|
+
|---|---|---|
|
|
384
|
+
| `text` | — | Title text: a string or rich content; `\n` starts a line. |
|
|
385
|
+
| `font_size` | '1em' | Font size; default the base font size. Length; `%`: of the parent's font size. |
|
|
386
|
+
| `font_weight` | 'bold' | `normal`, `bold` or a weight 1–1000. |
|
|
387
|
+
| `font_style` | 'normal' | `normal`, `italic`, `oblique` or `"oblique 10deg"`. |
|
|
388
|
+
| `align` | 'center' | Alignment. |
|
|
389
|
+
| `over` | 'axes' | Width it is aligned and wrapped within: from the leftmost to the rightmost axes, or the whole figure. |
|
|
390
|
+
| `pad` | '0.5em' | Gap between the title and the plots; default half the font size. Length. |
|
|
391
|
+
| `color` | 'var(text_color)' | Text color. |
|
|
392
|
+
| `rule_gap` | '0.5em' | Gap between the title and the figure's `title_rule_color`. Length; `%`: of the font size. |
|
|
393
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
394
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
395
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
396
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
397
|
+
|
|
398
|
+
Groups: `TextStyle`, `Font`.
|
|
399
|
+
<!-- /settings -->
|
|
400
|
+
|
|
401
|
+
### Shared axes
|
|
402
|
+
|
|
403
|
+
```python
|
|
404
|
+
fig = pl.Figure(cols=3, share_x="col", share_y="row")
|
|
405
|
+
fig = pl.Figure(cols=3, share="grid") # the same
|
|
406
|
+
q = fig.plot(share_x=p) # q's x axis joins p's group
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
`share_x`, `share_y`: `False` (default), `True`/`"all"` (every plot), `"col"` (plots with
|
|
410
|
+
the same column span) or `"row"` (the same row span). `share` sets both; `"grid"` means x
|
|
411
|
+
per column and y per row. A plot's own `share_x`, `share_y` or `share` (another plot)
|
|
412
|
+
overrides the figure's groups for it; groups chain. Colorbars and plots without axes are
|
|
413
|
+
never in a group. `share_color` and `share_size` group plots the same way for their
|
|
414
|
+
series' color and size axes ([color and size axes](#6-color-and-size-axes)).
|
|
415
|
+
|
|
416
|
+
Within a group the scale (which must be equal), the limits (from all members' series,
|
|
417
|
+
then padding, `include_zero` and `snap`; one explicit `limits` applies to the group, two
|
|
418
|
+
different ones are an error), inversion, ticks and category order (first appearance, in
|
|
419
|
+
plot order) are shared; titles, grid, spines and colors stay per plot. With
|
|
420
|
+
`label_outer` (default for figure-level groups), tick labels and axis titles are drawn
|
|
421
|
+
only on the bottom plot of each column (x; top for `side="top"`) and the left plot of
|
|
422
|
+
each row (y; right for `side="right"`); ticks stay on every plot and inner gutters
|
|
423
|
+
shrink. `Plot.save` of a member keeps the group's limits and shows its labels.
|
|
424
|
+
|
|
425
|
+
### Figure axes
|
|
426
|
+
|
|
427
|
+
```python
|
|
428
|
+
fig.x_axis(label="Time (s)", tick_format="int") # every plot's x axis
|
|
429
|
+
fig.y_axis(scale="log10")
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
`fig.x_axis` and `fig.y_axis` hold settings that every plot's x (y) axis takes unless the
|
|
433
|
+
axis has its own: they come right after the axis' own values in the cascade
|
|
434
|
+
([§1](#1-conventions)), so they beat styles and defaults. Twins' axes take them too; color
|
|
435
|
+
and size axes do not.
|
|
436
|
+
|
|
437
|
+
### Rows
|
|
438
|
+
|
|
439
|
+
```python
|
|
440
|
+
p = fig.plot(y_axis={"label": "Control", "label_position": "band"}) # a row label
|
|
441
|
+
fig.group(p, q, label="Treated", letter="B") # plots p to q (creation order)
|
|
442
|
+
fig.vline(0, rows=[p, q]) # through p, q and the gap between them
|
|
443
|
+
fig.vspan(-1, 1) # under every plot
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
* **Row labels.** The y axis' `label` with `label_position` `"band"` (rotated) or
|
|
447
|
+
`"left"` (horizontal, right-aligned) sits in a band left of the plot instead of beside
|
|
448
|
+
the tick labels; `"inside"` puts it inside the axes at the top left; `\n` starts a line.
|
|
449
|
+
The band is as wide as the widest label of the plots starting in the same grid column,
|
|
450
|
+
and the labels line up at the widest y axis margin of that column. A plot has one y
|
|
451
|
+
label: beside its axis or in the band. Tracks put theirs in the band. A plot's
|
|
452
|
+
`space_above` adds space above it.
|
|
453
|
+
* **Groups.** `fig.group(first, last=None, **settings)`: plots `first` to `last` (plots
|
|
454
|
+
or their series, in creation order) with a rotated `label` and a bold panel `letter` in a
|
|
455
|
+
band left of the row labels. With a shared x axis and `label_outer`, the group's last
|
|
456
|
+
plot shows the tick labels too (the axis title stays under the bottom plot).
|
|
457
|
+
* **Lines and bands.** `fig.vline(x, rows=None)` and `fig.vspan(x0, x1, rows=None)` run
|
|
458
|
+
from the top of the first of the plots `rows` (a plot, a series, or a list; all by
|
|
459
|
+
default) to the bottom of the last one, gaps included, in each grid column; `x` is in
|
|
460
|
+
the drawn units of the first plot's x axis. Bands are drawn under the plots, lines over
|
|
461
|
+
them. `fig.vspan(region)` takes a genome region (`"chr1:1,400,001-1,450,000"`, a
|
|
462
|
+
`(chr, start, end)` tuple) as positions, less the x axis' `origin`.
|
|
463
|
+
|
|
464
|
+
FigureVLine:
|
|
465
|
+
|
|
466
|
+
<!-- settings:FigureVLine -->
|
|
467
|
+
| Setting | Default | Meaning |
|
|
468
|
+
|---|---|---|
|
|
469
|
+
| `color` | '#4d4d4d' | Line color. |
|
|
470
|
+
| `line_width` | inherited (0.75) | Line width. Length. |
|
|
471
|
+
| `line_style` | 'dashed' | `solid`, `dashed`, `dotted`, `dashdot` or a dash list. Length. |
|
|
472
|
+
| `alpha` | 1.0 | Opacity. |
|
|
473
|
+
|
|
474
|
+
Groups: `Stroke`.
|
|
475
|
+
<!-- /settings -->
|
|
476
|
+
|
|
477
|
+
FigureVSpan:
|
|
478
|
+
|
|
479
|
+
<!-- settings:FigureVSpan -->
|
|
480
|
+
| Setting | Default | Meaning |
|
|
481
|
+
|---|---|---|
|
|
482
|
+
| `color` | '#e5e5e5' | Fill color. |
|
|
483
|
+
| `alpha` | 1.0 | Opacity. |
|
|
484
|
+
<!-- /settings -->
|
|
485
|
+
|
|
486
|
+
FigureGroup:
|
|
487
|
+
|
|
488
|
+
<!-- settings:FigureGroup -->
|
|
489
|
+
| Setting | Default | Meaning |
|
|
490
|
+
|---|---|---|
|
|
491
|
+
| `label` | — | Group label, rotated, left of the plots' row labels. |
|
|
492
|
+
| `letter` | — | Panel letter at the group's top left. |
|
|
493
|
+
| `font_size` | '1em' | Font size of the label. Length; `%`: of the parent's font size. |
|
|
494
|
+
| `letter_font_size` | '1.4em' | Font size of the letter. Length; `%`: of the font size. |
|
|
495
|
+
| `letter_weight` | 'bold' | Weight of the letter. |
|
|
496
|
+
| `pad` | '0.5em' | Gap right of the group band. Length; `%`: of the font size. |
|
|
497
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
498
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
499
|
+
|
|
500
|
+
Groups: `TextStyle` (`letter_`).
|
|
501
|
+
<!-- /settings -->
|
|
502
|
+
|
|
503
|
+
### Facets
|
|
504
|
+
|
|
505
|
+
```python
|
|
506
|
+
fig, panels = pl.facet(df, col="condition", row="replicate", colorbar="right")
|
|
507
|
+
panels.scatter("x", "y", c="density") # one layer per panel, on its rows
|
|
508
|
+
panels.hline(0, line_style="dashed") # decorations on every panel
|
|
509
|
+
panels.map(lambda p, rows: p.hist(rows["x"])) # anything, per panel
|
|
510
|
+
fig.save("facets.pdf")
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
`pl.facet(data, col=None, row=None, wrap=None, share="grid", order=None,
|
|
514
|
+
title_format="{name} = {value}", colorbar=None, **figure_settings)` returns an ordinary
|
|
515
|
+
`Figure`, with one plot per combination of `row` and `col` values (first-appearance or
|
|
516
|
+
categorical order; `order={column: [values]}`) in a grid, and the `FacetSet` of those
|
|
517
|
+
panels. `wrap` wraps `col` alone into rows of that many panels. Panels are titled by
|
|
518
|
+
`title_format`.
|
|
519
|
+
|
|
520
|
+
* **Layers.** A plot type called on the set (`panels.scatter(…)`, any registered one)
|
|
521
|
+
calls it on every panel with `data=` the panel's rows and returns a `LayerSet` (a list
|
|
522
|
+
of the series; `.set(**settings)` sets them all, `.plots` their plots). Group levels
|
|
523
|
+
(`group=`) get the same colors in every panel. Decorations (`hline`, `vline`, `axline`,
|
|
524
|
+
`hspan`, `vspan`, `text`, `annotate`) go on every panel.
|
|
525
|
+
* **Shared axes** are the figure's ordinary options: `share` (default `"grid"`: x per
|
|
526
|
+
column, y per row, outer labels only), `share_color` (default `"all"`: the panels'
|
|
527
|
+
color axes train as one; a `color_map`, `color_limits` or `color_scale` given to the
|
|
528
|
+
call goes to each series alike) and `share_size` (default `"all"`: one size axis, so
|
|
529
|
+
one size key, in the top-right panel's legend).
|
|
530
|
+
* **Colorbar.** `colorbar="right"`, `"left"`, `"top"` or `"bottom"` adds a column (or a
|
|
531
|
+
row, with a horizontal bar) to the grid, holding the colorbar of the first call that maps
|
|
532
|
+
colors (`panels.colorbar`): the guide of the panels' shared color axis.
|
|
533
|
+
* `panels.panels` maps facet keys (a value, or `(row value, col value)`) to plots;
|
|
534
|
+
`panels.plot(key)` returns one; iterating the set gives the plots; `panels.subsets()`
|
|
535
|
+
gives `(key, plot, rows)`.
|
|
536
|
+
|
|
537
|
+
### Settings
|
|
538
|
+
|
|
539
|
+
<!-- settings:Figure -->
|
|
540
|
+
| Setting | Default | Meaning |
|
|
541
|
+
|---|---|---|
|
|
542
|
+
| `layout` | 'auto' | `auto`: plots in automatic rows and columns (`rows`, `cols`, `fill_order`); rows of ids (`[[1, 1, 2], [3, 4, 2]]`): each id covers a rectangle of cells, `0`/`None` leaves a cell empty; `tracks`: one column of plots top to bottom in creation order, sharing x, each row as high as its plot's `height` (tracks: from their content; other plots `1fr`). |
|
|
543
|
+
| `rows` | — | Automatic arrangement: rows. |
|
|
544
|
+
| `cols` | — | Automatic arrangement: columns. |
|
|
545
|
+
| `fill_order` | 'auto' | Fill order of the automatic arrangement: `auto` (row by row with `cols`, column by column with `rows`), `row` or `col`. |
|
|
546
|
+
| `align` | 'axes' | `axes`: axis lines line up across plots; `borders`: plot boxes line up. |
|
|
547
|
+
| `widths` | — | Column widths: ratios (numbers or `fr`) sharing the room left by fixed lengths (`"2in"`, `"30%"` of the figure width). |
|
|
548
|
+
| `heights` | — | Row heights, as `widths`. |
|
|
549
|
+
| `width` | '150px' | Width of the `reference` box: one cell's axes, one cell's plot, or the figure. Length. |
|
|
550
|
+
| `height` | 'calc(var(width) / var(aspect_ratio))' | Height of the `reference` box. Length. |
|
|
551
|
+
| `aspect_ratio` | 1.25 | Width / height of the `reference` box (16:9 → `16 / 9`), when only one of `width` and `height` is given. |
|
|
552
|
+
| `reference` | 'axes' | What `width` and `height` measure: `axes` (each grid cell's axes rectangle), `plot` (each cell's whole plot box) or `figure`. |
|
|
553
|
+
| `spacing` | 13.0 | Minimum gap between neighbouring plots. Length; `%`: of the figure width (across) or height (down). |
|
|
554
|
+
| `margin` | 5.0 | Space around the figure. Length; `%`: of the figure width (across) or height (down). |
|
|
555
|
+
| `background` | 'white' | Figure background, default white; `None` or `"none"`: transparent (white in JPEG, which has no transparency). |
|
|
556
|
+
| `dpi` | 192.0 | Resolution of PNG, JPEG, JPEG XL and AVIF output: `96` gives one image pixel per px, the default `192` two; up to 16, a multiple of 96 (`2` is 192). |
|
|
557
|
+
| `quality` | 'auto' | Quality (1–100), as vec_io's: of PNG output (a lossy palette of at most 256 colors), JPEG, JPEG XL and AVIF output, and of rasterized content in PDFs (stored as JPEG); `"lossless"` (not JPEG); `"auto"`: 90 for PNG and JPEG, lossless for JPEG XL, AVIF and PDF content. |
|
|
558
|
+
| `title_rule_color` | — | Color of a rule above the figure title, across its width (The Economist's red bar); default none. |
|
|
559
|
+
| `title_rule_width` | 4.0 | Thickness of the title rule. Length. |
|
|
560
|
+
| `share_x` | — | Plots sharing their x axis: `False`, `True`/`"all"`, `"col"` (same column span) or `"row"` (same row span). |
|
|
561
|
+
| `share_y` | — | Plots sharing their y axis, as `share_x`. |
|
|
562
|
+
| `share` | — | Both axes at once: as `share_x`, or `"grid"` (x per column, y per row); `share_x`/`share_y` override it. |
|
|
563
|
+
| `share_color` | False | Plots whose series' own color axes are one (limits over all their values), as `share_x`. |
|
|
564
|
+
| `share_size` | False | Plots whose series' own size axes are one (limits over all their values, one size key), as `share_x`. |
|
|
565
|
+
| `label_outer` | — | Tick labels and axis titles of shared axes only on the outer plots (bottom of each column, left of each row); default `True` for groups from the figure's settings, `False` for plots paired with `share_x=plot`. |
|
|
566
|
+
| `style` | — | A style name (`"ggplot2"`, …) or a dict of settings with an optional `"base"`; default: the session style (`set_style`, `use_style`), else `"default"`. |
|
|
567
|
+
| `vars` | — | Custom variables, read by `var(--name)` in any setting here and below: `{"accent": "#c00"}`. |
|
|
568
|
+
| `scaling` | 1.0 | Multiplies every font size, line width, marker size, tick length and pad of the style; default 1. |
|
|
569
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
570
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
571
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
572
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
573
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
574
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
575
|
+
| `line_width` | inherited (0.75) | Default line width. Length. |
|
|
576
|
+
| `palette` | inherited ('tab10_custom') | Colors of series without one. |
|
|
577
|
+
| `alpha` | inherited (1.0) | Default opacity of series. |
|
|
578
|
+
| `rasterize` | inherited (False) | `True` or a dpi: series drawn as images inside the PDF. |
|
|
579
|
+
| `simplify` | inherited ('auto') | vec_io's `simplify` for every series; default `"auto"`. |
|
|
580
|
+
| `data` | inherited (None) | A table whose columns the series' data arguments name. |
|
|
581
|
+
| `color_map` | inherited ('rainbow_llhh') | Default color map (alias `cmap`): of heatmaps, contours and numbers given as colors. |
|
|
582
|
+
| `decimal_separator` | inherited ('.') | Decimal separator of numbers (`"."`). |
|
|
583
|
+
| `thousands_separator` | inherited ('') | Thousands separator (`""`: none). |
|
|
584
|
+
| `minus` | inherited ('hyphen') | `hyphen` (`-`) or `minus` (U+2212, from an installed font). |
|
|
585
|
+
| `prefix` | inherited ('') | Text before every number. |
|
|
586
|
+
| `suffix` | inherited ('') | Text after every number. |
|
|
587
|
+
| `precision` | inherited (None) | Significant digits of `auto`, `sci`, `eng`, `si` (unset: as needed). |
|
|
588
|
+
|
|
589
|
+
Groups: `Stroke` (`title_rule_`), `Font`, `NumberFormat`.
|
|
590
|
+
<!-- /settings -->
|
|
591
|
+
|
|
592
|
+
## 3. Plots
|
|
593
|
+
|
|
594
|
+
```python
|
|
595
|
+
pl.Plot(figure=None, id=None, **settings) # title="…", x_axis={…}, y_axis={…}
|
|
596
|
+
p.scatter(x, y, **s) p.line(x, y=None, **s) p.fill(x, y1, y2=0, **s)
|
|
597
|
+
p.box(values, **s) p.heatmap(values, **s) p.colorbar(source=None, **s)
|
|
598
|
+
p.title(text, **s) p.x_axis(label, **s) p.y_axis(label, **s) p.legend(position, **s)
|
|
599
|
+
p.series p.colorbars p.figure p.id
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
`p.title`, `p.x_axis`, `p.y_axis` and `p.legend` are objects; calling one sets its
|
|
603
|
+
settings and returns it. At creation (and in `p.set`), `title=` sets the title text and
|
|
604
|
+
`x_axis={…}`, `y_axis={…}` set the axes' settings: `pl.Scatter(x, y, x_axis={"scale":
|
|
605
|
+
"log"})`, `fig.bigwig(reader, y_axis={"label": "ATAC"})`. Series are drawn in `z` order (default: call order) inside the
|
|
606
|
+
axes clip.
|
|
607
|
+
|
|
608
|
+
<!-- settings:Plot -->
|
|
609
|
+
| Setting | Default | Meaning |
|
|
610
|
+
|---|---|---|
|
|
611
|
+
| `spines` | 'bottom left' | Axis lines drawn: any of `left`, `bottom`, `right`, `top`, or `all`, `none`. |
|
|
612
|
+
| `data_ratio` | — | Data aspect ratio: 1 makes one unit as long on both axes. |
|
|
613
|
+
| `background` | — | Background color of the axes area. |
|
|
614
|
+
| `border_color` | — | Color of a frame around the axes area (drawn under the axis lines); default none. |
|
|
615
|
+
| `border_width` | 0.75 | Width of the frame. Length. |
|
|
616
|
+
| `clip` | True | Clip series to the axes area. |
|
|
617
|
+
| `axes` | True | Draw axes; `False` hides both axes, drops padding and fixes the aspect to 1 (set by pie charts). |
|
|
618
|
+
| `share_x` | — | Another plot of the figure whose x axis this plot shares (groups chain); overrides the figure's `share_x`. |
|
|
619
|
+
| `share_y` | — | Another plot whose y axis this plot shares. |
|
|
620
|
+
| `vars` | — | Custom variables, read by `var(--name)` in any setting here and below: `{"accent": "#c00"}`. |
|
|
621
|
+
| `share` | — | Another plot whose x and y axes this plot shares. |
|
|
622
|
+
| `space_above` | 0.0 | Space above the plot, beyond the figure's `spacing`. Length; `%`: of the font size. |
|
|
623
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
624
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
625
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
626
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
627
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
628
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
629
|
+
| `line_width` | inherited (0.75) | Default line width. Length. |
|
|
630
|
+
| `palette` | inherited ('tab10_custom') | Colors of series without one. |
|
|
631
|
+
| `alpha` | inherited (1.0) | Default opacity of series. |
|
|
632
|
+
| `rasterize` | inherited (False) | `True` or a dpi: series drawn as images inside the PDF. |
|
|
633
|
+
| `simplify` | inherited ('auto') | vec_io's `simplify` for every series: `"auto"`, `True`, a dpi or `False`. |
|
|
634
|
+
| `color_map` | inherited ('rainbow_llhh') | Default color map (alias `cmap`): of heatmaps, contours and numbers given as colors. |
|
|
635
|
+
| `data` | inherited (None) | A table (dict, pandas or polars data frame, numpy structured array): strings in the data arguments of series name its columns. |
|
|
636
|
+
| `decimal_separator` | inherited ('.') | Decimal separator of numbers (`"."`). |
|
|
637
|
+
| `thousands_separator` | inherited ('') | Thousands separator (`""`: none). |
|
|
638
|
+
| `minus` | inherited ('hyphen') | `hyphen` (`-`) or `minus` (U+2212, from an installed font). |
|
|
639
|
+
| `prefix` | inherited ('') | Text before every number. |
|
|
640
|
+
| `suffix` | inherited ('') | Text after every number. |
|
|
641
|
+
| `precision` | inherited (None) | Significant digits of `auto`, `sci`, `eng`, `si` (unset: as needed). |
|
|
642
|
+
|
|
643
|
+
Groups: `Stroke` (`border_`), `Font`, `NumberFormat`.
|
|
644
|
+
<!-- /settings -->
|
|
645
|
+
|
|
646
|
+
### Title
|
|
647
|
+
|
|
648
|
+
<!-- settings:Title -->
|
|
649
|
+
| Setting | Default | Meaning |
|
|
650
|
+
|---|---|---|
|
|
651
|
+
| `text` | — | Title text: a string or rich content. |
|
|
652
|
+
| `font_size` | '1em' | Font size; default the base font size. Length; `%`: of the parent's font size. |
|
|
653
|
+
| `font_weight` | 'normal' | `normal`, `bold` or a weight 1–1000. |
|
|
654
|
+
| `font_style` | 'normal' | `normal`, `italic`, `oblique` or `"oblique 10deg"`. |
|
|
655
|
+
| `color` | 'var(text_color)' | Text color. |
|
|
656
|
+
| `align` | 'center' | Alignment over the axes. |
|
|
657
|
+
| `pad` | 5.0 | Gap above the axes. Length; `%`: of the axes height. |
|
|
658
|
+
| `over` | 'axes' | Width the title is aligned within: the axes, or the axes and the y axis labels. |
|
|
659
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
660
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
661
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
662
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
663
|
+
|
|
664
|
+
Groups: `TextStyle`, `Font`.
|
|
665
|
+
<!-- /settings -->
|
|
666
|
+
|
|
667
|
+
### Legend
|
|
668
|
+
|
|
669
|
+
One entry per series with a `name`, drawn as the series draws itself (marker, line,
|
|
670
|
+
swatch or box), or with `glyph="box"`, `"circle"` or `"line"` in the series color. At
|
|
671
|
+
`top`, `bottom`, `outside_top` and `outside_bottom` entries are side by side unless
|
|
672
|
+
`orientation` or `columns` is set.
|
|
673
|
+
|
|
674
|
+
**Size keys.** A series whose `size` goes through a [size axis](#6-color-and-size-axes)
|
|
675
|
+
adds a size key, the axis' guide, to its plot's legend, below the series entries: the
|
|
676
|
+
axis' `label` (default: the `size` column name) as a header, then sample markers at their
|
|
677
|
+
real size with their values (the list given as the series' `size_legend`, else the axis'
|
|
678
|
+
`ticks`, else 3–5 nice numbers inside its limits; in its `tick_format`;
|
|
679
|
+
`size_legend=False` drops it). Series sharing one size axis (one `fig.size_axis()`, or own
|
|
680
|
+
axes trained as one by `share_size` or `group=`) share one key, in grey, also across
|
|
681
|
+
plots. The key goes in the legend of the rightmost of their plots, and the topmost of
|
|
682
|
+
those, so it sits at the figure's top right. Users with different `size_map`s get a key
|
|
683
|
+
per map. A single series' key takes its color (grey when its colors are mapped).
|
|
684
|
+
`fig.size_legend(source, id=…, values=None, title=None)` places the key of a size axis
|
|
685
|
+
(or of a series' one) in its own grid area, as colorbars do. It shows every series of
|
|
686
|
+
that axis, and no plot legend repeats it.
|
|
687
|
+
|
|
688
|
+
`auto` chooses a position once the axes are placed. Every series marks what it draws on a
|
|
689
|
+
64 × 64 grid over the axes: markers (with their size), lines and curves (along their
|
|
690
|
+
whole length), bars, histogram bins, boxes, violins, areas and fills (the area they cover),
|
|
691
|
+
heatmaps, 2-D histograms and contours (the whole axes). Data are sampled beyond 50,000
|
|
692
|
+
points and curves thinned to 4,096 vertices (twin plots' series included). The legend
|
|
693
|
+
goes to the first of `top_right`, `top_left`, `bottom_left`, `bottom_right`, `top`,
|
|
694
|
+
`bottom`, `center_right`, `center_left` whose box covers no marked cell; else to the free
|
|
695
|
+
place (any position inside, one grid cell apart, covering no marked cell) nearest to a
|
|
696
|
+
corner of the axes; else `outside_right`, with room made in the layout, when every
|
|
697
|
+
candidate covers more than 2 % marked cells; else the candidate covering the fewest.
|
|
698
|
+
|
|
699
|
+
<!-- settings:Legend -->
|
|
700
|
+
| Setting | Default | Meaning |
|
|
701
|
+
|---|---|---|
|
|
702
|
+
| `position` | 'auto' | `auto`, `top_right`, `top_left`, `bottom_right`, `bottom_left`, `top`, `bottom`, `outside_right`, `outside_top`, `outside_bottom` or `none`. |
|
|
703
|
+
| `columns` | 1 | Number of columns. |
|
|
704
|
+
| `frame` | False | Draw a frame and background. |
|
|
705
|
+
| `title` | 'auto' | Legend title; `"auto"`: the `group` column name, if any. |
|
|
706
|
+
| `font_size` | '1em' | Font size. Length; `%`: of the parent's font size. |
|
|
707
|
+
| `color` | 'var(text_color)' | Text color. |
|
|
708
|
+
| `background` | 'white' | Background of a framed legend. |
|
|
709
|
+
| `frame_color` | '#999999' | Frame color. |
|
|
710
|
+
| `frame_width` | 0.5 | Frame line width. Length. |
|
|
711
|
+
| `pad` | 5.0 | Gap to the axes. Length; `%`: of the axes width (across) or height (down). |
|
|
712
|
+
| `frame_radius` | 0.0 | Corner radius of the frame. Length. |
|
|
713
|
+
| `frame_alpha` | 1.0 | Opacity of the frame and background. |
|
|
714
|
+
| `glyph_alpha` | — | Fill opacity of `box` and `circle` symbols, outlined in the opaque color; default: the series' own fill. |
|
|
715
|
+
| `glyph` | 'series' | Entry symbol: as the series draws itself, or a filled `box`, a `circle` or a `line` in the series color. |
|
|
716
|
+
| `orientation` | 'auto' | `horizontal`: entries side by side; `auto`: horizontal at `top`, `bottom`, `outside_top` and `outside_bottom`. |
|
|
717
|
+
| `glyph_length` | '1.4em' | Width of an entry's symbol. Length; `%`: of the font size. |
|
|
718
|
+
| `row_height` | '1.35em' | Height of an entry. Length; `%`: of the font size. |
|
|
719
|
+
| `glyph_gap` | '0.5em' | Gap between a symbol and its text. Length; `%`: of the font size. |
|
|
720
|
+
| `column_gap` | '1em' | Gap between columns. Length; `%`: of the font size. |
|
|
721
|
+
| `title_gap` | '0.3em' | Gap below the title. Length; `%`: of the font size. |
|
|
722
|
+
| `inner_pad` | 'auto' | Space inside the box; `"auto"`: 0.5em with a frame, 0.15em without. Length; `%`: of the font size. |
|
|
723
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
724
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
725
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
726
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
727
|
+
|
|
728
|
+
Groups: `TextStyle`, `Stroke` (`frame_`), `Font`.
|
|
729
|
+
<!-- /settings -->
|
|
730
|
+
|
|
731
|
+
### Decorations
|
|
732
|
+
|
|
733
|
+
Reference lines, bands, text and annotations. They take no palette color, are in the
|
|
734
|
+
legend only with a `name`, and change the limits only with `extend_limits=True`. They
|
|
735
|
+
are drawn among the series by `z`: spans under the series (`z=-1`), lines and text over
|
|
736
|
+
them (`z=1`).
|
|
737
|
+
|
|
738
|
+
```python
|
|
739
|
+
p.hline(y, min="0%", max="100%", color="#4d4d4d", line_style="solid", ...) # min/max: data values or % of the axes
|
|
740
|
+
p.vline(x, ...)
|
|
741
|
+
p.axline((x0, y0), slope=None, point2=None, ...) # slope: linear axes only
|
|
742
|
+
p.hspan(y0, y1, color="#e5e5e5", ...); p.vspan(x0, x1, ...)
|
|
743
|
+
p.text(x, y, content, align="left", valign="baseline", rotation=0, coords="data", ...)
|
|
744
|
+
p.annotate(content, xy, xytext=None, text_coords=None, arrow_style="->", ...)
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
Positions are data values (category names on category axes), or fractions with
|
|
748
|
+
`coords="axes"` or `"figure"`. `text_coords="offset"` gives `xytext` in points from `xy`
|
|
749
|
+
(y up). Text is a string or rich content. Arrows run from the edge of the text box to
|
|
750
|
+
`xy`, `shrink` points short of both.
|
|
751
|
+
|
|
752
|
+
HLine:
|
|
753
|
+
|
|
754
|
+
<!-- settings:HLine -->
|
|
755
|
+
| Setting | Default | Meaning |
|
|
756
|
+
|---|---|---|
|
|
757
|
+
| `color` | '#4d4d4d' | Line color. |
|
|
758
|
+
| `line_width` | inherited (0.75) | Line width. Length. |
|
|
759
|
+
| `line_style` | 'solid' | `solid`, `dashed`, `dotted`, `dashdot` or a dash list. Length. |
|
|
760
|
+
| `min` | '0%' | Start: a data value, or `%` (or a length) from the start of the axes. Length; `%`: of the axes length along the axis; bare numbers: data units. |
|
|
761
|
+
| `max` | '100%' | End: a data value, or `%` (or a length) from the start of the axes. Length; `%`: of the axes length along the axis; bare numbers: data units. |
|
|
762
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
763
|
+
| `alpha` | 1.0 | Opacity. |
|
|
764
|
+
| `z` | 1.0 | Drawing order among the series (default 0). |
|
|
765
|
+
| `extend_limits` | False | Include the decoration in the axis limits. |
|
|
766
|
+
| `clip` | True | Clip to the axes area. |
|
|
767
|
+
|
|
768
|
+
Groups: `Stroke`.
|
|
769
|
+
<!-- /settings -->
|
|
770
|
+
|
|
771
|
+
AxLine:
|
|
772
|
+
|
|
773
|
+
<!-- settings:AxLine -->
|
|
774
|
+
| Setting | Default | Meaning |
|
|
775
|
+
|---|---|---|
|
|
776
|
+
| `color` | '#4d4d4d' | Line color. |
|
|
777
|
+
| `line_width` | inherited (0.75) | Line width. Length. |
|
|
778
|
+
| `line_style` | 'solid' | `solid`, `dashed`, `dotted`, `dashdot` or a dash list. Length. |
|
|
779
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
780
|
+
| `alpha` | 1.0 | Opacity. |
|
|
781
|
+
| `z` | 1.0 | Drawing order among the series (default 0). |
|
|
782
|
+
| `extend_limits` | False | Include the decoration in the axis limits. |
|
|
783
|
+
| `clip` | True | Clip to the axes area. |
|
|
784
|
+
|
|
785
|
+
Groups: `Stroke`.
|
|
786
|
+
<!-- /settings -->
|
|
787
|
+
|
|
788
|
+
HSpan:
|
|
789
|
+
|
|
790
|
+
<!-- settings:HSpan -->
|
|
791
|
+
| Setting | Default | Meaning |
|
|
792
|
+
|---|---|---|
|
|
793
|
+
| `color` | '#e5e5e5' | Fill color. |
|
|
794
|
+
| `edge_color` | — | Outline color; default none. |
|
|
795
|
+
| `edge_width` | 0.0 | Outline width. Length. |
|
|
796
|
+
| `min` | '0%' | Start: a data value, or `%` (or a length) from the start of the axes. Length; `%`: of the axes length along the axis; bare numbers: data units. |
|
|
797
|
+
| `max` | '100%' | End: a data value, or `%` (or a length) from the start of the axes. Length; `%`: of the axes length along the axis; bare numbers: data units. |
|
|
798
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
799
|
+
| `alpha` | 1.0 | Opacity. |
|
|
800
|
+
| `z` | -1.0 | Drawing order among the series (default 0). |
|
|
801
|
+
| `extend_limits` | False | Include the decoration in the axis limits. |
|
|
802
|
+
| `clip` | True | Clip to the axes area. |
|
|
803
|
+
|
|
804
|
+
Groups: `Stroke` (`edge_`).
|
|
805
|
+
<!-- /settings -->
|
|
806
|
+
|
|
807
|
+
Text:
|
|
808
|
+
|
|
809
|
+
<!-- settings:Text -->
|
|
810
|
+
| Setting | Default | Meaning |
|
|
811
|
+
|---|---|---|
|
|
812
|
+
| `align` | 'left' | Horizontal alignment on the point. |
|
|
813
|
+
| `valign` | 'baseline' | Vertical alignment on the point. |
|
|
814
|
+
| `rotation` | 0.0 | Rotation (degrees, counterclockwise). Angle (bare: degrees). |
|
|
815
|
+
| `coords` | 'data' | `data`, `axes` (0–1) or `figure` (0–1). |
|
|
816
|
+
| `color` | 'var(text_color)' | Text color; default `text_color`. |
|
|
817
|
+
| `font_size` | inherited (11.0) | Font size. Length; `%`: of the parent's font size. |
|
|
818
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
819
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
820
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
821
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
822
|
+
| `font_weight` | 'normal' | `normal`, `bold` or a weight 1–1000. |
|
|
823
|
+
| `font_style` | 'normal' | `normal`, `italic`, `oblique` or `"oblique 10deg"`. |
|
|
824
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
825
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
826
|
+
| `alpha` | 1.0 | Opacity. |
|
|
827
|
+
| `z` | 1.0 | Drawing order among the series (default 0). |
|
|
828
|
+
| `extend_limits` | False | Include the decoration in the axis limits. |
|
|
829
|
+
| `clip` | False | Clip to the axes area. |
|
|
830
|
+
|
|
831
|
+
Groups: `TextStyle`, `Font`.
|
|
832
|
+
<!-- /settings -->
|
|
833
|
+
|
|
834
|
+
Annotate:
|
|
835
|
+
|
|
836
|
+
<!-- settings:Annotate -->
|
|
837
|
+
| Setting | Default | Meaning |
|
|
838
|
+
|---|---|---|
|
|
839
|
+
| `align` | 'center' | Horizontal alignment on `xytext`. |
|
|
840
|
+
| `valign` | 'center' | Vertical alignment on `xytext`. |
|
|
841
|
+
| `text_coords` | 'var(coords)' | Coordinates of `xytext`: as `coords`, or `offset` (px from `xy`, y up); default `coords`. |
|
|
842
|
+
| `arrow` | True | Draw an arrow from the text to `xy`. |
|
|
843
|
+
| `arrow_style` | '->' | `->` (open head), `-\|>` (filled head) or `-` (no head). |
|
|
844
|
+
| `arrow_color` | 'var(color)' | Arrow color; default the text color. |
|
|
845
|
+
| `arrow_width` | 0.75 | Arrow line width. Length. |
|
|
846
|
+
| `head_length` | 7.0 | Arrowhead length. Length. |
|
|
847
|
+
| `shrink` | 3.0 | Gap left at both ends of the arrow. Length. |
|
|
848
|
+
|
|
849
|
+
Groups: `Stroke` (`arrow_`).
|
|
850
|
+
<!-- /settings -->
|
|
851
|
+
|
|
852
|
+
## 4. Axes
|
|
853
|
+
|
|
854
|
+
### Scales
|
|
855
|
+
|
|
856
|
+
| `scale` | Position | Domain |
|
|
857
|
+
|---|---|---|
|
|
858
|
+
| `linear` | v | all |
|
|
859
|
+
| `log`, `log2`, `log10` | ln v, log₂ v, log₁₀ v | v > 0 |
|
|
860
|
+
| `sqrt` | √v | v ≥ 0 |
|
|
861
|
+
| `exp` | eᵛ | v < 709 |
|
|
862
|
+
| `symlog` | sign(v)·log₁₀(1 + abs(v)/`linthresh`) | all |
|
|
863
|
+
| `logit` | log₁₀(p/(1 − p)) | 0 < p < 1 |
|
|
864
|
+
| `time` | seconds since 1970-01-01 UTC | dates and times |
|
|
865
|
+
| `category` | category index | categories |
|
|
866
|
+
| `genome` | position in bp (less the axis' `origin`) | the axis' `region` |
|
|
867
|
+
|
|
868
|
+
The genome scale is linear, its limits the axis' `region` without padding, its tick labels
|
|
869
|
+
in `unit` (bp, kb or Mb; `unit_in` puts the unit in the label or after each tick label),
|
|
870
|
+
its automatic label the chromosome; genome series set it on an x axis without a scale
|
|
871
|
+
([§9](#9-genome-tracks)).
|
|
872
|
+
|
|
873
|
+
Values outside the domain are missing on that axis. The three logs place data
|
|
874
|
+
identically; they differ in their ticks. Box and heatmap series with labels make their
|
|
875
|
+
axis a category axis; mixing category and numeric series on one axis raises `ValueError`.
|
|
876
|
+
`symlog` ticks: 0, ±`linthresh`, then decades. Inside the linear region (`linthresh`,
|
|
877
|
+
default 1), minor ticks sit at the finest step of `linthresh`/10, /5, /4 or /2 that keeps
|
|
878
|
+
them as far apart as minor ticks 4 and 5 of a log decade, or are left out. `logit` ticks: 0.5, then 0.1/0.9, 0.01/0.99, …
|
|
879
|
+
|
|
880
|
+
### Dates and times
|
|
881
|
+
|
|
882
|
+
`datetime`, `date`, numpy `datetime64` arrays and pandas timestamps given as x or y make a
|
|
883
|
+
`time` axis (also bar positions; bar `width` takes a `timedelta`). Values become seconds
|
|
884
|
+
since the epoch (naive ones read as UTC); aware ones are shown in their zone (`tz`, default
|
|
885
|
+
the zone of the first value). Ticks follow the calendar: years (1, 2, 5, 10, …), months
|
|
886
|
+
(1, 2, 3, 6), days (1, 2, 7, 14), hours (1, 2, 3, 6, 12), minutes, seconds and fractions,
|
|
887
|
+
chosen from the span and `max_ticks`. Labels are concise (`2026`, `Mar`, `Mar 14`,
|
|
888
|
+
`14:30`, `14:30:15`, `15.250`), with January labelled by its year, and the larger unit
|
|
889
|
+
common to every tick written at the end of the axis, as the ×10ᵏ factor is
|
|
890
|
+
(`2026`, `Mar 14, 2026`).
|
|
891
|
+
`tick_format` takes a `strftime` pattern (`"%Y-%m"`) or a function of a `datetime`.
|
|
892
|
+
`limits` take dates and ISO strings (`("2026-01-01", None)`, `"2026-01-01/max"`).
|
|
893
|
+
|
|
894
|
+
### Secondary axes
|
|
895
|
+
|
|
896
|
+
```python
|
|
897
|
+
p2 = p.twin_y() # its own y axis on the right, p's x axis
|
|
898
|
+
p2.line(t, temperature)
|
|
899
|
+
p2.y_axis(label="Temperature (°C)", scale="log10")
|
|
900
|
+
```
|
|
901
|
+
|
|
902
|
+
`twin_y()` returns a plot drawn on `p`'s axes rectangle, sharing its x axis (limits from
|
|
903
|
+
the series of both) with its own y axis on the right; `twin_x()` does the same for x (on
|
|
904
|
+
top). The twin's axis adds margin on its side, and outside legends and colorbars move
|
|
905
|
+
beyond it. Its series continue `p`'s palette and appear in `p`'s legend unless the twin's
|
|
906
|
+
legend position is set. Background, title, frame and grid belong to `p` (a twin draws a
|
|
907
|
+
grid only when its axis asks). `p.save` includes its twins.
|
|
908
|
+
|
|
909
|
+
### Limits
|
|
910
|
+
|
|
911
|
+
* `"auto"`: the union of the series' extents plus `padding` (0.05 of the range per side,
|
|
912
|
+
in position space: a factor on log axes; heatmaps take none).
|
|
913
|
+
* `"lo/hi"`: each side `min`, `max`, a number or `q:F` (quantile F of the axis's values):
|
|
914
|
+
`"0/max"`, `"q:0.01/q:0.99"`. Or `(lo, hi)`, `None` meaning automatic.
|
|
915
|
+
* A single value is widened by ±0.5 in position space. `invert=True` reverses the axis.
|
|
916
|
+
* `include_zero=True` extends automatic limits to 0 (linear and sqrt axes) before padding
|
|
917
|
+
and `snap`; `"auto"` does so where a series on the axis asks for it, following
|
|
918
|
+
Vega-Lite's default: both axes of scatter plots, the value axis of lines, areas and
|
|
919
|
+
boxes, never category axes or heatmaps.
|
|
920
|
+
* `snap` moves automatic limits (after padding) onto major ticks, on linear and log
|
|
921
|
+
axes; given limits stay. The default `("4%", "8%")` (`(back, out)`, `%` of the axis
|
|
922
|
+
length or px) extends a limit out to the next tick when it is within 8% of the axis,
|
|
923
|
+
or pulls it back to a tick it passed by at most 4% when that tick is still outside the
|
|
924
|
+
data; other limits stay as padded. `True` always extends to the enclosing ticks, as
|
|
925
|
+
MATLAB and Vega-Lite do; `False` leaves the padded limits.
|
|
926
|
+
|
|
927
|
+
### Ticks
|
|
928
|
+
|
|
929
|
+
* **linear:** steps 1, 2, 2.5 or 5 × 10ᵏ, at most `max_ticks` (default: axis length ÷
|
|
930
|
+
3.5 font sizes on x, 2.5 on y, at most 10); on x the step grows until labels do not
|
|
931
|
+
overlap.
|
|
932
|
+
* **log10:** decades labelled 10ᵏ, thinned to `max_ticks`, minor ticks 2–9. Below three
|
|
933
|
+
decades, 1, 2 and 5 × 10ᵏ, labelled as numbers.
|
|
934
|
+
* **log2:** powers of two, labelled as numbers from 2⁻¹⁰ to 2¹⁰, else 2ᵏ; thinned to every
|
|
935
|
+
2nd, 4th, … power. **log:** powers of e labelled eᵏ.
|
|
936
|
+
* **sqrt, exp:** round values thinned so that neighbours are a tick spacing apart on the
|
|
937
|
+
page, walking from the end the scale stretches.
|
|
938
|
+
* **category:** one tick per category; labels turn 45° when they overlap
|
|
939
|
+
(`tick_rotation="auto"`), and every k-th is kept when even that does not fit.
|
|
940
|
+
* Labels of an axis share the fewest decimals that tell them apart. Beyond
|
|
941
|
+
10^`sci_limits` they are mantissas, and ×10ᵏ is written at the end of the axis:
|
|
942
|
+
above the top of a y axis, at the right end of an x axis (on the title's row).
|
|
943
|
+
* `ticks=[…]`, `tick_labels=[…]`, `minor_ticks=True|[…]`, `ticks=False`.
|
|
944
|
+
* `tick_format` takes any [number format](#number-formats); the default `"auto"` is the
|
|
945
|
+
rule above.
|
|
946
|
+
|
|
947
|
+
Category axes of heatmaps draw labels only (no axis line or ticks) unless `tick_length`
|
|
948
|
+
or the plot's `spines` is set.
|
|
949
|
+
|
|
950
|
+
* **Grid lines:** `grid` at the major ticks, `minor_grid` at the minor ticks (or halfway
|
|
951
|
+
between major ticks on linear axes without minor ticks), and `zero_line` at 0 (when 0
|
|
952
|
+
is within the limits), under the series.
|
|
953
|
+
* **Sides:** `side="top"` (x) or `"right"` (y) moves the ticks, labels and axis line
|
|
954
|
+
(`spines` is mirrored with them).
|
|
955
|
+
* **Axis lines:** `mirror` repeats the ticks on the opposite side; `spine_offset` moves
|
|
956
|
+
the axis line, its ticks and labels away from the axes; `spine_trim` draws the line from
|
|
957
|
+
the first to the last major tick. `color` sets the default of `line_color`,
|
|
958
|
+
`tick_color`, `tick_label_color` and `label_color`.
|
|
959
|
+
|
|
960
|
+
<!-- settings:Axis -->
|
|
961
|
+
| Setting | Default | Meaning |
|
|
962
|
+
|---|---|---|
|
|
963
|
+
| `label` | — | Axis title: a string or rich content; `\n` starts a line in a row band. |
|
|
964
|
+
| `label_position` | 'axis' | Where the label of a plot's y axis goes: `axis` (beside the tick labels); in a band left of the plot, lined up with the labels of the other plots of its grid column (row labels): `band` (rotated) or `left` (horizontal, right-aligned); `inside` (top left inside the axes). |
|
|
965
|
+
| `label_font_size` | '1em' | Font size of the label; default: the base font size. Length; `%`: of the font size. |
|
|
966
|
+
| `label_weight` | 'normal' | Axis title weight: `normal`, `bold` or 1–1000. |
|
|
967
|
+
| `label_style` | 'normal' | Axis title style: `normal`, `italic`, `oblique` or `"oblique 10deg"`. |
|
|
968
|
+
| `label_color` | 'var(color)' | Axis title color. |
|
|
969
|
+
| `scale` | — | `linear`, `log`, `log2`, `log10`, `sqrt`, `exp`, `symlog`, `logit`, `time`, `category` or `genome`; default: `category` for categorical series, `time` for dates, `genome` for genome series, else `linear`. |
|
|
970
|
+
| `region` | — | Genome scale: the region drawn, its limits: `"chr2:143,120,001-143,780,000"` (1-based, inclusive), `(chr, start, end)` (0-based, half-open) or a mapping; genome series read it. |
|
|
971
|
+
| `unit` | 'auto' | Genome scale: unit of the tick labels; `auto`: with ticks about a fifth of the span apart, the largest unit in which they are at least 1 apart and at most 1000, else the largest in which they are at most 1000 with at most 3 decimals, else bp. |
|
|
972
|
+
| `unit_in` | 'label' | Genome scale: where the unit is written, in the axis label (`chr2 (Mb)`) or after each tick label (`500kb`). |
|
|
973
|
+
| `origin` | — | The value drawn at 0 for the axis' series (a series' own `x_origin` wins): a number, or `"center"`, `"start"`, `"end"` of the region (genome scale), else of each series' range. Values are drawn at `(v − origin) × x_scale`; limits, ticks and decorations are in the drawn units. |
|
|
974
|
+
| `linthresh` | 1.0 | Half-width of the linear region of a `symlog` axis. |
|
|
975
|
+
| `tz` | — | Time zone of a time axis (a `tzinfo`); default: the zone of the first aware date, else naive (UTC). |
|
|
976
|
+
| `limits` | 'auto' | `"auto"`, `"lo/hi"` or `[lo, hi]` (a tuple too); each side a number, `"min"`, `"max"`, `"q:F"` (a quantile), a date, or `"auto"`/`None`: `"0/max"` is `[0, "max"]`. |
|
|
977
|
+
| `padding` | 'auto' | Space added to automatic limits, as a fraction of the range; `"auto"`: `auto_padding`, or 0 on axes of series drawn to exact limits (box value axes, heatmaps, …) and in plots without axes. Length; `%`: of the axis range. |
|
|
978
|
+
| `auto_padding` | '5%' | The fraction `padding="auto"` adds on each side. Length; `%`: of the axis range. |
|
|
979
|
+
| `sticky` | True | No padding past the baseline of bars and histograms when an automatic limit is on it (matplotlib's sticky edges). |
|
|
980
|
+
| `invert` | False | Reverse the axis. |
|
|
981
|
+
| `ticks` | — | `False` (no ticks) or a list of tick values. |
|
|
982
|
+
| `tick_labels` | — | Labels of `ticks`. |
|
|
983
|
+
| `minor_ticks` | — | `True`, `False` or a list of values; default: on for log10. |
|
|
984
|
+
| `tick_format` | 'auto' | Number format: `auto`, `percent`, `sci`, `eng`, `si`, `int`, a format string or a function; on a genome axis also `chr:pos` (`chr2:143,250,000`). |
|
|
985
|
+
| `tick_rotation` | 'auto' | Label rotation in degrees, or `"auto"` (45° when category labels overlap). Angle (bare: degrees). |
|
|
986
|
+
| `max_ticks` | 'auto' | Most major ticks; `"auto"`: one per `tick_spacing` of axis length, at least 2, at most `auto_max_ticks`. |
|
|
987
|
+
| `tick_spacing` | ('3em', '2em') | Space per automatic tick, in tick label font sizes, on horizontal and vertical axes. Length; `em` and `%`: of `tick_label_font_size`. |
|
|
988
|
+
| `time_tick_spacing` | ('5em', '2.5em') | `tick_spacing` of time axes. Length; `em` and `%`: of `tick_label_font_size`. |
|
|
989
|
+
| `tick_label_gap` | '0.6em' | Smallest gap between neighbouring tick labels side by side: fewer numeric ticks, or category labels rotated and thinned out, below it. Length; `em` and `%`: of `tick_label_font_size`. |
|
|
990
|
+
| `category_label_spacing` | ('1.6em', '1.3em') | Distance between category labels: rotated (horizontal axes) and stacked (vertical axes); labels closer than it are thinned out. Length; `em` and `%`: of `tick_label_font_size`. |
|
|
991
|
+
| `auto_max_ticks` | (10, 8) | Most automatic ticks on numeric and time axes. |
|
|
992
|
+
| `sci_limits` | (-4, 5) | Exponents beyond which labels become mantissas × 10ᵏ. |
|
|
993
|
+
| `tick_length` | 5.0 | Tick length. Length; `%`: of the axes side across the axis. |
|
|
994
|
+
| `minor_tick_length` | '60%' | Minor tick length; default 0.6 × `tick_length`. Length; `%`: of `tick_length`. |
|
|
995
|
+
| `tick_direction` | 'out' | `out`, `in` or `both`. |
|
|
996
|
+
| `tick_color` | 'var(color)' | Tick color. |
|
|
997
|
+
| `tick_width` | 0.75 | Tick line width. Length. |
|
|
998
|
+
| `tick_label_font_size` | '1em' | Font size of tick labels. Length; `%`: of the font size. |
|
|
999
|
+
| `tick_label_weight` | 'normal' | Tick label weight: `normal`, `bold` or 1–1000. |
|
|
1000
|
+
| `tick_label_color` | 'var(color)' | Tick label color. |
|
|
1001
|
+
| `tick_pad` | 3.0 | Gap between ticks and labels. Length; `%`: of the axes side across the axis. |
|
|
1002
|
+
| `label_pad` | 4.0 | Gap between tick labels and the label. Length; `%`: of the axes side across the axis. |
|
|
1003
|
+
| `color` | 'var(text_color)' | Color of the axis line, ticks and labels (the default of `line_color`, `tick_color`, `tick_label_color`, `label_color`). |
|
|
1004
|
+
| `line_color` | 'var(color)' | Axis line color. |
|
|
1005
|
+
| `line_width` | 0.75 | Axis line width. Length. |
|
|
1006
|
+
| `side` | x: 'bottom' / y: 'left' | Where the ticks, labels and axis line go: `bottom` or `top` (x axis), `left` or `right` (y axis). |
|
|
1007
|
+
| `mirror` | False | Ticks also on the opposite side of the axes. |
|
|
1008
|
+
| `spine_offset` | 0.0 | Distance the axis line (with its ticks and labels) is moved away from the axes. Length; `%`: of the axes side across the axis. |
|
|
1009
|
+
| `spine_trim` | False | Axis line from the first to the last major tick only. |
|
|
1010
|
+
| `include_zero` | False | Extend automatic limits to 0 (linear and sqrt scales), before padding and `snap`: `True`, or `"auto"` where a series on the axis asks for it (Vega-Lite's rule: scatter axes, the value axis of lines, areas and boxes). |
|
|
1011
|
+
| `zero_line` | False | A line across the plot at 0. |
|
|
1012
|
+
| `zero_line_color` | 'var(line_color)' | Zero line color; default `line_color`. |
|
|
1013
|
+
| `zero_line_width` | 'var(line_width)' | Zero line width; default `line_width`. Length. |
|
|
1014
|
+
| `snap` | ('4%', '8%') | Automatic limits on major ticks (linear and log scales): `True`, out to the enclosing ticks; `(back, out)`, out to a tick within `out` (`%` of the axis), or back to one within `back` that is still outside the data; `False`: as padded. Length; `%`: of the axis range. |
|
|
1015
|
+
| `grid` | False | Major grid lines across the plot. |
|
|
1016
|
+
| `grid_color` | '#dddddd' | Grid line color. |
|
|
1017
|
+
| `grid_width` | 0.5 | Grid line width. Length. |
|
|
1018
|
+
| `grid_style` | 'solid' | Grid line style or dash list. Length. |
|
|
1019
|
+
| `minor_grid` | False | Minor grid lines: at the minor ticks, or halfway between major ticks on linear axes without minor ticks. |
|
|
1020
|
+
| `minor_grid_color` | 'var(grid_color)' | Minor grid color; default `grid_color`. |
|
|
1021
|
+
| `minor_grid_width` | '50%' | Minor grid width; default half `grid_width`. Length; `%`: of `grid_width`. |
|
|
1022
|
+
| `minor_grid_style` | 'var(grid_style)' | Minor grid style; default `grid_style`. Length. |
|
|
1023
|
+
| `visible` | True | Draw the axis (ticks, labels). |
|
|
1024
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1025
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1026
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1027
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1028
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1029
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1030
|
+
| `decimal_separator` | inherited ('.') | Decimal separator of numbers (`"."`). |
|
|
1031
|
+
| `thousands_separator` | inherited ('') | Thousands separator (`""`: none). |
|
|
1032
|
+
| `minus` | inherited ('hyphen') | `hyphen` (`-`) or `minus` (U+2212, from an installed font). |
|
|
1033
|
+
| `prefix` | inherited ('') | Text before every number. |
|
|
1034
|
+
| `suffix` | inherited ('') | Text after every number. |
|
|
1035
|
+
| `precision` | inherited (None) | Significant digits of `auto`, `sci`, `eng`, `si` (unset: as needed). |
|
|
1036
|
+
|
|
1037
|
+
Groups: `TextStyle` (`label_`), `Stroke` (`tick_`), `TextStyle` (`tick_label_`), `Stroke` (`line_`), `Stroke` (`zero_line_`), `Stroke` (`grid_`), `Stroke` (`minor_grid_`), `Font`, `NumberFormat`.
|
|
1038
|
+
<!-- /settings -->
|
|
1039
|
+
|
|
1040
|
+
## 5. Series
|
|
1041
|
+
|
|
1042
|
+
All series take `name`, `alpha`, `z`, `rasterize` and `simplify` (see [Output](#8-output)).
|
|
1043
|
+
Series without their own color take the plot's next palette color, in call order; series
|
|
1044
|
+
with several value sets (histograms, densities, areas, pies) take one per set.
|
|
1045
|
+
|
|
1046
|
+
* **Layers.** A series is a preset of layers: each a stat (columns computed from the
|
|
1047
|
+
data: bins, densities, quartiles, fits, contours…), a position (stack, dodge, jitter,
|
|
1048
|
+
swarm, rows of intervals), and one of eight geoms that draws the columns (points,
|
|
1049
|
+
paths, bands, rectangles, polygons, segments, cells, text). A box plot is rectangles,
|
|
1050
|
+
segments and points from one box stat; it has one legend entry. Positions run once per
|
|
1051
|
+
plot over all its series, before the axes are fitted.
|
|
1052
|
+
* **Orientation.** Every series with x and y data takes `orientation="horizontal"`
|
|
1053
|
+
(scatter, line, fill, area, bar, hist, kde, ecdf, box, violin, strip, swarm, errorbar,
|
|
1054
|
+
stem, regression): its x data go along the y axis, its y data along the x axis, and it
|
|
1055
|
+
draws the same marks with x and y swapped (curves along y, steps included). Grids
|
|
1056
|
+
(heatmap, hist2d, hexbin, contour, 2-D kde) and pies have none: swap their arguments.
|
|
1057
|
+
* **New types.** `pl.register_layer(name, factory)` adds `plot.<name>(…)`, which calls
|
|
1058
|
+
`factory(…, plot=plot)`. A factory that is a `pl.Series` subclass implements
|
|
1059
|
+
`layers()`, returning its `Call` (layers, legend entries, what the axes, maps and
|
|
1060
|
+
palette need; see `plot_io/layers/`); its class name is a style class. The genome types
|
|
1061
|
+
are registered so (`plot.bigwig(…)`, …).
|
|
1062
|
+
|
|
1063
|
+
* **Category slots.** Box and violin series, bar series, and strip and swarm series form
|
|
1064
|
+
three dodge groups: the series of a group that have a category split its slot (`width`)
|
|
1065
|
+
side by side, in call order; `dodge=False` overlays a series; `gap` leaves part of each
|
|
1066
|
+
share empty (`"10%"`). `width` is a `%` of the slot (one category, or the smallest gap
|
|
1067
|
+
between numeric `positions`), a length (px), or data units (`"0.8d"`). Stacked bars
|
|
1068
|
+
count as one, and so do split violins.
|
|
1069
|
+
* **Stacking.** `stack=True` (bars, histograms, densities) puts a series on the previous
|
|
1070
|
+
stacked series of its kind in the plot, per category or bin; positive and negative
|
|
1071
|
+
values stack apart; `stack="normalize"` divides each position by its total.
|
|
1072
|
+
* **Derived data.** Histograms, densities, ECDFs, violins, 2-D bins, contours and
|
|
1073
|
+
regressions compute their data once (in C, by plot_io's kernels) and keep it until
|
|
1074
|
+
a setting changes; `series.stats` exposes it.
|
|
1075
|
+
* **Shifted and rescaled coordinates.** `x_origin`, `x_scale` and `x_extent` (and `y_…`)
|
|
1076
|
+
draw a series' values `v` at `(v − origin) × scale`, without changing the data:
|
|
1077
|
+
`p.line(profile, x_origin="center")` draws positions 0…1000 at −500…500, `x_scale=10`
|
|
1078
|
+
makes bins of 10 (−5000…5000), and `x_extent="-5000/5000"` maps the series' smallest x
|
|
1079
|
+
to −5000 and its largest to 5000 (replacing origin and scale). `"center"` is the middle
|
|
1080
|
+
of the series' range, `"start"`/`"end"` its smallest/largest value. Limits, ticks and
|
|
1081
|
+
decorations (`p.vline(0)`) are in the drawn units. An axis' `origin`
|
|
1082
|
+
(`p.x_axis(origin="center")`, `fig.x_axis(…)` for every plot) applies to every series on
|
|
1083
|
+
it that has no `x_origin` of its own (on a genome axis, `"center"` is the middle of its
|
|
1084
|
+
region). Category axes ignore them, and they need a linear, time or genome axis.
|
|
1085
|
+
|
|
1086
|
+
<!-- settings:Transforms -->
|
|
1087
|
+
| Setting | Default | Meaning |
|
|
1088
|
+
|---|---|---|
|
|
1089
|
+
| `x_origin` | — | The x value drawn at 0: a number, `"center"` (the middle of the series' x range), `"start"` or `"end"` (its smallest or largest x); unset: the x axis' `origin`. Values are drawn at `(x − x_origin) × x_scale`. |
|
|
1090
|
+
| `x_scale` | 1.0 | Factor on x values after `x_origin` (e.g. bp per bin); default 1. |
|
|
1091
|
+
| `x_extent` | — | The span the series' x range is drawn over, `"lo/hi"` or `[lo, hi]`: its smallest x at `lo`, its largest at `hi`; replaces `x_origin` and `x_scale`. |
|
|
1092
|
+
| `y_origin` | — | The y value drawn at 0: a number, `"center"` (the middle of the series' y range), `"start"` or `"end"` (its smallest or largest y); unset: the y axis' `origin`. Values are drawn at `(y − y_origin) × y_scale`. |
|
|
1093
|
+
| `y_scale` | 1.0 | Factor on y values after `y_origin` (e.g. bp per bin); default 1. |
|
|
1094
|
+
| `y_extent` | — | The span the series' y range is drawn over, `"lo/hi"` or `[lo, hi]`: its smallest y at `lo`, its largest at `hi`; replaces `y_origin` and `y_scale`. |
|
|
1095
|
+
<!-- /settings -->
|
|
1096
|
+
|
|
1097
|
+
### Tables (`data=`)
|
|
1098
|
+
|
|
1099
|
+
```python
|
|
1100
|
+
p.scatter("umap_x", "umap_y", data=genes, c="density", group="cluster")
|
|
1101
|
+
pl.Box("expression", data=df, x="tissue", group="sex")
|
|
1102
|
+
p = pl.Plot(data=df); p.scatter("a", "b") # data inherited by the plot's series
|
|
1103
|
+
```
|
|
1104
|
+
|
|
1105
|
+
`data` is any object returning a column for `data[name]`: a dict of sequences, a pandas
|
|
1106
|
+
or polars data frame, a numpy structured array. Columns are read through `__getitem__`
|
|
1107
|
+
(and `to_numpy()` when present); no table library is imported. With `data`, a string in
|
|
1108
|
+
a positional data argument or in `color`, `edge_color`, `size`, `alpha`, `group`,
|
|
1109
|
+
`draw_order`, `x_error`, `y_error`, `weights`, `positions`, `x`, `y` or `names` names a
|
|
1110
|
+
column. Positional arguments, `group`, `weights` and `positions` must be columns; in
|
|
1111
|
+
`color`, a color name that is no column stays a color (a column wins, with a warning if
|
|
1112
|
+
the name is also a color). Axis titles default to the column names drawn on the axes,
|
|
1113
|
+
the colorbar label to the `color` column, the legend title to the `group` column.
|
|
1114
|
+
`data` is also a plot and figure setting, inherited by their series. Pandas categorical
|
|
1115
|
+
columns keep their category order for groups and category axes.
|
|
1116
|
+
|
|
1117
|
+
Box, violin, strip and swarm also take long data: `values` flat, with the category of each
|
|
1118
|
+
value in `x` (`y` when horizontal).
|
|
1119
|
+
|
|
1120
|
+
### Groups (`group=`)
|
|
1121
|
+
|
|
1122
|
+
```python
|
|
1123
|
+
g = p.scatter(x, y, group=labels, marker="auto") # one series per group
|
|
1124
|
+
g = p.line(t, y, group=subject, line_style="auto")
|
|
1125
|
+
g["a"].set(color="black"); g.set(alpha=0.6)
|
|
1126
|
+
```
|
|
1127
|
+
|
|
1128
|
+
`group` takes a label per point. The call returns a `SeriesGroup`, a list of one series per
|
|
1129
|
+
group (first-appearance order, the categorical order of a pandas column, or
|
|
1130
|
+
`group_order=[…]`), each with the rows of every per-point argument that belong to it,
|
|
1131
|
+
the group label as `name` and the next palette color (`group_colors={label: color}` sets
|
|
1132
|
+
some). `marker="auto"` cycles marker shapes and `line_style="auto"` line styles over the
|
|
1133
|
+
groups. Missing labels (`None`, NaN) form a `"nan"` group, or are dropped with
|
|
1134
|
+
`group_missing="drop"`. `set()` on the group applies to every member; `group[label]` (or
|
|
1135
|
+
an index) is one member; `labels` lists them. For box, violin, bar, strip and swarm the
|
|
1136
|
+
groups are dodged within each category slot. Densities (`"density"`) are computed per
|
|
1137
|
+
member, and `draw_order` sorts within each member.
|
|
1138
|
+
|
|
1139
|
+
### Scatter
|
|
1140
|
+
|
|
1141
|
+
```python
|
|
1142
|
+
pl.Scatter(x, y, plot=None, **settings)
|
|
1143
|
+
```
|
|
1144
|
+
|
|
1145
|
+
`color`, `edge_color`, `size`, `marker` take one value or one per point. Numbers per
|
|
1146
|
+
point in `color` and `edge_color` are mapped through `color_map` (alias `cmap`; default:
|
|
1147
|
+
the style's map); numbers in `size` are diameters, or values mapped through `size_map`
|
|
1148
|
+
(alias `smap`) when it is set. See [values](#values-in-color-and-size).
|
|
1149
|
+
|
|
1150
|
+
* `size` is a diameter (a length; per-point numbers are px). With `size_basis="area"` (default) every shape has the
|
|
1151
|
+
area of the circle of that diameter: a square of size 4 is drawn 3.54 px wide.
|
|
1152
|
+
* Error bars: `x_error`/`y_error` take a value, a sequence, `(low, high)` sequences or
|
|
1153
|
+
`ErrorBars(values, color=None, line_width=None, cap_length=None)` (cap: the series'
|
|
1154
|
+
`cap_length`, else 4 px).
|
|
1155
|
+
|
|
1156
|
+
<!-- settings:Scatter -->
|
|
1157
|
+
| Setting | Default | Meaning |
|
|
1158
|
+
|---|---|---|
|
|
1159
|
+
| `marker` | 'circle' | Marker name, `Path` or path data, or one per point. |
|
|
1160
|
+
| `size` | 4.5 | Marker size: the diameter of the circle of equal area; one value or one per point; numbers per point are values to map when `size_map` is set; or `"density"`. Length. |
|
|
1161
|
+
| `color` | — | Fill: a color, colors per point, numbers per point (mapped through `color_map`) or `"density"`. |
|
|
1162
|
+
| `edge_color` | 'auto' | Outline: as the fill color, or `"auto"` (white around filled markers; hollow ones outlined in their color). |
|
|
1163
|
+
| `edge_width` | 0.75 | Outline width; 0: no outline. Length. |
|
|
1164
|
+
| `fill` | True | `True`: filled with the color; `False`: hollow, outlined in the color; an opacity (0–1): filled at that opacity and outlined in the color. |
|
|
1165
|
+
| `size_basis` | 'area' | `area`: shapes of the same size have the same area; `box`: size is the width of the shape's box. |
|
|
1166
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient numbers given as colors are drawn with: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
1167
|
+
| `color_limits` | — | Limits of the series' color axis, as an axis' `limits`: `"-2/2"`, `"0/max"`, `"q:0.01/q:0.99"`; unset: `"auto"`, the values' range. |
|
|
1168
|
+
| `color_scale` | — | Scale of the series' color axis (`log`, `sqrt`, …); unset: `linear`. |
|
|
1169
|
+
| `color_axis` | — | A shared `ColorAxis` (`figure.color_axis(…)`) in place of the series' own: it holds the map, limits and scale. |
|
|
1170
|
+
| `size_map` | — | The sizes numbers in `size` are drawn with: a `SizeMap` (alias `smap`); without it (or `size_axis`), numbers are sizes in px. |
|
|
1171
|
+
| `size_limits` | — | Limits of the series' size axis, as an axis' `limits`; unset: `"auto"`. |
|
|
1172
|
+
| `size_scale` | — | Scale of the series' size axis; unset: `linear`. |
|
|
1173
|
+
| `size_axis` | — | A shared `SizeAxis` (`figure.size_axis(…)`) in place of the series' own: it holds the sizes, limits and scale. |
|
|
1174
|
+
| `size_legend` | True | With mapped sizes: a size key in the legend (`True`), none (`False`), or the values to show (a list). |
|
|
1175
|
+
| `draw_order` | — | Drawing order: `"density"` (densest drawn last), `"-density"`, or sort keys per point (ascending); default: call order. |
|
|
1176
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own; or `"density"` / a `Density`, mapped linearly to `alpha_range`. |
|
|
1177
|
+
| `alpha_range` | (0.2, 1.0) | Opacities of the least and most dense points when `alpha` is a density. |
|
|
1178
|
+
| `x_error` | — | Horizontal error bars: a value, a sequence, `(low, high)` or `ErrorBars`. |
|
|
1179
|
+
| `y_error` | — | Vertical error bars. |
|
|
1180
|
+
| `orientation` | 'vertical' | `vertical` (x along the x axis) or `horizontal` (x along the y axis). |
|
|
1181
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1182
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1183
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1184
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1185
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1186
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1187
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1188
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1189
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1190
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1191
|
+
|
|
1192
|
+
Groups: `Marker`, `Font`.
|
|
1193
|
+
<!-- /settings -->
|
|
1194
|
+
|
|
1195
|
+
### Line
|
|
1196
|
+
|
|
1197
|
+
```python
|
|
1198
|
+
pl.Line(x, y=None, plot=None, **settings) # y 2-D: one line per row; x omitted: 0, 1, 2, …
|
|
1199
|
+
```
|
|
1200
|
+
|
|
1201
|
+
Named line styles scale with the width. Markers (`marker`, `marker_size`,
|
|
1202
|
+
`marker_color`, …) are drawn at the points when `marker` or `show_markers` is set.
|
|
1203
|
+
Numbers per point (or `"density"`, of a single line) in `marker_color` and
|
|
1204
|
+
`marker_edge_color` go through the series' [color axis](#6-color-and-size-axes)
|
|
1205
|
+
(`color_map`, `color_limits`, `color_scale`, `color_axis`; `p.colorbar(line)`), as
|
|
1206
|
+
`color` does on Scatter; the line keeps `color`, and the legend's marker takes the
|
|
1207
|
+
gradient's middle color.
|
|
1208
|
+
|
|
1209
|
+
* `interpolation`: `linear`; `step-pre`, `step-post`, `step-mid`; `monotone` (a cubic
|
|
1210
|
+
through every point that never overshoots, Fritsch–Carlson; `spline` where x is not
|
|
1211
|
+
monotonic); `spline` (centripetal Catmull–Rom, may overshoot). Each segment is one exact
|
|
1212
|
+
Bézier, computed on the page after the axis scales, by vec_io in C. Steps and curves
|
|
1213
|
+
are not decimated by `simplify`.
|
|
1214
|
+
* `missing`: `break` (default) ends a run at a missing value (NaN, `None`, or outside the
|
|
1215
|
+
axis scale's domain); runs are drawn on their own and a one-point run draws nothing.
|
|
1216
|
+
`skip` connects the points on either side.
|
|
1217
|
+
|
|
1218
|
+
<!-- settings:Line -->
|
|
1219
|
+
| Setting | Default | Meaning |
|
|
1220
|
+
|---|---|---|
|
|
1221
|
+
| `color` | — | Line color; default: the next palette color. |
|
|
1222
|
+
| `line_width` | inherited (0.75) | Line width. Length. |
|
|
1223
|
+
| `line_style` | 'solid' | `solid`, `dashed`, `dotted`, `dashdot` or a dash list; named styles scale with the width. Length. |
|
|
1224
|
+
| `cap` | 'butt' | Line cap. |
|
|
1225
|
+
| `join` | 'round' | Line join. |
|
|
1226
|
+
| `interpolation` | 'linear' | How points are joined: `linear`, `step-pre`, `step-post`, `step-mid`, `monotone` (a curve that never overshoots) or `spline` (centripetal Catmull–Rom). |
|
|
1227
|
+
| `missing` | 'break' | Missing values: `break` the line there, or `skip` them and connect their neighbours. |
|
|
1228
|
+
| `marker` | 'circle' | Marker name, `Path` or path data, or one per point. |
|
|
1229
|
+
| `marker_size` | 4.5 | Marker size: the diameter of the circle of equal area, in px; one value or one per point. Length. |
|
|
1230
|
+
| `marker_color` | — | Fill: a color, colors per point, numbers per point (mapped through `color_map`) or `"density"`. |
|
|
1231
|
+
| `marker_edge_color` | 'auto' | Outline: as the fill color, or `"auto"` (white around filled markers; hollow ones outlined in their color). |
|
|
1232
|
+
| `marker_edge_width` | 0.75 | Outline width; 0: no outline. Length. |
|
|
1233
|
+
| `marker_fill` | True | `True`: filled with the color; `False`: hollow, outlined in the color; an opacity (0–1): filled at that opacity and outlined in the color. |
|
|
1234
|
+
| `size_basis` | 'area' | `area`: shapes of the same size have the same area; `box`: size is the width of the shape's box. |
|
|
1235
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient numbers given as colors are drawn with: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
1236
|
+
| `color_limits` | — | Limits of the series' color axis, as an axis' `limits`: `"-2/2"`, `"0/max"`, `"q:0.01/q:0.99"`; unset: `"auto"`, the values' range. |
|
|
1237
|
+
| `color_scale` | — | Scale of the series' color axis (`log`, `sqrt`, …); unset: `linear`. |
|
|
1238
|
+
| `color_axis` | — | A shared `ColorAxis` (`figure.color_axis(…)`) in place of the series' own: it holds the map, limits and scale. |
|
|
1239
|
+
| `x_error` | — | Horizontal error bars at the points. |
|
|
1240
|
+
| `y_error` | — | Vertical error bars at the points. |
|
|
1241
|
+
| `show_markers` | False | Draw markers at the points (also turned on by setting `marker`). |
|
|
1242
|
+
| `orientation` | 'vertical' | `vertical` (x along the x axis) or `horizontal` (x along the y axis). |
|
|
1243
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1244
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own. |
|
|
1245
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1246
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1247
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1248
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1249
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1250
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1251
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1252
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1253
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1254
|
+
|
|
1255
|
+
Groups: `Stroke`, `Marker` (`marker_`), `Font`.
|
|
1256
|
+
<!-- /settings -->
|
|
1257
|
+
|
|
1258
|
+
### Fill
|
|
1259
|
+
|
|
1260
|
+
```python
|
|
1261
|
+
pl.Fill(x, y1, y2=0, plot=None, **settings) # y1 may be two rows [upper, lower]
|
|
1262
|
+
```
|
|
1263
|
+
|
|
1264
|
+
`interpolation` and `missing` work as for lines, on both edges (a point is missing when
|
|
1265
|
+
x, y1 or y2 is), so a band with the settings of its line matches it, horizontal ones
|
|
1266
|
+
included (`fill(y, x1, x2, orientation="horizontal")`: the curves run along y).
|
|
1267
|
+
`color_below` colors the parts where `y1` is below `y2` (a difference between two curves,
|
|
1268
|
+
each side in its color).
|
|
1269
|
+
|
|
1270
|
+
<!-- settings:Fill -->
|
|
1271
|
+
| Setting | Default | Meaning |
|
|
1272
|
+
|---|---|---|
|
|
1273
|
+
| `color` | — | Fill color; default: the next palette color. |
|
|
1274
|
+
| `color_below` | — | Fill color where `y1` is below `y2` (crossings found on straight segments); default `color` everywhere. |
|
|
1275
|
+
| `alpha` | 'calc(0.3 * inherit)' | Opacity; default 0.3 × the plot's. |
|
|
1276
|
+
| `edge_color` | — | Outline color; default none. |
|
|
1277
|
+
| `edge_width` | 'var(line_width)' | Outline width; default the line width. Length. |
|
|
1278
|
+
| `interpolation` | 'linear' | How points are joined: `linear`, `step-pre`, `step-post`, `step-mid`, `monotone` (a curve that never overshoots) or `spline` (centripetal Catmull–Rom). |
|
|
1279
|
+
| `missing` | 'break' | Missing values: `break` the line there, or `skip` them and connect their neighbours. |
|
|
1280
|
+
| `orientation` | 'vertical' | `vertical`: between y curves; `horizontal`: between x curves. |
|
|
1281
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1282
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1283
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1284
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1285
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1286
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1287
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1288
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1289
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1290
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1291
|
+
|
|
1292
|
+
Groups: `Stroke` (`edge_`), `Font`.
|
|
1293
|
+
<!-- /settings -->
|
|
1294
|
+
|
|
1295
|
+
### Box
|
|
1296
|
+
|
|
1297
|
+
```python
|
|
1298
|
+
pl.Box(values, positions=None, plot=None, **settings)
|
|
1299
|
+
box.stats # {category: BoxStats(count, mean, q1, median, q3, low, high, outliers)}
|
|
1300
|
+
```
|
|
1301
|
+
|
|
1302
|
+
`values`: a dict `{category: values}`, a list of arrays (categories `0, 1, …` or
|
|
1303
|
+
`categories=`), or one array. `positions` places the boxes on a numeric axis instead.
|
|
1304
|
+
Quartiles interpolate linearly (numpy's default); whiskers reach the furthest data within
|
|
1305
|
+
`whiskers` × IQR, or the range, or percentiles; points beyond are outliers. Box series of
|
|
1306
|
+
a plot share each category's slot side by side, in call order, among those having that
|
|
1307
|
+
category.
|
|
1308
|
+
|
|
1309
|
+
<!-- settings:Box -->
|
|
1310
|
+
| Setting | Default | Meaning |
|
|
1311
|
+
|---|---|---|
|
|
1312
|
+
| `color` | — | Box fill: a color, one per box (list or dict by category), or numbers per box (list or dict) mapped through `color_map`; default: the next palette color. |
|
|
1313
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient numbers given as colors are drawn with: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
1314
|
+
| `color_limits` | — | Limits of the series' color axis, as an axis' `limits`: `"-2/2"`, `"0/max"`, `"q:0.01/q:0.99"`; unset: `"auto"`, the values' range. |
|
|
1315
|
+
| `color_scale` | — | Scale of the series' color axis (`log`, `sqrt`, …); unset: `linear`. |
|
|
1316
|
+
| `color_axis` | — | A shared `ColorAxis` (`figure.color_axis(…)`) in place of the series' own: it holds the map, limits and scale. |
|
|
1317
|
+
| `edge_color` | 'series' | Box outline, whiskers, caps and median: a color, `"series"` (each box's own color) or `"auto"` (a grey 0.6 × as light as the series' lightest color, as seaborn). |
|
|
1318
|
+
| `edge_width` | 0.75 | Outline width. Length. |
|
|
1319
|
+
| `whisker_color` | — | Whisker and cap color; default `edge_color`. |
|
|
1320
|
+
| `whisker_width` | 'var(edge_width)' | Whisker and cap width; default `edge_width`. Length. |
|
|
1321
|
+
| `whisker_style` | 'solid' | Whisker line style: `solid`, `dashed`, `dotted`, `dashdot` or a dash list (caps stay solid). Length. |
|
|
1322
|
+
| `median_color` | — | Median line color; default `edge_color`. |
|
|
1323
|
+
| `median_width` | 'calc(3 * var(edge_width))' | Median line width. Length. |
|
|
1324
|
+
| `max_width` | '60%' | Largest width of the series' part of a slot (as `width`); default none. Length; `%`: of the slot: one category, or the smallest gap between positions; `d`: data units. |
|
|
1325
|
+
| `width` | '80%' | Box width: `%` of the slot, a length (bare numbers: px), `d` data units, or a duration on time axes. Length; `%`: of the slot: one category, or the smallest gap between positions; `d`: data units. |
|
|
1326
|
+
| `cap_length` | '50%' | Whisker cap width (`%` of the box width). Length; `%`: of the box width. |
|
|
1327
|
+
| `whiskers` | 1.5 | Whisker reach: a multiple of the IQR, `"range"`, or percentiles `(lo, hi)`. |
|
|
1328
|
+
| `outliers` | True | Draw points beyond the whiskers. |
|
|
1329
|
+
| `saturation` | 1.0 | Saturation of the box fills (1: the colors as given; seaborn uses 0.75). |
|
|
1330
|
+
| `fill` | 0.25 | Box fill: an opacity of the box color, times `alpha` (lines keep `alpha`); `True` (opaque), a color, or `False`. |
|
|
1331
|
+
| `mean` | False | Draw the mean as a marker. |
|
|
1332
|
+
| `mean_marker` | 'diamond' | Marker of the mean. |
|
|
1333
|
+
| `mean_color` | 'white' | Fill of the mean marker (outline: `edge_color`). |
|
|
1334
|
+
| `orientation` | 'vertical' | `vertical` (categories on x) or `horizontal`. |
|
|
1335
|
+
| `dodge` | True | Box and violin series sharing a category share its slot side by side; `False` overlays them. |
|
|
1336
|
+
| `gap` | '10%' | Fraction of each box's part of a shared slot left empty. Length; `%`: of each series' part of a shared slot. |
|
|
1337
|
+
| `categories` | — | Category names of a list of arrays. |
|
|
1338
|
+
| `marker` | 'circle' | Marker name, `Path` or path data, or one per point. |
|
|
1339
|
+
| `marker_size` | 3.5 | Marker size: the diameter of the circle of equal area, in px; one value or one per point. Length. |
|
|
1340
|
+
| `marker_color` | — | Outlier fill: a color, or colors per outlier. |
|
|
1341
|
+
| `marker_edge_color` | — | Outlier outline: as the fill, or `"auto"` (white around filled markers; hollow ones outlined in their color). |
|
|
1342
|
+
| `marker_edge_width` | 0.5 | Outline width; 0: no outline. Length. |
|
|
1343
|
+
| `marker_fill` | True | `True`: filled with the color; `False`: hollow, outlined in the color; an opacity (0–1): filled at that opacity and outlined in the color. |
|
|
1344
|
+
| `size_basis` | 'area' | `area`: shapes of the same size have the same area; `box`: size is the width of the shape's box. |
|
|
1345
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1346
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own. |
|
|
1347
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1348
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1349
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1350
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1351
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1352
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1353
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1354
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1355
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1356
|
+
|
|
1357
|
+
Groups: `Stroke` (`edge_`), `Stroke` (`whisker_`), `Stroke` (`median_`), `FillStyle`, `Marker` (`marker_`), `Font`.
|
|
1358
|
+
<!-- /settings -->
|
|
1359
|
+
|
|
1360
|
+
### Heatmap
|
|
1361
|
+
|
|
1362
|
+
```python
|
|
1363
|
+
pl.Heatmap(values, x=None, y=None, plot=None, **settings)
|
|
1364
|
+
```
|
|
1365
|
+
|
|
1366
|
+
`values` is 2-D, row 0 first; a 3-D `(h, w, 3|4)` grid is drawn as colors. `x`/`y`:
|
|
1367
|
+
`None` (cell indices), labels (a category axis), n cell centres or n + 1 edges (uneven
|
|
1368
|
+
spacing and any axis scale allowed). `color_map` (alias `cmap`), `color_limits` and
|
|
1369
|
+
`color_scale` configure the series' [color axis](#6-color-and-size-axes).
|
|
1370
|
+
`value_labels=True` writes each value, formatted by `value_label_format` (any
|
|
1371
|
+
[number format](#number-formats); `"auto"`: 3 significant digits, the same decimals for
|
|
1372
|
+
all cells), in black or white, whichever contrasts more (at most 2,500 cells unless
|
|
1373
|
+
`value_labels="all"`). `kind`: `image`, `cells` or `smooth`.
|
|
1374
|
+
|
|
1375
|
+
<!-- settings:Heatmap -->
|
|
1376
|
+
| Setting | Default | Meaning |
|
|
1377
|
+
|---|---|---|
|
|
1378
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient numbers given as colors are drawn with: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
1379
|
+
| `color_limits` | — | Limits of the series' color axis, as an axis' `limits`: `"-2/2"`, `"0/max"`, `"q:0.01/q:0.99"`; unset: `"auto"`, the values' range. |
|
|
1380
|
+
| `color_scale` | — | Scale of the series' color axis (`log`, `sqrt`, …); unset: `linear`. |
|
|
1381
|
+
| `color_axis` | — | A shared `ColorAxis` (`figure.color_axis(…)`) in place of the series' own: it holds the map, limits and scale. |
|
|
1382
|
+
| `kind` | 'image' | `image` (one image pixel per cell), `cells` (rectangles) or `smooth` (interpolated). |
|
|
1383
|
+
| `nan_color` | — | Color of missing cells; default: the map's `bad` (transparent). |
|
|
1384
|
+
| `origin` | 'top' | `top`: row 0 at the top (y axis inverted); `bottom`: at the bottom. |
|
|
1385
|
+
| `value_labels` | False | Write each cell's value (`"all"` above 2,500 cells). |
|
|
1386
|
+
| `value_label_format` | 'auto' | Number format of cell labels (`auto`: 3 significant digits, the same decimals for all cells). |
|
|
1387
|
+
| `value_label_font_size` | '0.9em' | Font size of cell labels. Length; `%`: of the font size. |
|
|
1388
|
+
| `colorbar` | False | Attach a colorbar to the plot. |
|
|
1389
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1390
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own. |
|
|
1391
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1392
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1393
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1394
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1395
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1396
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1397
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1398
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1399
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1400
|
+
| `decimal_separator` | inherited ('.') | Decimal separator of numbers (`"."`). |
|
|
1401
|
+
| `thousands_separator` | inherited ('') | Thousands separator (`""`: none). |
|
|
1402
|
+
| `minus` | inherited ('hyphen') | `hyphen` (`-`) or `minus` (U+2212, from an installed font). |
|
|
1403
|
+
| `prefix` | inherited ('') | Text before every number. |
|
|
1404
|
+
| `suffix` | inherited ('') | Text after every number. |
|
|
1405
|
+
| `precision` | inherited (None) | Significant digits of `auto`, `sci`, `eng`, `si` (unset: as needed). |
|
|
1406
|
+
|
|
1407
|
+
Groups: `TextStyle` (`value_label_`), `Font`, `NumberFormat`.
|
|
1408
|
+
<!-- /settings -->
|
|
1409
|
+
|
|
1410
|
+
### Bar
|
|
1411
|
+
|
|
1412
|
+
```python
|
|
1413
|
+
pl.Bar(x, height=None, plot=None, **settings)
|
|
1414
|
+
```
|
|
1415
|
+
|
|
1416
|
+
`x`: categories (a category axis) or numbers (bars centred on them, `width` in data units); a dict `{category: height}`; or heights alone (at 0, 1, …). `value_labels` writes the values outside, inside or at the centre of the bars, formatted by `value_label_format`; `fill` is the opacity of the bars' fill (or a color); `error` adds error bars at the bar ends. Value axes include 0 (`include_zero="auto"`).
|
|
1417
|
+
|
|
1418
|
+
<!-- settings:Bar -->
|
|
1419
|
+
| Setting | Default | Meaning |
|
|
1420
|
+
|---|---|---|
|
|
1421
|
+
| `color` | — | Bar fill: a color, one per bar (list or dict by category), or numbers per bar (list or dict) mapped through `color_map`; default: the next palette color. |
|
|
1422
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient numbers given as colors are drawn with: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
1423
|
+
| `color_limits` | — | Limits of the series' color axis, as an axis' `limits`: `"-2/2"`, `"0/max"`, `"q:0.01/q:0.99"`; unset: `"auto"`, the values' range. |
|
|
1424
|
+
| `color_scale` | — | Scale of the series' color axis (`log`, `sqrt`, …); unset: `linear`. |
|
|
1425
|
+
| `color_axis` | — | A shared `ColorAxis` (`figure.color_axis(…)`) in place of the series' own: it holds the map, limits and scale. |
|
|
1426
|
+
| `edge_color` | 'series' | Outline color: a color, `"series"` (each bar's own color, at `alpha`) or none. |
|
|
1427
|
+
| `edge_width` | 'var(line_width)' | Outline width. Length. |
|
|
1428
|
+
| `fill` | 0.25 | Fill: an opacity of each bar's color, times `alpha` (outlines keep `alpha`); `True` (opaque), a color, or `False`. |
|
|
1429
|
+
| `seam_color` | 'white' | Where outlined bars touch (dodged or adjacent), the shared edge in this color; `none`: both outlines as drawn. Between the parts of a stack, the line is the outline of the part nearer the baseline. |
|
|
1430
|
+
| `max_width` | — | Largest width of the series' part of a slot (as `width`); default none. Length; `%`: of the slot: one category, or the smallest gap between positions; `d`: data units. |
|
|
1431
|
+
| `width` | '80%' | Bar width: `%` of the slot, a length (bare numbers: px), `d` data units, or a duration (or `timedelta`) on time axes. Length; `%`: of the slot: one category, or the smallest gap between positions; `d`: data units. |
|
|
1432
|
+
| `bottom` | 0.0 | Base of the bars: a value or one per bar. |
|
|
1433
|
+
| `orientation` | 'vertical' | `vertical` (bars rise from the x axis) or `horizontal`. |
|
|
1434
|
+
| `stack` | False | `True`: on top of the previous stacked bars of the plot; `"normalize"`: stacks scaled to 1. |
|
|
1435
|
+
| `dodge` | True | Bar series sharing a category share its slot side by side; `False` overlays them. |
|
|
1436
|
+
| `gap` | 0.0 | Fraction of each bar's part of a shared slot left empty. Length; `%`: of each series' part of a shared slot. |
|
|
1437
|
+
| `saturation` | 1.0 | Saturation of the fills (seaborn: 0.75). |
|
|
1438
|
+
| `error` | — | Error bars at the bar ends: a value, a sequence, `(low, high)` or `ErrorBars`. |
|
|
1439
|
+
| `error_color` | '#333333' | Error bar color. |
|
|
1440
|
+
| `error_width` | 0.75 | Error bar line width. Length. |
|
|
1441
|
+
| `value_labels` | False | Value labels: `True`/`"outside"`, `"inside"`, `"center"`. Outside labels widen automatic limits so they fit in the axes; a label too large for its bar goes outside, or is left out on a stacked bar. |
|
|
1442
|
+
| `value_label_format` | 'auto' | Number format of the value labels. |
|
|
1443
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1444
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own. |
|
|
1445
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1446
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1447
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1448
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1449
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1450
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1451
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1452
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1453
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1454
|
+
| `decimal_separator` | inherited ('.') | Decimal separator of numbers (`"."`). |
|
|
1455
|
+
| `thousands_separator` | inherited ('') | Thousands separator (`""`: none). |
|
|
1456
|
+
| `minus` | inherited ('hyphen') | `hyphen` (`-`) or `minus` (U+2212, from an installed font). |
|
|
1457
|
+
| `prefix` | inherited ('') | Text before every number. |
|
|
1458
|
+
| `suffix` | inherited ('') | Text after every number. |
|
|
1459
|
+
| `precision` | inherited (None) | Significant digits of `auto`, `sci`, `eng`, `si` (unset: as needed). |
|
|
1460
|
+
|
|
1461
|
+
Groups: `Stroke` (`edge_`), `FillStyle`, `Stroke` (`error_`), `Font`, `NumberFormat`.
|
|
1462
|
+
<!-- /settings -->
|
|
1463
|
+
|
|
1464
|
+
### Hist
|
|
1465
|
+
|
|
1466
|
+
```python
|
|
1467
|
+
pl.Hist(values, plot=None, **settings)
|
|
1468
|
+
```
|
|
1469
|
+
|
|
1470
|
+
`values`: one array, or several (a dict, a list of arrays) sharing the bins. `bins`: a count, edges, or numpy's rules (`auto` is numpy 2's). Bins are even on the axis scale (`bins_scale="axis"`): on a log axis, in log space. `stat` turns counts into densities (area 1), probabilities, percents or counts per unit; `cumulative` accumulates them. Several sets overlay (opacity 0.5), stack (`stack=True`) or dodge (`dodge=True`). `hist.stats`: `edges`, `counts` and `heights` per set.
|
|
1471
|
+
|
|
1472
|
+
<!-- settings:Hist -->
|
|
1473
|
+
| Setting | Default | Meaning |
|
|
1474
|
+
|---|---|---|
|
|
1475
|
+
| `bins` | 'auto' | A count, edges, or a rule: `auto`, `fd`, `sturges`, `scott`, `sqrt`, `rice`, `doane` (numpy's). |
|
|
1476
|
+
| `range` | — | Range of the bins; default the data range. |
|
|
1477
|
+
| `weights` | — | A weight per value (per set for several sets). |
|
|
1478
|
+
| `stat` | 'count' | `count`, `density` (area 1), `probability`, `percent` or `frequency` (count per unit). |
|
|
1479
|
+
| `cumulative` | False | Accumulate the bins. |
|
|
1480
|
+
| `kind` | 'stepfilled' | `bar` (adjacent bars), `step` (outline) or `stepfilled`. |
|
|
1481
|
+
| `bins_scale` | 'axis' | `axis`: bins even on the axis scale (log axes: in log space); `linear`: even in data units. |
|
|
1482
|
+
| `orientation` | 'vertical' | `vertical` (bins along x) or `horizontal`. |
|
|
1483
|
+
| `stack` | False | Stack the sets (and other stacked histograms with the same bins). |
|
|
1484
|
+
| `dodge` | False | Put the sets side by side within each bin. |
|
|
1485
|
+
| `color` | — | Fill color, or one per set; default palette colors. |
|
|
1486
|
+
| `edge_color` | — | Bar outline color; default none. |
|
|
1487
|
+
| `edge_width` | 0.0 | Bar outline width. Length. |
|
|
1488
|
+
| `line_color` | — | Step and outline color; default each set's color. |
|
|
1489
|
+
| `line_width` | inherited (0.75) | Step line width. Length. |
|
|
1490
|
+
| `outline` | True | `bar` and `stepfilled` kinds: the outer outline of each set, in `line_color` (dodged bars: each bar's outline). |
|
|
1491
|
+
| `alpha` | 'auto' | Opacity; `"auto"`: 0.5 for overlaid sets, else the plot's. |
|
|
1492
|
+
| `saturation` | 1.0 | Saturation of the fills. |
|
|
1493
|
+
| `value_labels` | False | Value labels on bars. |
|
|
1494
|
+
| `value_label_format` | 'auto' | Number format of the value labels. |
|
|
1495
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1496
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1497
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1498
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1499
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1500
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1501
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1502
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1503
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1504
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1505
|
+
| `decimal_separator` | inherited ('.') | Decimal separator of numbers (`"."`). |
|
|
1506
|
+
| `thousands_separator` | inherited ('') | Thousands separator (`""`: none). |
|
|
1507
|
+
| `minus` | inherited ('hyphen') | `hyphen` (`-`) or `minus` (U+2212, from an installed font). |
|
|
1508
|
+
| `prefix` | inherited ('') | Text before every number. |
|
|
1509
|
+
| `suffix` | inherited ('') | Text after every number. |
|
|
1510
|
+
| `precision` | inherited (None) | Significant digits of `auto`, `sci`, `eng`, `si` (unset: as needed). |
|
|
1511
|
+
|
|
1512
|
+
Groups: `Stroke` (`edge_`), `Stroke` (`line_`), `Font`, `NumberFormat`.
|
|
1513
|
+
<!-- /settings -->
|
|
1514
|
+
|
|
1515
|
+
### Kde
|
|
1516
|
+
|
|
1517
|
+
```python
|
|
1518
|
+
pl.Kde(values, plot=None, **settings)
|
|
1519
|
+
```
|
|
1520
|
+
|
|
1521
|
+
A Gaussian kernel density of each set on a common grid of `points` points, extending `cut` bandwidths past the data (within `range`). `fill` fills under each curve (`True`: at 0.25, an opacity, or a color). `bandwidth`: `scott` (default), `silverman` (as scipy's `gaussian_kde`) or a number, times `adjust`. On log axes the density is computed in log space, per log unit. `kde.stats`: `grid`, `densities`, `bandwidths`.
|
|
1522
|
+
|
|
1523
|
+
<!-- settings:Kde -->
|
|
1524
|
+
| Setting | Default | Meaning |
|
|
1525
|
+
|---|---|---|
|
|
1526
|
+
| `bandwidth` | 'scott' | `scott`, `silverman`, or a bandwidth in data units. |
|
|
1527
|
+
| `adjust` | 1.0 | Factor applied to the bandwidth. |
|
|
1528
|
+
| `cut` | 3.0 | The curve extends this many bandwidths past the data. |
|
|
1529
|
+
| `range` | — | Limits of the curve (within the data plus `cut`); default none. |
|
|
1530
|
+
| `points` | 512 | Number of points of the curve. |
|
|
1531
|
+
| `cumulative` | False | Plot the cumulative distribution. |
|
|
1532
|
+
| `fill` | False | Fill under the curve: an opacity of its color, `True` (0.25), a color, or `False` (stacked curves: 0.25). |
|
|
1533
|
+
| `weights` | — | A weight per value (per set for several sets). |
|
|
1534
|
+
| `orientation` | 'vertical' | `vertical` (values along x) or `horizontal`. |
|
|
1535
|
+
| `stack` | False | Stack the sets (seaborn's `multiple="stack"`). |
|
|
1536
|
+
| `color` | — | Color, or one per set; default palette colors. |
|
|
1537
|
+
| `line_width` | inherited (0.75) | Line width. Length. |
|
|
1538
|
+
| `line_style` | 'solid' | Line style. Length. |
|
|
1539
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1540
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own. |
|
|
1541
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1542
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1543
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1544
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1545
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1546
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1547
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1548
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1549
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1550
|
+
|
|
1551
|
+
Groups: `FillStyle`, `Stroke`, `Font`.
|
|
1552
|
+
<!-- /settings -->
|
|
1553
|
+
|
|
1554
|
+
### Kde2d
|
|
1555
|
+
|
|
1556
|
+
```python
|
|
1557
|
+
p.kde(x, y, levels=10, fill=False, thresh=0.05, **settings) # or pl.Kde(x, y), pl.Kde2d(x, y)
|
|
1558
|
+
```
|
|
1559
|
+
|
|
1560
|
+
Density contours of points (seaborn's `kdeplot(x=, y=)`): the 2-D Gaussian density
|
|
1561
|
+
(bandwidth as [`Density`](#point-density): scipy's covariance times Scott's factor, or
|
|
1562
|
+
Silverman's, a number or a matrix, times `adjust`) on a `points` × `points` grid over
|
|
1563
|
+
the data plus `cut` bandwidths, in axis positions (log axes in log space). With a number
|
|
1564
|
+
of `levels`, contour k of n encloses an equal share of the mass, from 1 − `thresh` (the
|
|
1565
|
+
outermost) up; a list gives density values. Unfilled lines take the next palette color,
|
|
1566
|
+
or `palette` (one color or colors per level), unless `color_map` is set; `fill=True`
|
|
1567
|
+
colors the bands through
|
|
1568
|
+
`color_map`, with the top band up to the maximum. Drawn by the contour code (lines,
|
|
1569
|
+
labels, colorbar).
|
|
1570
|
+
|
|
1571
|
+
<!-- settings:Kde2d -->
|
|
1572
|
+
| Setting | Default | Meaning |
|
|
1573
|
+
|---|---|---|
|
|
1574
|
+
| `levels` | 10 | A number of iso-proportion levels (contour k of n encloses k/n of the mass, above `thresh`), or density values. |
|
|
1575
|
+
| `thresh` | 0.05 | Lowest iso-proportion: the outermost contour encloses 1 − `thresh` of the mass. |
|
|
1576
|
+
| `bandwidth` | 'scott' | `"scott"`, `"silverman"`, a number or a 2 × 2 matrix, as `Density`. |
|
|
1577
|
+
| `adjust` | 1.0 | Factor of the bandwidth. |
|
|
1578
|
+
| `cut` | 3.0 | Grid extends this many bandwidths past the data. |
|
|
1579
|
+
| `points` | 128 | Grid points per side. |
|
|
1580
|
+
| `colorbar` | False | Attach a colorbar to the plot. |
|
|
1581
|
+
<!-- /settings -->
|
|
1582
|
+
|
|
1583
|
+
### Ecdf
|
|
1584
|
+
|
|
1585
|
+
```python
|
|
1586
|
+
pl.Ecdf(values, plot=None, **settings)
|
|
1587
|
+
```
|
|
1588
|
+
|
|
1589
|
+
A step line through the sorted values of each set: `stat` `proportion`, `count` or `percent`; `complementary` plots 1 − F.
|
|
1590
|
+
|
|
1591
|
+
<!-- settings:Ecdf -->
|
|
1592
|
+
| Setting | Default | Meaning |
|
|
1593
|
+
|---|---|---|
|
|
1594
|
+
| `weights` | — | A weight per value (per set for several sets). |
|
|
1595
|
+
| `stat` | 'proportion' | `proportion` (0–1), `count` or `percent`. |
|
|
1596
|
+
| `complementary` | False | Plot 1 − F (survival). |
|
|
1597
|
+
| `orientation` | 'vertical' | `vertical`: values along x; `horizontal`: along y. |
|
|
1598
|
+
| `color` | — | Line color, or one per set; default palette colors. |
|
|
1599
|
+
| `line_width` | inherited (0.75) | Line width. Length. |
|
|
1600
|
+
| `line_style` | 'solid' | Line style. Length. |
|
|
1601
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1602
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own. |
|
|
1603
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1604
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1605
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1606
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1607
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1608
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1609
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1610
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1611
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1612
|
+
|
|
1613
|
+
Groups: `Stroke`, `Font`.
|
|
1614
|
+
<!-- /settings -->
|
|
1615
|
+
|
|
1616
|
+
### Violin
|
|
1617
|
+
|
|
1618
|
+
```python
|
|
1619
|
+
pl.Violin(values, positions=None, plot=None, **settings)
|
|
1620
|
+
```
|
|
1621
|
+
|
|
1622
|
+
`values` as box plots take them. Each violin is the density of its category, mirrored; `width_scale` gives equal areas (default), areas proportional to the counts, or equal widths. `inner` draws a thin box with whiskers and a median dot, dashed quartiles, the points, or nothing (`False`). With `split=True`, two violin series share each slot as facing halves.
|
|
1623
|
+
|
|
1624
|
+
<!-- settings:Violin -->
|
|
1625
|
+
| Setting | Default | Meaning |
|
|
1626
|
+
|---|---|---|
|
|
1627
|
+
| `color` | — | Fill: a color, one per violin (list or dict by category), or numbers per violin mapped through `color_map`; default the next palette color. |
|
|
1628
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient numbers given as colors are drawn with: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
1629
|
+
| `color_limits` | — | Limits of the series' color axis, as an axis' `limits`: `"-2/2"`, `"0/max"`, `"q:0.01/q:0.99"`; unset: `"auto"`, the values' range. |
|
|
1630
|
+
| `color_scale` | — | Scale of the series' color axis (`log`, `sqrt`, …); unset: `linear`. |
|
|
1631
|
+
| `color_axis` | — | A shared `ColorAxis` (`figure.color_axis(…)`) in place of the series' own: it holds the map, limits and scale. |
|
|
1632
|
+
| `edge_color` | 'series' | Outline and inner color: a color or `"series"` (each violin's own color, at `alpha`). |
|
|
1633
|
+
| `edge_width` | 0.75 | Outline width. Length. |
|
|
1634
|
+
| `saturation` | 1.0 | Saturation of the fills. |
|
|
1635
|
+
| `alpha` | 1.0 | Opacity of the violins. |
|
|
1636
|
+
| `fill` | 0.25 | Fill: an opacity of each violin's color, times `alpha` (outlines keep `alpha`); `True` (opaque), a color, or `False`. |
|
|
1637
|
+
| `max_width` | — | Largest width of the series' part of a slot (as `width`); default none. Length; `%`: of the slot: one category, or the smallest gap between positions; `d`: data units. |
|
|
1638
|
+
| `width` | '80%' | Violin width: `%` of the slot, a length (bare numbers: px), `d` data units, or a duration on time axes. Length; `%`: of the slot: one category, or the smallest gap between positions; `d`: data units. |
|
|
1639
|
+
| `bandwidth` | 'scott' | `scott`, `silverman` or a number. |
|
|
1640
|
+
| `adjust` | 1.0 | Factor applied to the bandwidth. |
|
|
1641
|
+
| `cut` | 2.0 | The density extends this many bandwidths past the data. |
|
|
1642
|
+
| `points` | 512 | Points per violin outline. |
|
|
1643
|
+
| `width_scale` | 'area' | `area`: equal areas; `count`: area proportional to the number of values; `width`: equal widths. |
|
|
1644
|
+
| `inner` | 'box' | Inside each violin: `box` (a thin box, whiskers and a median dot), `quartiles` (dashed lines), `points`, or `False` (nothing). |
|
|
1645
|
+
| `split` | False | Two violin series share each slot as facing halves. |
|
|
1646
|
+
| `orientation` | 'vertical' | `vertical` (categories on x) or `horizontal`. |
|
|
1647
|
+
| `dodge` | True | Violin and box series sharing a category share its slot side by side; `False` overlays them. |
|
|
1648
|
+
| `gap` | '10%' | Fraction of each part of a shared slot left empty. Length; `%`: of each series' part of a shared slot. |
|
|
1649
|
+
| `categories` | — | Category names of a list of arrays. |
|
|
1650
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1651
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1652
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1653
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1654
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1655
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1656
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1657
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1658
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1659
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1660
|
+
|
|
1661
|
+
Groups: `Stroke` (`edge_`), `FillStyle`, `Font`.
|
|
1662
|
+
<!-- /settings -->
|
|
1663
|
+
|
|
1664
|
+
### Strip and swarm
|
|
1665
|
+
|
|
1666
|
+
```python
|
|
1667
|
+
pl.Strip(values, positions=None, plot=None, **settings)
|
|
1668
|
+
pl.Swarm(values, positions=None, plot=None, **settings)
|
|
1669
|
+
```
|
|
1670
|
+
|
|
1671
|
+
Points of each category's values: `Strip` spreads them by uniform jitter (± `jitter`, `%` of the slot width, from `seed`), `Swarm` places them side by side without overlaps (points that do not fit go to the slot edge, with a warning). Marker settings as `Scatter`. `Swarm` takes the same settings as `Strip` except `jitter` and `seed`.
|
|
1672
|
+
|
|
1673
|
+
<!-- settings:Strip -->
|
|
1674
|
+
| Setting | Default | Meaning |
|
|
1675
|
+
|---|---|---|
|
|
1676
|
+
| `marker` | 'circle' | Marker name, `Path` or path data, or one per point. |
|
|
1677
|
+
| `size` | 4.5 | Marker size: the diameter of the circle of equal area; one value or one per point; numbers per point are values to map when `size_map` is set; or `"density"`. Length. |
|
|
1678
|
+
| `color` | — | Fill: a color, colors per point, numbers per point (mapped through `color_map`) or `"density"`. |
|
|
1679
|
+
| `edge_color` | 'auto' | Outline: as the fill color, or `"auto"` (white around filled markers; hollow ones outlined in their color). |
|
|
1680
|
+
| `edge_width` | 0.75 | Outline width; 0: no outline. Length. |
|
|
1681
|
+
| `fill` | True | `True`: filled with the color; `False`: hollow, outlined in the color; an opacity (0–1): filled at that opacity and outlined in the color. |
|
|
1682
|
+
| `size_basis` | 'area' | `area`: shapes of the same size have the same area; `box`: size is the width of the shape's box. |
|
|
1683
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient numbers given as colors are drawn with: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
1684
|
+
| `color_limits` | — | Limits of the series' color axis, as an axis' `limits`: `"-2/2"`, `"0/max"`, `"q:0.01/q:0.99"`; unset: `"auto"`, the values' range. |
|
|
1685
|
+
| `color_scale` | — | Scale of the series' color axis (`log`, `sqrt`, …); unset: `linear`. |
|
|
1686
|
+
| `color_axis` | — | A shared `ColorAxis` (`figure.color_axis(…)`) in place of the series' own: it holds the map, limits and scale. |
|
|
1687
|
+
| `size_map` | — | The sizes numbers in `size` are drawn with: a `SizeMap` (alias `smap`); without it (or `size_axis`), numbers are sizes in px. |
|
|
1688
|
+
| `size_limits` | — | Limits of the series' size axis, as an axis' `limits`; unset: `"auto"`. |
|
|
1689
|
+
| `size_scale` | — | Scale of the series' size axis; unset: `linear`. |
|
|
1690
|
+
| `size_axis` | — | A shared `SizeAxis` (`figure.size_axis(…)`) in place of the series' own: it holds the sizes, limits and scale. |
|
|
1691
|
+
| `size_legend` | True | With mapped sizes: a size key in the legend (`True`), none (`False`), or the values to show (a list). |
|
|
1692
|
+
| `orientation` | 'vertical' | `vertical` (categories on x) or `horizontal`. |
|
|
1693
|
+
| `max_width` | — | Largest width of the series' part of a slot (as `width`); default none. Length; `%`: of the slot: one category, or the smallest gap between positions; `d`: data units. |
|
|
1694
|
+
| `width` | '80%' | Width the points spread over: `%` of the slot, a length (bare numbers: px), `d` data units, or a duration on time axes. Length; `%`: of the slot: one category, or the smallest gap between positions; `d`: data units. |
|
|
1695
|
+
| `dodge` | True | Point series sharing a category share its slot side by side; `False` overlays them. |
|
|
1696
|
+
| `gap` | 0.0 | Fraction of each part of a shared slot left empty. Length; `%`: of each series' part of a shared slot. |
|
|
1697
|
+
| `categories` | — | Category names of a list of arrays. |
|
|
1698
|
+
| `jitter` | '10%' | Half-width of the jitter (`%` of the slot width). Length; `%`: of the slot: one category, or the smallest gap between positions. |
|
|
1699
|
+
| `seed` | 0 | Seed of the jitter. |
|
|
1700
|
+
| `draw_order` | — | Drawing order: `"density"` (densest drawn last), `"-density"`, or sort keys per point (ascending); default: call order. |
|
|
1701
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own; or `"density"` / a `Density`, mapped linearly to `alpha_range`. |
|
|
1702
|
+
| `alpha_range` | (0.2, 1.0) | Opacities of the least and most dense points when `alpha` is a density. |
|
|
1703
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1704
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1705
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1706
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1707
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1708
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1709
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1710
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1711
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1712
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1713
|
+
|
|
1714
|
+
Groups: `Marker`, `Font`.
|
|
1715
|
+
<!-- /settings -->
|
|
1716
|
+
|
|
1717
|
+
### Area
|
|
1718
|
+
|
|
1719
|
+
```python
|
|
1720
|
+
pl.Area(x, ys, plot=None, **settings)
|
|
1721
|
+
```
|
|
1722
|
+
|
|
1723
|
+
Layers (rows of `ys`, or a dict `{name: values}`, one legend entry each) stacked on `baseline`: `zero`, `sym`, `wiggle` or `weighted_wiggle` (matplotlib's stackplot baselines). `interpolation` and `missing` as `Fill`.
|
|
1724
|
+
|
|
1725
|
+
<!-- settings:Area -->
|
|
1726
|
+
| Setting | Default | Meaning |
|
|
1727
|
+
|---|---|---|
|
|
1728
|
+
| `baseline` | 'zero' | `zero`, `sym` (symmetric around 0), `wiggle` or `weighted_wiggle` (streamgraphs, as matplotlib's stackplot). |
|
|
1729
|
+
| `stack` | True | Stack the layers; `False` overlays them from 0. |
|
|
1730
|
+
| `color` | — | A color, or one per layer; default palette colors. |
|
|
1731
|
+
| `alpha` | 0.25 | Opacity of the fills. |
|
|
1732
|
+
| `edge_color` | 'series' | Outline color of each layer's top: a color, `"series"` (each layer's own color) or none. |
|
|
1733
|
+
| `edge_width` | 'var(line_width)' | Outline width; default the line width. Length. |
|
|
1734
|
+
| `interpolation` | 'linear' | How points are joined: `linear`, `step-pre`, `step-post`, `step-mid`, `monotone` (a curve that never overshoots) or `spline` (centripetal Catmull–Rom). |
|
|
1735
|
+
| `missing` | 'break' | Missing values: `break` the line there, or `skip` them and connect their neighbours. |
|
|
1736
|
+
| `orientation` | 'vertical' | `vertical` (layers along x) or `horizontal` (along y). |
|
|
1737
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1738
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1739
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1740
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1741
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1742
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1743
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1744
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1745
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1746
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1747
|
+
|
|
1748
|
+
Groups: `Stroke` (`edge_`), `Font`.
|
|
1749
|
+
<!-- /settings -->
|
|
1750
|
+
|
|
1751
|
+
### Errorbar
|
|
1752
|
+
|
|
1753
|
+
```python
|
|
1754
|
+
pl.Errorbar(x, y, plot=None, **settings)
|
|
1755
|
+
```
|
|
1756
|
+
|
|
1757
|
+
Error bars on their own (markers only with `marker=`); `y_error_style="band"` fills the band between the y error ends instead. Numbers in `marker_color` map through the series' color axis, as on [Line](#line).
|
|
1758
|
+
|
|
1759
|
+
<!-- settings:Errorbar -->
|
|
1760
|
+
| Setting | Default | Meaning |
|
|
1761
|
+
|---|---|---|
|
|
1762
|
+
| `marker` | — | Marker at the points; default none. |
|
|
1763
|
+
| `marker_size` | 4.5 | Marker size: the diameter of the circle of equal area, in px; one value or one per point. Length. |
|
|
1764
|
+
| `marker_color` | — | Fill: a color, colors per point, numbers per point (mapped through `color_map`) or `"density"`. |
|
|
1765
|
+
| `marker_edge_color` | 'auto' | Outline: as the fill color, or `"auto"` (white around filled markers; hollow ones outlined in their color). |
|
|
1766
|
+
| `marker_edge_width` | 0.75 | Outline width; 0: no outline. Length. |
|
|
1767
|
+
| `marker_fill` | True | `True`: filled with the color; `False`: hollow, outlined in the color; an opacity (0–1): filled at that opacity and outlined in the color. |
|
|
1768
|
+
| `size_basis` | 'area' | `area`: shapes of the same size have the same area; `box`: size is the width of the shape's box. |
|
|
1769
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient numbers given as colors are drawn with: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
1770
|
+
| `color_limits` | — | Limits of the series' color axis, as an axis' `limits`: `"-2/2"`, `"0/max"`, `"q:0.01/q:0.99"`; unset: `"auto"`, the values' range. |
|
|
1771
|
+
| `color_scale` | — | Scale of the series' color axis (`log`, `sqrt`, …); unset: `linear`. |
|
|
1772
|
+
| `color_axis` | — | A shared `ColorAxis` (`figure.color_axis(…)`) in place of the series' own: it holds the map, limits and scale. |
|
|
1773
|
+
| `color` | — | Bar color; default: the next palette color. |
|
|
1774
|
+
| `line_width` | inherited (0.75) | Bar width. Length. |
|
|
1775
|
+
| `cap_length` | 4.0 | Cap width (`data`: in data units across the bar); 0: no caps. Length; `d`: data units. |
|
|
1776
|
+
| `x_error` | — | Horizontal errors. |
|
|
1777
|
+
| `y_error` | — | Vertical errors. |
|
|
1778
|
+
| `y_error_style` | 'bars' | `bars`, or `band`: a filled band between the y error ends (points sorted by x). |
|
|
1779
|
+
| `band_alpha` | 0.25 | Opacity of a band. |
|
|
1780
|
+
| `orientation` | 'vertical' | `vertical` (x along the x axis) or `horizontal` (x along the y axis). |
|
|
1781
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1782
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own. |
|
|
1783
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1784
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1785
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1786
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1787
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1788
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1789
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1790
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1791
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1792
|
+
|
|
1793
|
+
Groups: `Marker` (`marker_`), `Font`.
|
|
1794
|
+
<!-- /settings -->
|
|
1795
|
+
|
|
1796
|
+
### Stem
|
|
1797
|
+
|
|
1798
|
+
```python
|
|
1799
|
+
pl.Stem(x, y=None, plot=None, **settings)
|
|
1800
|
+
```
|
|
1801
|
+
|
|
1802
|
+
Stems from `baseline` to each value with a marker (lollipops), and a baseline line. Numbers in `marker_color` map through the series' color axis, as on [Line](#line).
|
|
1803
|
+
|
|
1804
|
+
<!-- settings:Stem -->
|
|
1805
|
+
| Setting | Default | Meaning |
|
|
1806
|
+
|---|---|---|
|
|
1807
|
+
| `marker` | 'circle' | Marker name, `Path` or path data, or one per point. |
|
|
1808
|
+
| `marker_size` | 5.0 | Marker size: the diameter of the circle of equal area, in px; one value or one per point. Length. |
|
|
1809
|
+
| `marker_color` | — | Fill: a color, colors per point, numbers per point (mapped through `color_map`) or `"density"`. |
|
|
1810
|
+
| `marker_edge_color` | — | Outline: as the fill color, or `"auto"` (white around filled markers; hollow ones outlined in their color). |
|
|
1811
|
+
| `marker_edge_width` | 0.0 | Outline width; 0: no outline. Length. |
|
|
1812
|
+
| `marker_fill` | True | `True`: filled with the color; `False`: hollow, outlined in the color; an opacity (0–1): filled at that opacity and outlined in the color. |
|
|
1813
|
+
| `size_basis` | 'area' | `area`: shapes of the same size have the same area; `box`: size is the width of the shape's box. |
|
|
1814
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient numbers given as colors are drawn with: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
1815
|
+
| `color_limits` | — | Limits of the series' color axis, as an axis' `limits`: `"-2/2"`, `"0/max"`, `"q:0.01/q:0.99"`; unset: `"auto"`, the values' range. |
|
|
1816
|
+
| `color_scale` | — | Scale of the series' color axis (`log`, `sqrt`, …); unset: `linear`. |
|
|
1817
|
+
| `color_axis` | — | A shared `ColorAxis` (`figure.color_axis(…)`) in place of the series' own: it holds the map, limits and scale. |
|
|
1818
|
+
| `color` | — | Stem and marker color; default: the next palette color. |
|
|
1819
|
+
| `line_width` | inherited (0.75) | Stem width. Length. |
|
|
1820
|
+
| `baseline` | 0.0 | Value the stems start from. |
|
|
1821
|
+
| `baseline_color` | '#4d4d4d' | Baseline color; `none`: no baseline. |
|
|
1822
|
+
| `baseline_width` | 0.75 | Baseline width. Length. |
|
|
1823
|
+
| `orientation` | 'vertical' | `vertical` stems (values on y) or `horizontal`. |
|
|
1824
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1825
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own. |
|
|
1826
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1827
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1828
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1829
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1830
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1831
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1832
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1833
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1834
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1835
|
+
|
|
1836
|
+
Groups: `Marker` (`marker_`), `Stroke` (`baseline_`), `Font`.
|
|
1837
|
+
<!-- /settings -->
|
|
1838
|
+
|
|
1839
|
+
### Regression
|
|
1840
|
+
|
|
1841
|
+
```python
|
|
1842
|
+
pl.Regression(x, y, plot=None, **settings)
|
|
1843
|
+
```
|
|
1844
|
+
|
|
1845
|
+
A least-squares polynomial of `order` with the confidence band of the mean (Student's t), or a LOWESS curve (`lowess=True`, no band); `logx` fits against log x; `range` sets the x range of the polynomial curve (default the data's), drawn in `points` points. The points are drawn too unless `scatter=False` (marker settings with the `marker_` prefix; numbers in `marker_color` map through the series' color axis, as on [Line](#line)). `regression.stats`: `coefficients` (lowest power first), `r2`, `se`, and the curve.
|
|
1846
|
+
|
|
1847
|
+
<!-- settings:Regression -->
|
|
1848
|
+
| Setting | Default | Meaning |
|
|
1849
|
+
|---|---|---|
|
|
1850
|
+
| `order` | 1 | Polynomial order (1–5). |
|
|
1851
|
+
| `lowess` | False | Fit a LOWESS curve instead (no band). |
|
|
1852
|
+
| `frac` | 0.6666666666666666 | Fraction of the points in each LOWESS fit. |
|
|
1853
|
+
| `ci` | 95.0 | Confidence level of the band (%); `None`: no band. |
|
|
1854
|
+
| `logx` | False | Fit y against log(x) (x > 0). |
|
|
1855
|
+
| `scatter` | True | Draw the points too. |
|
|
1856
|
+
| `range` | — | x range of the fitted polynomial (and band); default the data range. |
|
|
1857
|
+
| `points` | 100 | Points of the fitted curve. |
|
|
1858
|
+
| `color` | — | Line, band and point color; default the next palette color. |
|
|
1859
|
+
| `line_width` | 'calc(1.4 * inherit)' | Line width; default 1.4 × the plot's. Length. |
|
|
1860
|
+
| `line_style` | 'solid' | Line style or dash list. Length. |
|
|
1861
|
+
| `band_alpha` | 0.2 | Opacity of the band. |
|
|
1862
|
+
| `marker` | 'circle' | Marker name, `Path` or path data, or one per point. |
|
|
1863
|
+
| `marker_size` | 4.5 | Marker size: the diameter of the circle of equal area, in px; one value or one per point. Length. |
|
|
1864
|
+
| `marker_color` | — | Fill: a color, colors per point, numbers per point (mapped through `color_map`) or `"density"`. |
|
|
1865
|
+
| `marker_edge_color` | 'auto' | Outline: as the fill color, or `"auto"` (white around filled markers; hollow ones outlined in their color). |
|
|
1866
|
+
| `marker_edge_width` | 0.75 | Outline width; 0: no outline. Length. |
|
|
1867
|
+
| `marker_fill` | True | `True`: filled with the color; `False`: hollow, outlined in the color; an opacity (0–1): filled at that opacity and outlined in the color. |
|
|
1868
|
+
| `size_basis` | 'area' | `area`: shapes of the same size have the same area; `box`: size is the width of the shape's box. |
|
|
1869
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient numbers given as colors are drawn with: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
1870
|
+
| `color_limits` | — | Limits of the series' color axis, as an axis' `limits`: `"-2/2"`, `"0/max"`, `"q:0.01/q:0.99"`; unset: `"auto"`, the values' range. |
|
|
1871
|
+
| `color_scale` | — | Scale of the series' color axis (`log`, `sqrt`, …); unset: `linear`. |
|
|
1872
|
+
| `color_axis` | — | A shared `ColorAxis` (`figure.color_axis(…)`) in place of the series' own: it holds the map, limits and scale. |
|
|
1873
|
+
| `orientation` | 'vertical' | `vertical` (y on x) or `horizontal` (the fit drawn with x along the y axis). |
|
|
1874
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1875
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own. |
|
|
1876
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1877
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1878
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1879
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1880
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1881
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1882
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1883
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1884
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1885
|
+
|
|
1886
|
+
Groups: `Stroke`, `Marker` (`marker_`), `Font`.
|
|
1887
|
+
<!-- /settings -->
|
|
1888
|
+
|
|
1889
|
+
### Hist2d
|
|
1890
|
+
|
|
1891
|
+
```python
|
|
1892
|
+
pl.Hist2d(x, y, plot=None, **settings)
|
|
1893
|
+
```
|
|
1894
|
+
|
|
1895
|
+
Counts in rectangular bins (even on the axis scales), drawn as a heatmap with the heatmap's settings; bins below `min_count` are transparent; a colorbar source.
|
|
1896
|
+
|
|
1897
|
+
<!-- settings:Hist2d -->
|
|
1898
|
+
| Setting | Default | Meaning |
|
|
1899
|
+
|---|---|---|
|
|
1900
|
+
| `bins` | ('auto', 'auto') | Bins of both axes, or `(x bins, y bins)`: counts, edges or rules (as `Hist`). |
|
|
1901
|
+
| `range` | — | `((x0, x1), (y0, y1))`; default the data range. |
|
|
1902
|
+
| `weights` | — | A weight per point. |
|
|
1903
|
+
| `stat` | 'count' | `count`, `density` (volume 1), `probability` or `percent`. |
|
|
1904
|
+
| `min_count` | 1.0 | Bins below this count are transparent. |
|
|
1905
|
+
| `origin` | 'bottom' | Row of the first y bin. |
|
|
1906
|
+
<!-- /settings -->
|
|
1907
|
+
|
|
1908
|
+
### Hexbin
|
|
1909
|
+
|
|
1910
|
+
```python
|
|
1911
|
+
pl.Hexbin(x, y, plot=None, **settings)
|
|
1912
|
+
```
|
|
1913
|
+
|
|
1914
|
+
Counts in regular hexagons: `bins` hexagons across the axes width, on a lattice laid out
|
|
1915
|
+
in page units for the axes the layout places, so the hexagons tile exactly whatever the
|
|
1916
|
+
axes' aspect. The counts depend on the axes, and the color axis on the counts: the layout
|
|
1917
|
+
counts again when a round places the axes differently ([layout](#layout)). Points outside
|
|
1918
|
+
the axes are not counted. Colored by `cmap`; a colorbar source.
|
|
1919
|
+
|
|
1920
|
+
<!-- settings:Hexbin -->
|
|
1921
|
+
| Setting | Default | Meaning |
|
|
1922
|
+
|---|---|---|
|
|
1923
|
+
| `bins` | 30 | Hexagons across the axes width. |
|
|
1924
|
+
| `weights` | — | A weight per point (sums). |
|
|
1925
|
+
| `stat` | 'count' | `count`, `probability` or `percent`. |
|
|
1926
|
+
| `min_count` | 1.0 | Hexagons below this count are not drawn. |
|
|
1927
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient numbers given as colors are drawn with: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
1928
|
+
| `color_limits` | — | Limits of the series' color axis, as an axis' `limits`: `"-2/2"`, `"0/max"`, `"q:0.01/q:0.99"`; unset: `"auto"`, the values' range. |
|
|
1929
|
+
| `color_scale` | — | Scale of the series' color axis (`log`, `sqrt`, …); unset: `linear`. |
|
|
1930
|
+
| `color_axis` | — | A shared `ColorAxis` (`figure.color_axis(…)`) in place of the series' own: it holds the map, limits and scale. |
|
|
1931
|
+
| `edge_color` | — | Hexagon outline color; default none. |
|
|
1932
|
+
| `edge_width` | 0.0 | Outline width. Length. |
|
|
1933
|
+
| `colorbar` | False | Attach a colorbar to the plot. |
|
|
1934
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1935
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own. |
|
|
1936
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1937
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1938
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1939
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1940
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1941
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1942
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1943
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1944
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1945
|
+
|
|
1946
|
+
Groups: `Stroke` (`edge_`), `Font`.
|
|
1947
|
+
<!-- /settings -->
|
|
1948
|
+
|
|
1949
|
+
### Contour
|
|
1950
|
+
|
|
1951
|
+
```python
|
|
1952
|
+
pl.Contour(values, x=None, y=None, plot=None, **settings)
|
|
1953
|
+
```
|
|
1954
|
+
|
|
1955
|
+
Iso-lines (`lines`) and filled bands (`fill`) of a grid at nodes `x`/`y`. `levels`: a number of nice values over the data, or the values. Lines take the map's colors, or `palette` (one color, or colors per level in turn: a list or a palette name); `negative_style` dashes negative levels drawn in one color; `value_labels` writes the levels on the lines. Bands are colored by their middle value.
|
|
1956
|
+
|
|
1957
|
+
<!-- settings:Contour -->
|
|
1958
|
+
| Setting | Default | Meaning |
|
|
1959
|
+
|---|---|---|
|
|
1960
|
+
| `levels` | 10 | A number of levels (nice values over the data) or the level values. |
|
|
1961
|
+
| `fill` | False | Fill the bands between levels: `True`, an opacity (0–1, times `alpha`), or `False`. |
|
|
1962
|
+
| `lines` | True | Draw the iso-lines. |
|
|
1963
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient numbers given as colors are drawn with: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
1964
|
+
| `color_limits` | — | Limits of the series' color axis, as an axis' `limits`: `"-2/2"`, `"0/max"`, `"q:0.01/q:0.99"`; unset: `"auto"`, the values' range. |
|
|
1965
|
+
| `color_scale` | — | Scale of the series' color axis (`log`, `sqrt`, …); unset: `linear`. |
|
|
1966
|
+
| `color_axis` | — | A shared `ColorAxis` (`figure.color_axis(…)`) in place of the series' own: it holds the map, limits and scale. |
|
|
1967
|
+
| `palette` | — | Line color, or colors taken per level in turn (a list or a palette name), instead of the map. |
|
|
1968
|
+
| `line_width` | 'calc(0.6 * inherit)' | Line width; default 0.6 × the plot's. Length. |
|
|
1969
|
+
| `line_style` | 'solid' | Line style. Length. |
|
|
1970
|
+
| `negative_style` | — | Line style of negative levels drawn with a single color (matplotlib: dashed). |
|
|
1971
|
+
| `alpha` | 1.0 | Opacity. |
|
|
1972
|
+
| `value_labels` | False | Write the level values on the lines. |
|
|
1973
|
+
| `value_label_format` | 'auto' | Number format of the value labels. |
|
|
1974
|
+
| `value_label_font_size` | '0.8em' | Label font size. Length; `%`: of the font size. |
|
|
1975
|
+
| `colorbar` | False | Attach a colorbar to the plot. |
|
|
1976
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
1977
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
1978
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
1979
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
1980
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
1981
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
1982
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
1983
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
1984
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
1985
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
1986
|
+
| `decimal_separator` | inherited ('.') | Decimal separator of numbers (`"."`). |
|
|
1987
|
+
| `thousands_separator` | inherited ('') | Thousands separator (`""`: none). |
|
|
1988
|
+
| `minus` | inherited ('hyphen') | `hyphen` (`-`) or `minus` (U+2212, from an installed font). |
|
|
1989
|
+
| `prefix` | inherited ('') | Text before every number. |
|
|
1990
|
+
| `suffix` | inherited ('') | Text after every number. |
|
|
1991
|
+
| `precision` | inherited (None) | Significant digits of `auto`, `sci`, `eng`, `si` (unset: as needed). |
|
|
1992
|
+
|
|
1993
|
+
Groups: `FillStyle`, `Stroke`, `TextStyle` (`value_label_`), `Font`, `NumberFormat`.
|
|
1994
|
+
<!-- /settings -->
|
|
1995
|
+
|
|
1996
|
+
### Pie
|
|
1997
|
+
|
|
1998
|
+
```python
|
|
1999
|
+
pl.Pie(values, plot=None, **settings)
|
|
2000
|
+
```
|
|
2001
|
+
|
|
2002
|
+
Wedges of `values` (a sequence or a dict `{label: value}`) from `start`, on a plot drawn without axes (`Plot.axes=False`, aspect 1). `hole` makes a donut (`"40%"` of the radius), `explode` moves wedges out (`%` of the radius, one value or one per wedge). Names go outside (pushed apart so that they do not overlap), inside, or into the legend (`name_position="none"`, the legend then outside right); `palette` colors them in turn; `value_labels` writes percents or values inside, or outside with a leader line when a wedge is too thin.
|
|
2003
|
+
|
|
2004
|
+
<!-- settings:Pie -->
|
|
2005
|
+
| Setting | Default | Meaning |
|
|
2006
|
+
|---|---|---|
|
|
2007
|
+
| `names` | — | Wedge names (default: the dict's keys). |
|
|
2008
|
+
| `palette` | — | Wedge colors, taken in turn: a list of colors or a palette name; default the plot's palette. |
|
|
2009
|
+
| `start` | 90.0 | Angle where the first wedge starts (degrees, 0: 3 o'clock, 90: 12 o'clock). Angle (bare: degrees). |
|
|
2010
|
+
| `counterclockwise` | True | Direction of the wedges. |
|
|
2011
|
+
| `hole` | 0.0 | Radius of the hole (`%` of the radius): a donut. Length; `%`: of the radius. |
|
|
2012
|
+
| `explode` | — | Offset of the wedges from the centre (`%` of the radius): one value or one per wedge. Length; `%`: of the radius. |
|
|
2013
|
+
| `sort` | False | Sort the wedges by decreasing value. |
|
|
2014
|
+
| `name_position` | 'outside' | Where the names go: `outside`, `inside` or `none` (in the legend instead). |
|
|
2015
|
+
| `value_labels` | False | Write each wedge's `percent` or `value` inside it (outside, with a leader line, when it does not fit). |
|
|
2016
|
+
| `label_spacing` | '1.25em' | Smallest distance between outside labels on a side. Length; `%`: of the font size. |
|
|
2017
|
+
| `value_label_format` | 'auto' | Number format of the value labels (percentages: of 100). |
|
|
2018
|
+
| `edge_color` | 'series' | Wedge outline color: a color, `"series"` (each wedge's own color) or `none`. |
|
|
2019
|
+
| `edge_width` | 1.25 | Wedge outline width. Length. |
|
|
2020
|
+
| `alpha` | 1.0 | Opacity. |
|
|
2021
|
+
| `fill` | 0.25 | Wedge fill: an opacity of each wedge's color, times `alpha` (outlines keep `alpha`); `True` (opaque), a color, or `False`. |
|
|
2022
|
+
| `seam_color` | 'white' | The edges neighbouring wedges share, in this color; `none`: both outlines as drawn. |
|
|
2023
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
2024
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
2025
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
2026
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
2027
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
2028
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
2029
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
2030
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
2031
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
2032
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
2033
|
+
| `decimal_separator` | inherited ('.') | Decimal separator of numbers (`"."`). |
|
|
2034
|
+
| `thousands_separator` | inherited ('') | Thousands separator (`""`: none). |
|
|
2035
|
+
| `minus` | inherited ('hyphen') | `hyphen` (`-`) or `minus` (U+2212, from an installed font). |
|
|
2036
|
+
| `prefix` | inherited ('') | Text before every number. |
|
|
2037
|
+
| `suffix` | inherited ('') | Text after every number. |
|
|
2038
|
+
| `precision` | inherited (None) | Significant digits of `auto`, `sci`, `eng`, `si` (unset: as needed). |
|
|
2039
|
+
|
|
2040
|
+
Groups: `Stroke` (`edge_`), `FillStyle`, `Font`, `NumberFormat`.
|
|
2041
|
+
<!-- /settings -->
|
|
2042
|
+
|
|
2043
|
+
## 6. Color and size axes
|
|
2044
|
+
|
|
2045
|
+
Numbers given as colors (per point, per cell, per category, or a density) go through a
|
|
2046
|
+
**color axis** before they become colors, as positions go through an x axis: its scale
|
|
2047
|
+
and limits take each value to [0, 1], and its gradient (a `ColorMap`) gives the color.
|
|
2048
|
+
Sizes go through a **size axis** the same way, with a `SizeMap` (diameters) in place of
|
|
2049
|
+
the gradient. A colorbar is the guide of a color axis, a size key that of a size axis.
|
|
2050
|
+
|
|
2051
|
+
```python
|
|
2052
|
+
h = p.heatmap(v, cmap="magma", color_limits="q:0.01/q:0.99", color_scale="log")
|
|
2053
|
+
h.color_axis # the series' own color axis
|
|
2054
|
+
ca = fig.color_axis(color_map="magma", limits="0/max") # a shared one
|
|
2055
|
+
p.heatmap(v, color_axis=ca)
|
|
2056
|
+
q.scatter(x, y, c=z, color_axis=ca)
|
|
2057
|
+
fig.colorbar(ca, id=5, label="energy")
|
|
2058
|
+
fig = pl.Figure(cols=3, share_color="row") # each row's plots: one color axis
|
|
2059
|
+
fig = pl.Figure(cols=3, share_size="all") # one size axis, one size key
|
|
2060
|
+
```
|
|
2061
|
+
|
|
2062
|
+
* **Own axes.** A series that maps values has its own color axis, `series.color_axis`
|
|
2063
|
+
(and size axis, `series.size_axis`). Its `scale` is the series' `color_scale`, its
|
|
2064
|
+
`limits` the series' `color_limits` (axis syntax: `"auto"`, the values' range;
|
|
2065
|
+
`"0/max"`, `"q:0.01/q:0.99"`, `[lo, hi]`), its gradient the series' `color_map`
|
|
2066
|
+
(inherited: the plot's, the figure's, the style's). Its other settings (ticks,
|
|
2067
|
+
`tick_format`, `label`, fonts) are drawn by its colorbar. A `scale` or `limits` set on
|
|
2068
|
+
the axis itself wins over the series' settings.
|
|
2069
|
+
* **Shared axes.** `fig.color_axis(**settings)` (`fig.size_axis(**settings)`) makes an
|
|
2070
|
+
axis that series take as `color_axis=` (`size_axis=`). It holds the gradient
|
|
2071
|
+
(`color_map`; sizes: `size_map`), the scale and the limits; its automatic limits cover
|
|
2072
|
+
every series using it, and those series take no `color_map`, `color_limits` or
|
|
2073
|
+
`color_scale` of their own (an error). A `pl.ColorAxis(**settings)` made alone joins
|
|
2074
|
+
the figure of the first series given it. The members of a `group=` call share one axis
|
|
2075
|
+
of each kind.
|
|
2076
|
+
* **`share_color`.** The figure's `share_color` (`False`, `True`/`"all"`, `"col"` or
|
|
2077
|
+
`"row"`, as `share_x`) makes the own color axes of each group's plots one axis: limits
|
|
2078
|
+
over all their values; one `color_limits` (or scale) applies to the group, two
|
|
2079
|
+
different ones are an error. Each series keeps its gradient. Facet figures share
|
|
2080
|
+
color this way (`"all"` by default).
|
|
2081
|
+
* **`share_size`** does the same for the own size axes: limits over all the group's
|
|
2082
|
+
values, one `size_limits` (or `size_scale`) for the group, and one size key for the
|
|
2083
|
+
group ([legend](#legend)). Each series keeps its `size_map`. Facet figures share size
|
|
2084
|
+
too (`"all"`).
|
|
2085
|
+
* **Training.** Before the layout, each axis is resolved from the values it maps, by the
|
|
2086
|
+
code of x and y axes: the scale's domain, `limits` and quantiles, `include_zero`, no
|
|
2087
|
+
padding (unless `padding` is set). Values past the limits take the gradient's
|
|
2088
|
+
`under`/`over` colors and missing values its `bad` color (sizes: the `SizeMap`'s).
|
|
2089
|
+
|
|
2090
|
+
Color and size axes have the settings of [axes](#4-axes); these differ:
|
|
2091
|
+
|
|
2092
|
+
<!-- settings:ColorAxis -->
|
|
2093
|
+
| Setting | Default | Meaning |
|
|
2094
|
+
|---|---|---|
|
|
2095
|
+
| `scale` | — | Scale of the mapped values: `linear`, `log`, `log2`, `log10`, `sqrt`, `exp`, `symlog` or `logit`; default `linear`. |
|
|
2096
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
2097
|
+
<!-- /settings -->
|
|
2098
|
+
|
|
2099
|
+
<!-- settings:SizeAxis -->
|
|
2100
|
+
| Setting | Default | Meaning |
|
|
2101
|
+
|---|---|---|
|
|
2102
|
+
| `scale` | — | Scale of the mapped values: `linear`, `log`, `log2`, `log10`, `sqrt`, `exp`, `symlog` or `logit`; default `linear`. |
|
|
2103
|
+
| `size_map` | — | The sizes: a `SizeMap` or a pair of diameters; default `SizeMap()`. |
|
|
2104
|
+
<!-- /settings -->
|
|
2105
|
+
|
|
2106
|
+
### Colorbars
|
|
2107
|
+
|
|
2108
|
+
```python
|
|
2109
|
+
p.colorbar(source=None, **settings) # attached to a side of the plot
|
|
2110
|
+
fig.colorbar(source, id=None, **settings) # in its own grid area
|
|
2111
|
+
cb.axis # the color axis shown
|
|
2112
|
+
```
|
|
2113
|
+
|
|
2114
|
+
`source` is a mapped series (its color axis; default: the plot's last mapped series) or
|
|
2115
|
+
a color axis. The bar draws the axis' gradient between its trained limits, with the
|
|
2116
|
+
axis' ticks, number format and fonts, and a label: `label`, else the axis' `label`, else
|
|
2117
|
+
the name of the color column or density. Attached bars take margin on their side, so axes
|
|
2118
|
+
stay aligned. A bar in its own area runs along the neighbouring axes (`align="axes"`) or
|
|
2119
|
+
boxes (`"borders"`). Axis settings given to a bar go to its axis:
|
|
2120
|
+
`p.colorbar(h, label="z", tick_format="{:.0%}")` sets `h.color_axis`'s tick format.
|
|
2121
|
+
|
|
2122
|
+
<!-- settings:Colorbar -->
|
|
2123
|
+
| Setting | Default | Meaning |
|
|
2124
|
+
|---|---|---|
|
|
2125
|
+
| `position` | 'right' | Side of the plot an attached bar takes. |
|
|
2126
|
+
| `orientation` | 'auto' | Bar direction; `"auto"`: vertical, or horizontal for bars attached at the top or bottom. |
|
|
2127
|
+
| `thickness` | 13.0 | Bar thickness (`%` of the attached axes side across it). Length; `%`: of the axes side across the colorbar. |
|
|
2128
|
+
| `length` | '100%' | Bar length as a fraction of the axes side (attached bars). Length; `%`: of the axes side along the colorbar. |
|
|
2129
|
+
| `pad` | 11.0 | Gap between the axes and an attached bar. Length; `%`: of the axes side across the colorbar. |
|
|
2130
|
+
| `label` | — | Bar label: a string or rich content; default: the axis' `label`, else the name of the color column or density. |
|
|
2131
|
+
| `extend` | 'auto' | Ends in the under/over colors: `auto` shows them when the limits clip the data. |
|
|
2132
|
+
| `extend_shape` | 'block' | `block`: a separate block at the end of the bar, within its length; `triangle`: a triangle past the bar's end. |
|
|
2133
|
+
| `frame` | False | Outline the bar. |
|
|
2134
|
+
| `frame_color` | '#666666' | Outline color. |
|
|
2135
|
+
| `frame_width` | 0.5 | Outline width. Length. |
|
|
2136
|
+
|
|
2137
|
+
Groups: `Stroke` (`frame_`).
|
|
2138
|
+
<!-- /settings -->
|
|
2139
|
+
|
|
2140
|
+
## 7. Colors, maps and markers
|
|
2141
|
+
|
|
2142
|
+
### Colors and palette
|
|
2143
|
+
|
|
2144
|
+
Colors are anything vec_io accepts (CSS names, `#hex`, `(r, g, b[, a])` floats,
|
|
2145
|
+
`CMYK`, `Spot`) or `"C0"`, `"C1"`, … for palette entries; `"none"` paints nothing. The
|
|
2146
|
+
default palette (`"tab10_custom"`, `plot_io.color.palettes.PALETTE`) is tab10's ten hues as named colors: sky,
|
|
2147
|
+
amber, emerald, rose, purple 0.4, yellow 0.7, pink 0.4, gray, lime, cyan.
|
|
2148
|
+
|
|
2149
|
+
`palette` takes a `pl.Palette`, a registered name (`"tab10"`; `"tab10_r"` reversed), a
|
|
2150
|
+
list of colors (or one comma-separated string: `"red, teal 0.7"`), or a function `n -> colors`, called with the number of series of the plot
|
|
2151
|
+
that take a palette color.
|
|
2152
|
+
|
|
2153
|
+
```python
|
|
2154
|
+
pl.Palette(colors="tab10_custom", name=None) # a name, colors, a Palette or n -> colors
|
|
2155
|
+
pl.register_palette(name, palette) # a Palette, colors or a function
|
|
2156
|
+
pl.palette_names()
|
|
2157
|
+
```
|
|
2158
|
+
|
|
2159
|
+
| `Palette` | |
|
|
2160
|
+
|---|---|
|
|
2161
|
+
| `colors(n=None)` | the colors: all, or `n` (a list repeats, as series reuse it; a function is called with `n`) |
|
|
2162
|
+
| `len(p)`, `p[i]`, `p[a:b]`, `iter(p)` | lists only: count; a color (indices wrap); a sub-palette |
|
|
2163
|
+
| `reversed()`, `lighter(k=0.25)`, `darker(k=0.25)` | copies: reversed; each color moved by `k` toward white or black in Oklab |
|
|
2164
|
+
|
|
2165
|
+
`ColorMap.to_palette(n)` samples a gradient into `n` colors, at the centers of `n` equal
|
|
2166
|
+
parts: `palette=pl.ColorMap("viridis").to_palette(5)` for ordered categories.
|
|
2167
|
+
|
|
2168
|
+
| Palette | Colors |
|
|
2169
|
+
|---|---|
|
|
2170
|
+
| `tab10_custom` | plot_io's default: tab10's hues as named colors (10) |
|
|
2171
|
+
| `okabe_ito` | Okabe–Ito's eight colorblind-safe colors plus indigo and dark brown, chosen as the pair farthest from every other color (in Oklab) under normal and simulated protan, deutan and tritan vision (10) |
|
|
2172
|
+
| `tab10` | matplotlib ≥ 2.0, d3's category10 (10) |
|
|
2173
|
+
| `matplotlib_classic` | matplotlib 1.x: b, g, r, c, m, y, k (7) |
|
|
2174
|
+
| `tableau10` | Vega-Lite's default (10) |
|
|
2175
|
+
| `deep`, `muted`, `pastel`, `bright`, `dark`, `colorblind` | seaborn (10 each) |
|
|
2176
|
+
| `hue` | ggplot2's `hue_pal()`: n hues 360/n apart from 15°, chroma 100, luminance 65 (CIE LCh(uv)) |
|
|
2177
|
+
| `matlab` | MATLAB R2014b+ `lines` (7) |
|
|
2178
|
+
| `chartjs` | Chart.js 4 (7) |
|
|
2179
|
+
| `plotly` | plotly's default colorway (10) |
|
|
2180
|
+
| `observable10` | Observable Plot (d3's observable10) (10) |
|
|
2181
|
+
| `office` | Excel 2013+ Office theme (10) |
|
|
2182
|
+
| `economist` | The Economist (ggthemes, pre-2017) (10) |
|
|
2183
|
+
| `fivethirtyeight` | matplotlib's fivethirtyeight style (6) |
|
|
2184
|
+
| `greys` | black to light grey (4) |
|
|
2185
|
+
| `set1`, `set2`, `set3`, `paired`, `accent`, `dark2`, `pastel1`, `pastel2` | ColorBrewer's qualitative schemes by Brewer (Apache-2.0) (8–12) |
|
|
2186
|
+
| `batlow`, `batlowk`, `batloww`, `devon`, `lajolla`, `bamako`, `davos`, `bilbao`, `nuuk`, `oslo`, `grayc`, `hawaii`, `lapaz`, `tokyo`, `buda`, `acton`, `turku`, `imola`, `glasgow`, `lipari`, `navia` | Crameri's categorical Scientific colour maps 8 (MIT): the first colors differ most (100) |
|
|
2187
|
+
|
|
2188
|
+
### Color maps
|
|
2189
|
+
|
|
2190
|
+
```python
|
|
2191
|
+
pl.ColorMap(colors="rainbow_llhh", positions=None, under=None, over=None, bad=None,
|
|
2192
|
+
space=None, name=None, interpolation=None, widen_colors=1, widen_sides=1.0)
|
|
2193
|
+
pl.register_color_map(name, color_map)
|
|
2194
|
+
pl.color_map_names()
|
|
2195
|
+
```
|
|
2196
|
+
|
|
2197
|
+
| Member | |
|
|
2198
|
+
|---|---|
|
|
2199
|
+
| `colors` | a name (`viridis`, `magma`, `inferno`, `plasma`, `cividis`, `coolwarm`, `grey`, `rocket`, `mako`, `flare`, `crest`, `vlag`, `icefire`, `jet`, `parula`, `turbo`, `ggplot2`, the rainbows, ColorBrewer's and Crameri's maps below, in any case (`"RdBu"`, `"batlowK"`); `_r` reverses), a list of colors (evenly spaced or at `positions`; or one string, comma-separated: `"violet 0.4, sky 0.4, green 0.4"`), a `ColorMap` (copied) or a function `t -> color` |
|
|
2200
|
+
| `under`, `over`, `bad` | colors below 0 and above 1, past the color axis' limits (default: the end colors), and of missing values (default: transparent) |
|
|
2201
|
+
| `space` | interpolation between the colors: `"oklab"` (default, for every map: perceptually even) or `"srgb"` |
|
|
2202
|
+
| `interpolation` | `"linear"` (default): between neighboring colors; `"nearest"`: equal steps, one per color (`n` colors, `n` bins; with `positions`, each step starts at its position; a value on an edge takes the upper step); `"smooth"`: a Bézier curve with the colors as control points, through the first and last only (no `positions`); `"spline"`: a monotone cubic curve through every color (PCHIP in Oklab: no overshoot between colors) |
|
|
2203
|
+
| `widen_colors`, `widen_sides` | each inner color of a list repeated `widen_colors` times, each end color `round(widen_sides × widen_colors)` times: wider bands around the colors |
|
|
2204
|
+
| `cm(t)`, `colors_at(ts)` | color at t ∈ [0, 1]; bulk colors (C: continuous maps through a table of 4,096 colors, steps exactly) |
|
|
2205
|
+
| `table(n)`, `cells(values, lo, hi, mode)` | n colors sampled evenly; what heatmap cells hand vec_io's `draw_cells` (C): palette indices into `table(255)` (`table(253)` plus the under and over colors), or for `smooth` positions along `table(256)` (steps: the step colors and their bounds) |
|
|
2206
|
+
| `reversed()`, `resampled(n)`, `truncated(lo, hi)`, `with_extremes(…)` | copies: reversed; n flat steps; a part stretched to [0, 1]; new extremes |
|
|
2207
|
+
| `to_palette(n)` | a `Palette` of `n` colors sampled at the centers of `n` equal parts |
|
|
2208
|
+
|
|
2209
|
+
Bundled data: viridis, magma, inferno and plasma by van der Walt and Smith (CC0); cividis
|
|
2210
|
+
by Nuñez, Anderton and Renslow; coolwarm by Moreland; rocket, mako, flare, crest, vlag and
|
|
2211
|
+
icefire from seaborn by Waskom (BSD-3-Clause); jet from matplotlib; a parula-like map;
|
|
2212
|
+
turbo by Mikhailov (Google, Apache-2.0);
|
|
2213
|
+
the rainbows, built from named colors with `widen_colors=6, widen_sides=0.6` and
|
|
2214
|
+
`interpolation="smooth"` (violet, sky,
|
|
2215
|
+
green, yellow, orange, rose): `rainbow` (all at level 0.4), `rainbow_neutral` (0.5),
|
|
2216
|
+
`rainbow_l0hh` (from white, then levels 0.1 to 0.6), `rainbow_llhh` (0.16 to 0.6),
|
|
2217
|
+
`rainbow_llh` (0.16 to 0.4), `rainbow_hlh` (dark ends, light middle); diverging maps from
|
|
2218
|
+
named colors: `blue_white_red` (sky, white, rose), `blue_white_red_hc` (levels 0.6 at the
|
|
2219
|
+
ends), `blue_gray_red` (a gray 0.2 middle), `blue_gray_red_hc`;
|
|
2220
|
+
ColorBrewer's schemes by Brewer (Apache-2.0): sequential `blues`, `bugn`, `bupu`, `gnbu`,
|
|
2221
|
+
`greens`, `greys`, `oranges`, `orrd`, `pubu`, `pubugn`, `purd`, `purples`, `rdpu`, `reds`,
|
|
2222
|
+
`ylgn`, `ylgnbu`, `ylorbr`, `ylorrd` (9 colors) and diverging `brbg`, `piyg`, `prgn`, `puor`,
|
|
2223
|
+
`rdbu`, `rdgy`, `rdylbu`, `rdylgn`, `spectral` (11 colors); Crameri's Scientific colour maps
|
|
2224
|
+
8 (MIT; Crameri, Shephard and Heron 2020): sequential `batlow`, `batlowk`, `batloww`,
|
|
2225
|
+
`devon`, `lajolla`, `bamako`, `davos`, `bilbao`, `nuuk`, `oslo`, `grayc`, `hawaii`, `lapaz`,
|
|
2226
|
+
`tokyo`, `buda`, `acton`, `turku`, `imola`, `glasgow`, `lipari`, `navia`, diverging `broc`,
|
|
2227
|
+
`cork`, `vik`, `lisbon`, `tofino`, `berlin`, `roma`, `bam`, `vanimo`, `managua`,
|
|
2228
|
+
multi-sequential `oleron`, `bukavu`, `fes` and cyclic `romao`, `bamo`, `broco`, `corko`,
|
|
2229
|
+
`viko` (256 colors each);
|
|
2230
|
+
`ggplot2` is ggplot2's continuous default (`#132B43` → `#56B1F7`). The
|
|
2231
|
+
`color_map` setting (alias `cmap`; inherited, default `"rainbow_llhh"`) is the gradient of
|
|
2232
|
+
heatmaps, contours and numbers given as colors. A `ColorMap` is a gradient over [0, 1]
|
|
2233
|
+
only: the values' limits and scale are their [color axis](#6-color-and-size-axes)'s, so
|
|
2234
|
+
series given one `ColorMap` object keep limits of their own; a shared color axis shares
|
|
2235
|
+
limits.
|
|
2236
|
+
|
|
2237
|
+
### Size maps
|
|
2238
|
+
|
|
2239
|
+
```python
|
|
2240
|
+
pl.SizeMap(sizes=(3, 13), by="area", under=None, over=None, bad=None)
|
|
2241
|
+
```
|
|
2242
|
+
|
|
2243
|
+
`sizes` are the diameters at the limits of the [size axis](#6-color-and-size-axes).
|
|
2244
|
+
`by="area"` moves the area linearly between the end areas (with `sizes=(0, d)` and
|
|
2245
|
+
`size_limits="0/max"`, area is proportional to the value); `by="diameter"` moves the
|
|
2246
|
+
diameter. `under`/`over` default to the end sizes; `"none"` leaves those points out.
|
|
2247
|
+
`bad` (missing values) leaves them out by default. `size_map` also takes a pair of
|
|
2248
|
+
diameters.
|
|
2249
|
+
|
|
2250
|
+
### Values in color and size
|
|
2251
|
+
|
|
2252
|
+
| Given to `color` (also `edge_color`, `marker_color`, `marker_edge_color`) | Meaning |
|
|
2253
|
+
|---|---|
|
|
2254
|
+
| a color string, `CMYK`, `Spot`, or a **tuple** of 3 or 4 numbers | one color |
|
|
2255
|
+
| a list of colors | one color per point |
|
|
2256
|
+
| a **list, array or other buffer of numbers** | one value per point, mapped through the color axis |
|
|
2257
|
+
| an `(n, 3)` or `(n, 4)` buffer | one color per point |
|
|
2258
|
+
| `"density"` or `pl.Density(…)` | the points' density, mapped through the color axis |
|
|
2259
|
+
| a dict `{category: number}` or `{category: color}` (box, bar, violin) | per category |
|
|
2260
|
+
|
|
2261
|
+
A tuple of numbers is always one color and a list of numbers is always values, so
|
|
2262
|
+
`color=[0.2, 0.4, 0.6]` with a point count other than 3 is an error (use a tuple for one
|
|
2263
|
+
RGB color). A `ColorMap` goes in `color_map`, not `color`. Values go through the series'
|
|
2264
|
+
color axis wherever a series maps them: points (Scatter, Strip, Swarm `color` and
|
|
2265
|
+
`edge_color`; the markers of Line, Errorbar, Stem and Regression), cells, categories (Box,
|
|
2266
|
+
Bar, Violin `color`). A box's outliers are computed, so its `marker_color` and
|
|
2267
|
+
`marker_edge_color` take colors only. A line's `color` and every `edge_color` of bars,
|
|
2268
|
+
boxes, violins, pies and hexagons are one color. Values elsewhere are errors that name the
|
|
2269
|
+
setting.
|
|
2270
|
+
|
|
2271
|
+
`size` takes a diameter (a length), diameters per point (px), or values per point mapped
|
|
2272
|
+
through the size axis when the series has a `size_map` or a `size_axis`; `"density"` is
|
|
2273
|
+
always mapped (default sizes `SizeMap()`). A `SizeMap` goes in `size_map`. `marker_size`
|
|
2274
|
+
(lines, error bars, stems, regressions, box outliers) is diameters in px only: those
|
|
2275
|
+
series have no size axis.
|
|
2276
|
+
|
|
2277
|
+
Aliases, on every class with the setting: `c` = `color`, `s` = `size`, `cmap` =
|
|
2278
|
+
`color_map`, `smap` = `size_map` (also in style keys). Giving both names is an error.
|
|
2279
|
+
|
|
2280
|
+
### Point density
|
|
2281
|
+
|
|
2282
|
+
```python
|
|
2283
|
+
p.scatter(x, y, c="density", draw_order="density") # densest points drawn last
|
|
2284
|
+
p.scatter(x, y, c=pl.Density(adjust=0.5, normalize="max"), cmap="magma")
|
|
2285
|
+
pl.Density(bandwidth="scott", adjust=1.0, normalize="pdf", method="auto", grid=512)
|
|
2286
|
+
```
|
|
2287
|
+
|
|
2288
|
+
The 2-D Gaussian kernel density at each point of the series, as scipy's
|
|
2289
|
+
`gaussian_kde(np.array([x, y]))(np.array([x, y]))`: the kernel covariance is the data
|
|
2290
|
+
covariance times Scott's factor n^(-1/6) (`"silverman"`: Silverman's), or a number
|
|
2291
|
+
(isotropic standard deviation) or a 2 × 2 matrix; `adjust` multiplies it. It is computed
|
|
2292
|
+
on the axis positions (log axes in log space); NaN points get NaN. `normalize`: `"pdf"`
|
|
2293
|
+
(scipy's values), `"count"` (points per unit area) or `"max"` (0–1); colors are the same
|
|
2294
|
+
under automatic limits. `method`: `"exact"` (the sum over all points, multithreaded in
|
|
2295
|
+
C, equal to scipy's), `"grid"` (binned, blurred and read back, about 1e-4 relative) or
|
|
2296
|
+
`"auto"` (exact up to 20,000 points). A `Density` (or `"density"`) is accepted by
|
|
2297
|
+
`color`, `edge_color`, `size` (through the size axis, default `SizeMap()`), `alpha` (mapped
|
|
2298
|
+
linearly to `alpha_range`, default (0.2, 1)) and `draw_order`, and by `marker_color` and
|
|
2299
|
+
`marker_edge_color` of Line (one line), Errorbar, Stem and Regression; one object computes each
|
|
2300
|
+
series' own density, cached until a setting changes, and exposed as
|
|
2301
|
+
`series.stats["density"]`. The colorbar label defaults to `"density"`.
|
|
2302
|
+
|
|
2303
|
+
### Drawing order
|
|
2304
|
+
|
|
2305
|
+
`draw_order` on scatter, strip and swarm: `None` (call order), `"density"` (ascending: the
|
|
2306
|
+
densest points are drawn last), `"-density"`, or sort keys per point (ascending; give
|
|
2307
|
+
`-z` for descending). Every per-point column (positions, colors, sizes, markers, opacities)
|
|
2308
|
+
is reordered together; the sort is stable and NaN keys come first. Setting `color` to a
|
|
2309
|
+
density does not reorder by itself.
|
|
2310
|
+
|
|
2311
|
+
### Number formats
|
|
2312
|
+
|
|
2313
|
+
One format applies wherever a number becomes text: `tick_format` (plot and colorbar
|
|
2314
|
+
axes) and `value_label_format` (value labels of bars, histograms, heatmaps, contours and
|
|
2315
|
+
pies).
|
|
2316
|
+
|
|
2317
|
+
| Format | 1234.5, 0.05, −2 as one label set |
|
|
2318
|
+
|---|---|
|
|
2319
|
+
| `"auto"` (default) | `1234.50`, `0.05`, `-2.00`: the fewest equal decimals; on axes, a ×10ᵏ factor beyond `sci_limits`, elsewhere each label in scientific form |
|
|
2320
|
+
| a format string | `"{:.1f} ms"` → `1234.5 ms` (`str.format`, one field) |
|
|
2321
|
+
| a function | `value -> str` or `value -> rich content` |
|
|
2322
|
+
| `"percent"` | `123450%`, `5%`, `-200%` |
|
|
2323
|
+
| `"sci"` | `1.2345×10³`, `5.0000×10⁻²`, `-2.0000` (no ×10⁰) |
|
|
2324
|
+
| `"eng"` | `1.2345×10³`, `50.0000×10⁻³`, `-2.0000` (exponents multiples of 3) |
|
|
2325
|
+
| `"si"` | `1.2345k`, `50.0000m`, `-2.0000` (y … Y, µ for 10⁻⁶) |
|
|
2326
|
+
| `"int"` | `1235`, `0`, `-2` |
|
|
2327
|
+
|
|
2328
|
+
Every preset chooses the decimals for all labels together, so they line up (`1.0k`,
|
|
2329
|
+
`1.5k`, `2.0k`); halves round away from zero (`1234.5` → `1235`), and a value rounding
|
|
2330
|
+
to the next power is written in it (`9.96` at 2 digits → `10`). NaN gives an empty label.
|
|
2331
|
+
Format strings and functions get the raw value; separators, minus and affixes then apply
|
|
2332
|
+
to the numbers in their result (rich content is used as is).
|
|
2333
|
+
|
|
2334
|
+
Inherited settings (figure → plot → axis; series → its color axis):
|
|
2335
|
+
|
|
2336
|
+
| Setting | Default | Values |
|
|
2337
|
+
|---|---|---|
|
|
2338
|
+
| `decimal_separator` | `"."` | any string |
|
|
2339
|
+
| `thousands_separator` | `""` | any string (`","`, `"."`, `" "`; a thin space U+2009 needs an embedded font) |
|
|
2340
|
+
| `minus` | `"hyphen"` | `"hyphen"` (`-`, every font; exponents too) or `"minus"` (U+2212, taken from an installed font, which is then embedded) |
|
|
2341
|
+
| `prefix`, `suffix` | `""` | text around every number |
|
|
2342
|
+
| `precision` | unset | significant digits of `auto`, `sci`, `eng`, `si` (unset: as needed to tell the labels apart) |
|
|
2343
|
+
|
|
2344
|
+
### Markers
|
|
2345
|
+
|
|
2346
|
+
| Name | Area of the unit shape |
|
|
2347
|
+
|---|---|
|
|
2348
|
+
| `circle` | π/4 |
|
|
2349
|
+
| `square` | 1 |
|
|
2350
|
+
| `diamond` | 0.5 |
|
|
2351
|
+
| `triangle_up`, `triangle_down`, `triangle_left`, `triangle_right` | √3/4 |
|
|
2352
|
+
| `plus` | 0.51 |
|
|
2353
|
+
| `cross` | 0.5754 |
|
|
2354
|
+
|
|
2355
|
+
Aliases: `triangle`, `o`, `s`, `d`, `^`, `v`, `<`, `>`, `+`, `x`. A `vec_io.Path` or SVG
|
|
2356
|
+
path data in a unit box centred on the origin also works. `pl.register_marker(name, path)`
|
|
2357
|
+
adds a shape (its area measured from the outline); `plot_io.markers.marker_path(name)` returns a path
|
|
2358
|
+
for vec_io's `draw_markers`; `plot_io.markers.marker_area(name)` its area.
|
|
2359
|
+
|
|
2360
|
+
## 8. Output
|
|
2361
|
+
|
|
2362
|
+
```python
|
|
2363
|
+
fig.save(path, **options) # .pdf, .png, .jpg/.jpeg, .jxl, .avif
|
|
2364
|
+
fig.to_bytes(format="pdf", **options)
|
|
2365
|
+
fig.draw(canvas, x=0, y=0) # on any vec_io canvas (its document's fonts); returns (width, height) in px
|
|
2366
|
+
fig.size() # (width, height) in px
|
|
2367
|
+
p.save(path, …) p.to_bytes(…) p.draw(canvas, …) # one plot alone, at its size in the figure
|
|
2368
|
+
```
|
|
2369
|
+
|
|
2370
|
+
The figure is drawn once on a page of a vec_io document in px; each output is made from
|
|
2371
|
+
it with its own options:
|
|
2372
|
+
|
|
2373
|
+
| Options | Of |
|
|
2374
|
+
|---|---|
|
|
2375
|
+
| `title`, `author`, `subject`, `keywords`, `creator`, `creation_date`, `pdf_a`, `color_mode`, `ink_limit`, `icc_profile`, `base_dir` | the document (vec_io `Document`) |
|
|
2376
|
+
| `font_dirs`, `system_fonts` | the fonts text is shaped and embedded with ([fonts](#1-conventions)) |
|
|
2377
|
+
| `quality` | the figure's `quality` when not given: 1–100, `"lossless"` (not JPEG) or `"auto"`, the default: PNG 90, a palette of at most 256 colors; JPEG 90; JPEG XL, AVIF and rasterized content in a PDF lossless |
|
|
2378
|
+
| `compression` | `"fast"`, `"balanced"` (default), `"best"`: the encoder's effort (PDF streams and images, PNG, JPEG, JPEG XL, AVIF) |
|
|
2379
|
+
| `simplify` | the output's `simplify` for content without its own (series have theirs, below) |
|
|
2380
|
+
| `compress`, `font_hinting` | PDF: compressed streams (default) or a readable file; TrueType hinting kept in embedded subsets (default: left out) |
|
|
2381
|
+
| `dpi`, `background` | images: resolution (default 192: two image pixels per px); a color under the figure (default the figure's, white; `None` is transparent, white in JPEG) |
|
|
2382
|
+
|
|
2383
|
+
JPEG XL output (`.jxl`) needs libjxl, AVIF output (`.avif`) libavif 1.x. Images inside a
|
|
2384
|
+
PDF (rasterized series, heatmaps) are stored losslessly or as JPEG (`quality`), never as
|
|
2385
|
+
JPEG XL, so every PDF reader shows them. Fonts are embedded subsets without hinting: a
|
|
2386
|
+
typical figure's text adds a few KB per face. A plot
|
|
2387
|
+
saved alone keeps its size in the figure (axes or box, by `align`), its limits and ticks
|
|
2388
|
+
(those of its shared axes too), its title, legend and attached colorbars, and shows its
|
|
2389
|
+
outer tick labels ([layout](#layout)).
|
|
2390
|
+
|
|
2391
|
+
PNG quality: by default (`quality="auto"`) PNGs are palette images at quality 90: the plot's
|
|
2392
|
+
own colors stay exact, only antialiasing and gradients are approximated, and an image 256
|
|
2393
|
+
colors cannot render well enough stays lossless. The 21 example PNGs total 0.74 MB this way,
|
|
2394
|
+
1.57 MB with `quality="lossless"` and 1.38 MB lossless with `compression="best"` (same pixels,
|
|
2395
|
+
slower). Notebook previews are lossless.
|
|
2396
|
+
|
|
2397
|
+
### Large data
|
|
2398
|
+
|
|
2399
|
+
* Series map their data to page coordinates in C (`kernels.scaled`) and draw with
|
|
2400
|
+
one bulk vec_io call (markers, lines, areas, segments).
|
|
2401
|
+
* `simplify` (series, plot or figure; default `"auto"`) goes to each of the series' vec_io
|
|
2402
|
+
calls, and vec_io applies it per output. PDF: `"auto"` decimates lines with many points
|
|
2403
|
+
per pixel column and culls markers that later markers hide when that pays off (vec_io
|
|
2404
|
+
decides per call from the data); `True` or a dpi always simplifies at that resolution;
|
|
2405
|
+
`False` never. PNG, JPEG, JPEG XL and AVIF draw everything (rasterizing hidden content
|
|
2406
|
+
costs less than culling it, and the pixels are the same) and decimate lines for their
|
|
2407
|
+
resolution, unless `False`.
|
|
2408
|
+
* `rasterize=True` or a dpi draws the series in a vec_io group the PDF holds as an image;
|
|
2409
|
+
axes and text stay vectors. Image output draws the group as vectors at its own
|
|
2410
|
+
resolution.
|
|
2411
|
+
|
|
2412
|
+
Timings (`tools/bench.py`, 8 threads, PDF written):
|
|
2413
|
+
|
|
2414
|
+
| Case | Time |
|
|
2415
|
+
|---|---|
|
|
2416
|
+
| `import plot_io` (vec_io included) | 0.06 s |
|
|
2417
|
+
| empty figure, 4 plots with ticks and labels | 0.005 s |
|
|
2418
|
+
| scatter, 100k points, one color | 0.02 s |
|
|
2419
|
+
| scatter, 1M points, colors from a `ColorMap` | 0.25 s |
|
|
2420
|
+
| scatter, 1M points, `c=values`, PDF / PNG at 150 dpi | 0.56 s / 0.43 s |
|
|
2421
|
+
| line, 1M points (`simplify=False` / `True`) | 0.08 s / 0.03 s |
|
|
2422
|
+
| box plots, 10 categories × 1M values | 0.09 s |
|
|
2423
|
+
| heatmap 1000 × 1000 (`image`) with a colorbar | 0.06 s |
|
|
2424
|
+
| heatmap 200 × 200, uneven cells (`cells`) | 0.04 s |
|
|
2425
|
+
| scatter, 1M points, `rasterize=300` | 0.22 s |
|
|
2426
|
+
| `simplify="auto"` on 1M points it does not cull: overhead | < 0.01 s |
|
|
2427
|
+
|
|
2428
|
+
## 9. Genome tracks
|
|
2429
|
+
|
|
2430
|
+
```python
|
|
2431
|
+
fig = pl.Tracks("chr2:143,120,001-143,780,000", width="5in")
|
|
2432
|
+
fig.hic(gwseq_io.open("cells.hic"), y_axis={"label": "Hi-C"}, depth=500_000)
|
|
2433
|
+
fig.gtf(gwseq_io.open("gencode.gtf.gz"), gene_type="protein_coding")
|
|
2434
|
+
fig.bed(gwseq_io.open_peaks("sites.tsv"), y_axis={"label": "Sites"})
|
|
2435
|
+
sets = fig.track(stacked=True) # one track, a named row per file
|
|
2436
|
+
for c in ("con", "pio"):
|
|
2437
|
+
sets.bed(gwseq_io.open_peaks(f"{c}.tsv"), name=c)
|
|
2438
|
+
p = fig.track(y_axis={"label": "A/B"}) # an empty track: series overlaid
|
|
2439
|
+
before = p.bigwig(gwseq_io.open("before.bw"), name="before", color="sky", fill_to=False)
|
|
2440
|
+
p.bigwig(gwseq_io.open("after.bw"), name="after", color="rose", fill_to=before)
|
|
2441
|
+
fig.bigwig(gwseq_io.open("atac.bw"), y_axis={"label": "ATAC"})
|
|
2442
|
+
fig.vline(143_400_000) # through every track and the gaps
|
|
2443
|
+
fig.save("locus.pdf")
|
|
2444
|
+
fig.save("other.pdf", region=("chr2", 80_000_000, 81_000_000))
|
|
2445
|
+
```
|
|
2446
|
+
|
|
2447
|
+
Genome tracks are made of general pieces:
|
|
2448
|
+
|
|
2449
|
+
* **A tracks figure.** `pl.Tracks(region, **settings)` is a `Figure` with
|
|
2450
|
+
`layout="tracks"` ([§2](#arrangement)): one column of plots, top to bottom in creation
|
|
2451
|
+
order, sharing x (`share_x="all"`, tick labels and the axis title under the bottom plot
|
|
2452
|
+
only), `spacing` 0, `width` 480 px. Its `region`, `unit`, `unit_in` and `origin` go to
|
|
2453
|
+
`fig.x_axis`, the settings of every plot's x axis ([figure axes](#figure-axes)), with
|
|
2454
|
+
`scale="genome"`; the other keywords are the figure's.
|
|
2455
|
+
* **Tracks.** A `Track` is a plot preset: a `height` from its content, `space_above` it,
|
|
2456
|
+
axis lines left and bottom (Hi-C: bottom only), at most 4 y ticks and the y axis'
|
|
2457
|
+
`label` in the row band (`label_position="band"`, `label_pad="0.5em"`). `fig.track(**settings)`
|
|
2458
|
+
returns an empty one; a plot type called on the figure (`fig.bigwig`, `fig.bed`,
|
|
2459
|
+
`fig.genes`, `fig.gtf`, `fig.hic`, also `fig.line`, …) adds a track holding it and returns
|
|
2460
|
+
the series (`.plot` is the track; the track's settings, `title`, `x_axis` and `y_axis`
|
|
2461
|
+
go to it, and
|
|
2462
|
+
`name` names the series, its legend entry, as everywhere). Called on a track
|
|
2463
|
+
(`p.bigwig(…)`, `p.line(…)`, `p.hline(…)`), plot types overlay in it.
|
|
2464
|
+
* **The genome scale.** An x axis with `scale="genome"` is linear in bp: its limits are its
|
|
2465
|
+
`region` (less its `origin`), without padding, its tick labels in bp, kb or Mb, its
|
|
2466
|
+
automatic label the chromosome (`chr2 (Mb)`). A genome series asks its x axis for it
|
|
2467
|
+
when the axis has no scale of its own, so the genome series work on any plot too
|
|
2468
|
+
(`pl.Plot().bigwig(reader, region=…)`: the series' own `region`).
|
|
2469
|
+
* **Genome layers.** `bigwig`, `bed`, `genes`, `gtf` and `hic` are plot types like the
|
|
2470
|
+
others, drawn with the shared geoms: a signal's bins as a step line, a band and bars;
|
|
2471
|
+
intervals and gene models as rectangles, lines and names; contacts as a grid of cells
|
|
2472
|
+
under a 45° transform.
|
|
2473
|
+
* **Row labels, groups, lines through rows** are figure features ([§2](#rows)):
|
|
2474
|
+
the y axis' `label` is a row label lined up across the tracks, `fig.group(first, last, label=…,
|
|
2475
|
+
letter=…)` labels consecutive tracks (with x tick labels under the last one), and
|
|
2476
|
+
`fig.vline(x, rows=…)`, `fig.vspan(x0, x1, rows=…)` run through the tracks and the gaps.
|
|
2477
|
+
|
|
2478
|
+
Details:
|
|
2479
|
+
|
|
2480
|
+
* **Region.** `region` is a string, 1-based and inclusive
|
|
2481
|
+
(`"chr2:143,120,001-143,780,000"`; positions may carry a unit: `"chr1:1.2M-1.5M"`,
|
|
2482
|
+
`"chr1:500kb-2Mb"`, with `k`, `M`, `G` and an optional `b`, any case, and `,` or `_`
|
|
2483
|
+
between thousands), a `(chr, start, end)` tuple or list (0-based, half-open; the same
|
|
2484
|
+
position strings), or a mapping with `chr`, `start` and `end`; `plot_io.genome.parse_region` gives the
|
|
2485
|
+
`Region` (`chr`, `start`, `end`). A series reads its own `region`, else its x axis'.
|
|
2486
|
+
Data are read when the figure is drawn, for the region drawn: `save`, `to_bytes`, `draw`
|
|
2487
|
+
and `size` take `region=` to draw another one (it replaces `fig.x_axis`'s region for
|
|
2488
|
+
that call).
|
|
2489
|
+
* **x axis.** Ticks under every track (but a Hi-C triangle with `direction="down"`), tick
|
|
2490
|
+
labels and the axis label (`chr2 (Mb)`) under the bottom track; a group's last track has
|
|
2491
|
+
tick labels too; `fig.set(label_outer=False)` labels every track. `unit` (`auto`, `bp`,
|
|
2492
|
+
`kb`, `Mb`) and `unit_in` (`"label"`: `chr2 (Mb)` under `143.2 143.3 …`; `"ticks"`:
|
|
2493
|
+
`-500kb 0 500kb`) set the labels; `tick_format="chr:pos"` writes positions
|
|
2494
|
+
(`chr2:143,250,000`, in bp with `,` between thousands unless `unit` is set:
|
|
2495
|
+
`chr2:143.25Mb`), the position itself even with an `origin`, and leaves the automatic
|
|
2496
|
+
label out; `fig.x_axis(label=…)` replaces the label, and in a
|
|
2497
|
+
string `{chr}`, `{unit}`, `{start}`, `{end}` are filled in (`""`: none). `origin` (a
|
|
2498
|
+
position, `"center"`, `"start"` or `"end"` of the region) is drawn at 0: every series on
|
|
2499
|
+
the axis is drawn less it ([transforms](#5-series)), and limits, ticks and decorations
|
|
2500
|
+
are distances from it (`fig.vline(0)`, `fig.vspan(-1000, 1000)`); a region given to
|
|
2501
|
+
`fig.vspan` is in positions.
|
|
2502
|
+
* **y axis.** An interval track's y axis has a tick per named series (`fig.bed(…,
|
|
2503
|
+
name=…)`; each `name` of a `stacked` track) at the middle of its rows, the name as its
|
|
2504
|
+
label; without names, and on Hi-C tracks, the y axis is hidden (`y_axis(visible=True)`
|
|
2505
|
+
shows it).
|
|
2506
|
+
* **Heights.** A track's `height`: a length, a share (`"1fr"`, of the room the fixed heights
|
|
2507
|
+
leave in a figure of given height, `reference="figure"`), or `auto`: the Hi-C triangle's
|
|
2508
|
+
height (square cells; `max_height`, a length or a percentage of the width such as
|
|
2509
|
+
`"33%"`, caps it, and `fit` clips the distances above or squashes the triangle), the rows
|
|
2510
|
+
of intervals × `row_height` plus the y axis padding above and below, or `auto_height`
|
|
2511
|
+
for signals. The figure height follows. `space_above` is the space above a track:
|
|
2512
|
+
`auto_space_above` above every track but the first.
|
|
2513
|
+
* **Stacked intervals.** A track with `stacked=True` puts each interval series on rows of
|
|
2514
|
+
its own, top to bottom, named left of its rows; they take no legend entries.
|
|
2515
|
+
* **Bins.** `bins` of `bigwig` and `hic`: a width on the axes (`"0.5px"`, the default: two
|
|
2516
|
+
bins per px of the axes width; Hi-C: the finest resolution whose cells are at least that
|
|
2517
|
+
wide), a size (`"10kb"`, `"5000bp"`, `"5000d"`), or a count (`200`). A size is read on
|
|
2518
|
+
the genome-wide grid of that size: the region grows outward to it
|
|
2519
|
+
(`snap_to_grid="expand"`), and the first and last bins are then cut to the region. A
|
|
2520
|
+
count cuts the region itself into that many bins. The bins (and Hi-C `height="auto"`, interval rows) follow the axes width the
|
|
2521
|
+
layout places: with the default `reference="axes"` it is `width`, so each file is read
|
|
2522
|
+
once per draw; with `reference="plot"` or `"figure"`, the data are read again for the
|
|
2523
|
+
width the first round places (reads are cached by their bins).
|
|
2524
|
+
* **Shared y.** `share_y=other_track` on a track, or `fig.set(share_y="bigwig")` to put
|
|
2525
|
+
every track with a `bigwig` series on one scale (a figure's `share_x`/`share_y` takes a
|
|
2526
|
+
plot type's name).
|
|
2527
|
+
|
|
2528
|
+
### Readers
|
|
2529
|
+
|
|
2530
|
+
plot_io does not import gwseq_io: it reads any object with the methods of gwseq_io's
|
|
2531
|
+
readers, recognised by their `type` attribute (`"bigwig"`, `"bigbed"`, `"bed"`, `"peaks"`,
|
|
2532
|
+
`"gtf"`, `"gff3"`, `"hic"`), else by their methods. The calls, which another reader can implement:
|
|
2533
|
+
|
|
2534
|
+
| Data | Methods called |
|
|
2535
|
+
|---|---|
|
|
2536
|
+
| signal (bigWig; the coverage of bigBed, BED and peaks readers) | `read_values([(chr, start, end)], bin_count=n, bin_mode=…, def_value=…, zoom="auto")`, or with `bin_size=b, snap_to_grid="expand"` and the row's bounds from `resolve_regions([(chr, start, end)], bin_size=b, snap_to_grid="expand")` (without it, `snap_to_grid=False, full_bin=True`): one row of values |
|
|
2537
|
+
| intervals (bigBed, BED, peaks) | `read_entries([(chr, start, end)], as_cols=True, col_count=…)`: a dict (or a list of one dict) of columns; `col_count` from `auto_sql` when the reader has it |
|
|
2538
|
+
| annotation (GTF, GFF3) | `read_transcripts([(chr, start, end)], as_cols=True, gene_type=…, transcript_type=…)`: a dict (or a list of one dict) of transcript columns: `start`, `end`, `strand`, `transcript_id`, `transcript_name`, `gene_id`, `gene_name`, `cds_start`, `cds_end` (−1 when non-coding), `exon_starts`, `exon_ends`, `exon_offsets` |
|
|
2539
|
+
| contacts (Hi-C) | `bin_sizes`, `normalizations`, `read_values((chr, start, end), bin_size=b, snap_to_grid="expand", normalization=…, matrix_type=…, max_distance=…)` (or `bin_count=n` instead of the first two): a square matrix; bounds from `resolve_regions((chr, start, end), bin_size=b, snap_to_grid="expand")["rows"]` |
|
|
2540
|
+
|
|
2541
|
+
Results are read as buffers (numpy arrays included) without importing numpy. A path
|
|
2542
|
+
instead of a reader raises `TypeError` (open it with `gwseq_io.open`, or
|
|
2543
|
+
`gwseq_io.open_peaks` for a TSV of locations), as do BAM and CRAM readers (pile the reads
|
|
2544
|
+
up into a bigWig first). A reader's error is raised with the track's label in the
|
|
2545
|
+
message.
|
|
2546
|
+
|
|
2547
|
+
### BigWig
|
|
2548
|
+
|
|
2549
|
+
```python
|
|
2550
|
+
pl.BigWig(reader=None, plot=None, *, x=None, y=None, **settings)
|
|
2551
|
+
```
|
|
2552
|
+
|
|
2553
|
+
A step line along the bins, filled to `fill_to`. `reader` is a signal reader, a function
|
|
2554
|
+
`f(chr, start, end, bins)` returning the values, or `None` with `y` (values evenly over
|
|
2555
|
+
the region) and optionally `x` (bin centres, or n + 1 edges, in bp). The color is black
|
|
2556
|
+
when the series is alone in its track, palette colors when overlaid. `fill_to=<series>`
|
|
2557
|
+
fills between two signals, each part in the fill color of the series on top. For more,
|
|
2558
|
+
the track's `fill_mode` fills between all its signals, in place of their `fill_to`:
|
|
2559
|
+
`"in_between(up)"` (or `"in_between"`) fills each band between two neighbouring signals
|
|
2560
|
+
in the color of the one just above, `"in_between(down)"` of the one just below;
|
|
2561
|
+
`"in_between(max)"` fills from the lowest signal to the highest in the color of the top
|
|
2562
|
+
one, `"in_between(min)"` of the bottom one. The colors follow wherever the order changes
|
|
2563
|
+
(lines get points where they cross), and 0 is not kept on the y axis:
|
|
2564
|
+
|
|
2565
|
+
```python
|
|
2566
|
+
t = fig.track(y_axis={"label": "Lamin A/C"}, fill_mode="in_between(up)")
|
|
2567
|
+
t.bigwig(neo_reader, name="Neo", color="sky")
|
|
2568
|
+
t.bigwig(pax7_reader, name="Pax7", color="rose")
|
|
2569
|
+
```
|
|
2570
|
+
|
|
2571
|
+
<!-- settings:BigWig -->
|
|
2572
|
+
| Setting | Default | Meaning |
|
|
2573
|
+
|---|---|---|
|
|
2574
|
+
| `region` | — | The region read: `"chr2:143,120,001-143,780,000"` (1-based, inclusive), `(chr, start, end)` (0-based, half-open) or a mapping; unset: the x axis' `region`. |
|
|
2575
|
+
| `bins` | '0.5px' | A bin count over the region (exactly, not on a grid); a bin size (`"10kb"`, `"5000bp"`), read on the genome-wide grid of the size (the row grown to it, then cut to the region); or a bin width on the axes (`"0.5px"`: two bins per px, read as a count). |
|
|
2576
|
+
| `bin_mode` | 'mean' | Reduction per bin: `mean`, `max` (keeps narrow peaks), `min`, `sum`, … (gwseq_io's). |
|
|
2577
|
+
| `def_value` | 0.0 | Value of bases no record covers; NaN breaks the line there. |
|
|
2578
|
+
| `kind` | 'step' | `step` (a step line along the bins), `line` (through the bin centres) or `bar` (one rectangle per bin). |
|
|
2579
|
+
| `fill_to` | 0.0 | Fill between the signal and a value, another series of the track (colored by whichever is above), or `False`. |
|
|
2580
|
+
| `fill` | 0.2 | Fill (to `fill_to`): an opacity of the line color, `True` (opaque), a color, or `False`. |
|
|
2581
|
+
| `color` | — | Line color; default black alone in its track, the next palette color when overlaid. |
|
|
2582
|
+
| `transform` | — | A function applied to each value (log, scaling). |
|
|
2583
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
2584
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own. |
|
|
2585
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
2586
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
2587
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
2588
|
+
| `line_width` | inherited (0.75) | Line width. Length. |
|
|
2589
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
2590
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
2591
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
2592
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
2593
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
2594
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
2595
|
+
|
|
2596
|
+
Groups: `FillStyle`, `Font`.
|
|
2597
|
+
<!-- /settings -->
|
|
2598
|
+
|
|
2599
|
+
### Bed and Genes
|
|
2600
|
+
|
|
2601
|
+
```python
|
|
2602
|
+
pl.Bed(reader, plot=None, **settings)
|
|
2603
|
+
pl.Genes(reader, plot=None, **settings) # Bed with kind="genes", rows expanded, names on,
|
|
2604
|
+
# filled solid without outlines
|
|
2605
|
+
```
|
|
2606
|
+
|
|
2607
|
+
`reader` is an interval reader, or the columns themselves: a dict, a DataFrame, or rows
|
|
2608
|
+
(dicts, or tuples in BED order). Used columns: `chr` (when given, rows of other
|
|
2609
|
+
chromosomes are left out), `start`, `end`, `name`, `score`, `strand`, `thickStart`,
|
|
2610
|
+
`thickEnd`, `itemRgb` (`reserved` in bigBeds), `blockCount`, `blockSizes`, `blockStarts`.
|
|
2611
|
+
`genes` draws each BED12 model as a line, thin boxes for UTRs and thick boxes for coding
|
|
2612
|
+
exons, chevrons on introns (`strand`), and its name in italics with a strand mark
|
|
2613
|
+
(`Pcsk2 ›`). Names go left of their feature and are dropped where they would collide;
|
|
2614
|
+
with `rows="expand"` packing leaves room for them (`names=False`: none). `name_region` names only the
|
|
2615
|
+
features overlapping it (a locus within a wider view), and packing then makes room only
|
|
2616
|
+
for those names. Features are outlined in their color (`outline`, `line_width`) over their
|
|
2617
|
+
`fill` (an opacity of their color, 0.3; `False` for outlines only), the outline inside the feature's extent: a
|
|
2618
|
+
feature narrower than two borders is one line, `line_width` wide. `recolor` snaps the features' colors
|
|
2619
|
+
(`itemRgb` ones included) to the named colors (`"blue 0.4"`, §7): `True` takes the
|
|
2620
|
+
closest of all shades, a level such as `0.4` the closest color's shade at that level, so
|
|
2621
|
+
every feature has the same lightness.
|
|
2622
|
+
|
|
2623
|
+
<!-- settings:Bed -->
|
|
2624
|
+
| Setting | Default | Meaning |
|
|
2625
|
+
|---|---|---|
|
|
2626
|
+
| `region` | — | The region read: `"chr2:143,120,001-143,780,000"` (1-based, inclusive), `(chr, start, end)` (0-based, half-open) or a mapping; unset: the x axis' `region`. |
|
|
2627
|
+
| `kind` | 'boxes' | `boxes` (intervals, 8/13.2 of a row high: 8 px in the default row) or `genes` (BED12 models: exons as high, UTRs half, introns). |
|
|
2628
|
+
| `rows` | 'collapse' | `collapse`: one row; `expand`: overlapping features (and their labels) packed onto rows. |
|
|
2629
|
+
| `min_width` | 0.75 | Narrowest drawn feature (1-bp sites stay visible). Length. |
|
|
2630
|
+
| `color` | 'black' | A color, `"item_rgb"` (the `itemRgb` column) or `"score"` (the `score` column through `color_map`). |
|
|
2631
|
+
| `recolor` | False | Replace each feature's color by the closest named color (`True`: the closest shade; a level 0–1: the closest color's shade at that level); `False`: as given. Not with `color="score"`. |
|
|
2632
|
+
| `names` | False | Feature names (`name`) left of the features, dropped where they collide. |
|
|
2633
|
+
| `name_region` | — | Only features overlapping this region (as `region` takes it) get names; `None`: all. |
|
|
2634
|
+
| `strand` | False | Strand chevrons on boxes and introns. |
|
|
2635
|
+
| `outline` | True | Outline features in their color (`line_width` wide). |
|
|
2636
|
+
| `fill` | 0.3 | Fill of the features: an opacity of their color (times `alpha`), `True` (opaque), a color, or `False` (outlines only). |
|
|
2637
|
+
| `row_height` | '1.2em' | Height of a row; the track's automatic height is rows × it, plus the y axis padding. Length; `%`: of the font size. |
|
|
2638
|
+
| `name_font_size` | '0.85em' | Font size of feature names. Length; `%`: of the font size. |
|
|
2639
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient numbers given as colors are drawn with: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
2640
|
+
| `color_limits` | — | Limits of the series' color axis, as an axis' `limits`: `"-2/2"`, `"0/max"`, `"q:0.01/q:0.99"`; unset: `"auto"`, the values' range. |
|
|
2641
|
+
| `color_scale` | — | Scale of the series' color axis (`log`, `sqrt`, …); unset: `linear`. |
|
|
2642
|
+
| `color_axis` | — | A shared `ColorAxis` (`figure.color_axis(…)`) in place of the series' own: it holds the map, limits and scale. |
|
|
2643
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
2644
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own. |
|
|
2645
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
2646
|
+
| `line_width` | inherited (0.75) | Line width. Length. |
|
|
2647
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
2648
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
2649
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
2650
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
2651
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
2652
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
2653
|
+
|
|
2654
|
+
Groups: `FillStyle`, `TextStyle` (`name_`), `Font`.
|
|
2655
|
+
<!-- /settings -->
|
|
2656
|
+
|
|
2657
|
+
`Genes` (only its own defaults):
|
|
2658
|
+
|
|
2659
|
+
<!-- settings:Genes -->
|
|
2660
|
+
| Setting | Default | Meaning |
|
|
2661
|
+
|---|---|---|
|
|
2662
|
+
| `kind` | 'genes' | `boxes` (intervals, 8/13.2 of a row high: 8 px in the default row) or `genes` (BED12 models: exons as high, UTRs half, introns). |
|
|
2663
|
+
| `rows` | 'expand' | `collapse`: one row; `expand`: overlapping features (and their labels) packed onto rows. |
|
|
2664
|
+
| `names` | True | Feature names (`name`) left of the features, dropped where they collide. |
|
|
2665
|
+
| `strand` | True | Strand chevrons on boxes and introns. |
|
|
2666
|
+
| `outline` | False | Outline features in their color (`line_width` wide). |
|
|
2667
|
+
| `fill` | True | Fill of the features: an opacity of their color (times `alpha`), `True` (opaque), a color, or `False` (outlines only). |
|
|
2668
|
+
|
|
2669
|
+
Groups: `FillStyle`.
|
|
2670
|
+
<!-- /settings -->
|
|
2671
|
+
|
|
2672
|
+
### Gtf
|
|
2673
|
+
|
|
2674
|
+
```python
|
|
2675
|
+
pl.Gtf(reader, plot=None, **settings) # Genes from a GTF or GFF3 reader
|
|
2676
|
+
```
|
|
2677
|
+
|
|
2678
|
+
`reader` is a GTF or GFF3 reader (`gwseq_io.open("gencode.gtf.gz")`, bgzipped and indexed;
|
|
2679
|
+
`gwseq_io.index_gtf` makes one from any GTF), or BED12 columns as `Genes` takes them. The
|
|
2680
|
+
transcripts overlapping the region come whole, with their exons outside it. With
|
|
2681
|
+
`model="gene"` each gene is one model: its transcripts' exons merged, coding from the
|
|
2682
|
+
first CDS start to the last CDS end (the stop codon included), named by `gene_name`;
|
|
2683
|
+
`model="transcript"` draws every transcript, named by `transcript_name`. An id names what
|
|
2684
|
+
has no name. `gene_type` and `transcript_type` keep those biotypes. A `Bed` or `Genes`
|
|
2685
|
+
given a GTF reader raises `TypeError` pointing here.
|
|
2686
|
+
|
|
2687
|
+
`Gtf` (only its own settings and defaults):
|
|
2688
|
+
|
|
2689
|
+
<!-- settings:Gtf -->
|
|
2690
|
+
| Setting | Default | Meaning |
|
|
2691
|
+
|---|---|---|
|
|
2692
|
+
| `model` | 'gene' | `gene`: one model per gene, its transcripts' exons merged and coding from the first CDS start to the last CDS end, named by `gene_name`; `transcript`: one per transcript, named by `transcript_name` (ids where there is no name). |
|
|
2693
|
+
| `gene_type` | — | Gene biotypes kept (`"protein_coding"`, a list); `None`: all. |
|
|
2694
|
+
| `transcript_type` | — | Transcript biotypes kept; `None`: all. |
|
|
2695
|
+
<!-- /settings -->
|
|
2696
|
+
|
|
2697
|
+
### HiC
|
|
2698
|
+
|
|
2699
|
+
```python
|
|
2700
|
+
pl.HiC(reader, plot=None, **settings)
|
|
2701
|
+
```
|
|
2702
|
+
|
|
2703
|
+
The upper triangle of the contact matrix, the diagonal on the x axis, each cell a
|
|
2704
|
+
diamond: the matrix is drawn as an image under a 45° transform and clipped to the track.
|
|
2705
|
+
`reader` is a Hi-C reader, or a square matrix over the region. `bins="0.5px"` (the
|
|
2706
|
+
default) takes the finest of the reader's `bin_sizes` whose cells are at least 0.5 px wide;
|
|
2707
|
+
the cells of a size (`bins="5kb"`) sit on the file's grid, those past the region cut by
|
|
2708
|
+
the track's edges, and `bins=n` reads n cells over the region exactly. Its color axis' limits default
|
|
2709
|
+
to quantiles of the cells drawn (`color_limits="q:0.01/q:0.99"`), on a log scale
|
|
2710
|
+
(`color_scale="log"`; cells of 0 take the map's low end; cells without a value take
|
|
2711
|
+
`nan_color`, transparent), through the figure's `color_map`.
|
|
2712
|
+
|
|
2713
|
+
<!-- settings:HiC -->
|
|
2714
|
+
| Setting | Default | Meaning |
|
|
2715
|
+
|---|---|---|
|
|
2716
|
+
| `region` | — | The region read: `"chr2:143,120,001-143,780,000"` (1-based, inclusive), `(chr, start, end)` (0-based, half-open) or a mapping; unset: the x axis' `region`. |
|
|
2717
|
+
| `depth` | — | Largest distance shown (bp); default the region's span (the whole triangle). |
|
|
2718
|
+
| `bins` | '0.5px' | A bin count over the region (exactly, from the coarsest resolution giving that many); one of the reader's `bin_sizes` (`"10kb"`), read on its grid (the region grown to it, then cut by the track); or a cell width on the axes (`"0.5px"`): the finest resolution whose cells are at least that wide. |
|
|
2719
|
+
| `normalization` | 'none' | `"none"` or one of the reader's `normalizations`. |
|
|
2720
|
+
| `matrix_type` | 'observed' | `observed`, `oe` (observed / expected) or `expected`. |
|
|
2721
|
+
| `color_map` | inherited ('rainbow_llhh') | The gradient numbers given as colors are drawn with: a `ColorMap`, a map name or colors (alias `cmap`); default: the style's. |
|
|
2722
|
+
| `color_limits` | 'q:0.01/q:0.99' | Limits of the series' color axis, as an axis' `limits`: `"-2/2"`, `"0/max"`, `"q:0.01/q:0.99"`; unset: `"auto"`, the values' range. |
|
|
2723
|
+
| `color_scale` | 'log' | Scale of the series' color axis (`log`, `sqrt`, …); unset: `linear`. |
|
|
2724
|
+
| `color_axis` | — | A shared `ColorAxis` (`figure.color_axis(…)`) in place of the series' own: it holds the map, limits and scale. |
|
|
2725
|
+
| `nan_color` | — | Color of cells without a value; default: the map's `bad` (transparent). |
|
|
2726
|
+
| `direction` | 'up' | `up`: the apex up; `down`: the triangle hangs from the top. |
|
|
2727
|
+
| `max_height` | — | Largest height of the track: a percentage of its width (`"33%"`) or a length; `None`: the triangle's (square cells). |
|
|
2728
|
+
| `fit` | 'clip' | How the triangle fits a height below its own (`max_height`, or the track's `height`): `clip` keeps square cells and cuts the distances above; `squash` flattens the whole triangle. |
|
|
2729
|
+
| `colorbar` | False | Attach a colorbar to the track. |
|
|
2730
|
+
| `name` | — | Legend entry; unset: not in the legend. |
|
|
2731
|
+
| `alpha` | inherited (1.0) | Opacity, multiplying the colors' own. |
|
|
2732
|
+
| `z` | — | Drawing order (higher on top); default: call order. |
|
|
2733
|
+
| `rasterize` | inherited (False) | `True` or a dpi: drawn as an image inside the PDF. |
|
|
2734
|
+
| `simplify` | inherited ('auto') | `"auto"`, `True`, a dpi or `False`: vec_io's `simplify`. |
|
|
2735
|
+
| `text_color` | inherited ('black') | Text color. |
|
|
2736
|
+
| `font_size` | inherited (11.0) | Base font size. Length; `%`: of the parent's font size. |
|
|
2737
|
+
| `font_family` | inherited ('SF Pro, Inter, Helvetica, Arial, sans-serif') | Font family. |
|
|
2738
|
+
| `font_stretch` | inherited ('normal') | Font width: `normal`, `condensed`, …, or a percentage (`"87.5%"`); the `wdth` axis of variable fonts. |
|
|
2739
|
+
| `font_variations` | inherited (None) | Variable font axes: `{"GRAD": 50}` or `'"GRAD" 50, "wght" 650'`. |
|
|
2740
|
+
| `font_optical_sizing` | inherited ('auto') | `auto`: a variable font's `opsz` axis follows the font size; `none`. |
|
|
2741
|
+
|
|
2742
|
+
Groups: `Font`.
|
|
2743
|
+
<!-- /settings -->
|
|
2744
|
+
|
|
2745
|
+
### Tracks
|
|
2746
|
+
|
|
2747
|
+
`pl.Tracks(region=None, **settings)` returns the figure; `Track` has the settings of `Plot`,
|
|
2748
|
+
these added or with other defaults:
|
|
2749
|
+
|
|
2750
|
+
<!-- settings:Track -->
|
|
2751
|
+
| Setting | Default | Meaning |
|
|
2752
|
+
|---|---|---|
|
|
2753
|
+
| `space_above` | 'auto' | Space above the track; `auto`: none for the first track, else `auto_space_above`. Length; `%`: of the font size. |
|
|
2754
|
+
| `height` | 'auto' | Height of the track's axes: a length, a share of the room the fixed heights leave (`"1fr"`, with the figure's height given), or `auto`: Hi-C from its `depth` (square cells), intervals rows × `row_height`, else `auto_height`. |
|
|
2755
|
+
| `auto_height` | '4.5em' | Height of signal and empty tracks with `height="auto"`. Length; `%`: of the font size. |
|
|
2756
|
+
| `auto_space_above` | '0.6em' | The space `space_above="auto"` leaves. Length; `%`: of the font size. |
|
|
2757
|
+
| `stacked` | False | Interval series on rows of their own, top to bottom, each named left of its rows by its `name`. |
|
|
2758
|
+
| `fill_mode` | — | Fill between the track's signals (replacing their `fill_to`): `"in_between(up)"` (or `"in_between"`), each band between two neighbouring signals in the fill color of the one above; `(down)`, of the one below; `(max)`, one band from the lowest signal to the highest in the color of the top one; `(min)`, of the bottom one. `None`: each signal's `fill_to`. |
|
|
2759
|
+
<!-- /settings -->
|
|
2760
|
+
|
|
2761
|
+
## 10. Styles
|
|
2762
|
+
|
|
2763
|
+
A style presets settings: `Figure(style=…)` (also accepted by `pl.Plot` and the series
|
|
2764
|
+
classes, which pass it to their figure). Explicit settings always win over the style.
|
|
2765
|
+
|
|
2766
|
+
```python
|
|
2767
|
+
fig = pl.Figure(style="default")
|
|
2768
|
+
fig = pl.Figure(style={"base": "default", "font_size": 9, "Axis.grid": True})
|
|
2769
|
+
fig = pl.Figure(style={"base": ["house", "talk"], "palette": ["#333", "#c00"]})
|
|
2770
|
+
|
|
2771
|
+
pl.register_style("house", {"font_family": "Helvetica", "Legend.frame": True})
|
|
2772
|
+
pl.set_style("house") # figures created afterwards
|
|
2773
|
+
with pl.use_style({"font_size": 10}): # figures created inside the block
|
|
2774
|
+
...
|
|
2775
|
+
pl.styles.names() # registered names
|
|
2776
|
+
pl.styles.settings("house") # the resolved dict (base theme included)
|
|
2777
|
+
```
|
|
2778
|
+
|
|
2779
|
+
* **Keys.** Names of inherited settings (`"font_size"`, `"palette"`), `"Class.name"` for
|
|
2780
|
+
any setting of a class and its subclasses (`Figure`, `FigureTitle`, `Plot`, `Title`,
|
|
2781
|
+
`Legend`, `Axis` (plot, color and size axes), `Colorbar`, every series class, `Series` for
|
|
2782
|
+
all of them, every decoration class, `Decoration` for all of them, the genome classes),
|
|
2783
|
+
or `"Group.member"` for every embedding of a group member (`"Marker.size"`,
|
|
2784
|
+
`"Stroke.line_width"`, `"TextStyle.font_weight"`).
|
|
2785
|
+
`"Colorbar.<axis setting>"` (`"Colorbar.tick_direction"`, `"Colorbar.tick_color"`, …)
|
|
2786
|
+
applies to color axes (the colorbars' axes) only, and `"XAxis.<setting>"`, `"YAxis.<setting>"` to the x or
|
|
2787
|
+
y axis of plots only; each wins over `"Axis.<setting>"` there.
|
|
2788
|
+
Keys starting with `--` are custom variables (`"--accent": "#c00"`), read by
|
|
2789
|
+
`var(--accent)`. Values are checked when the style is registered or set.
|
|
2790
|
+
* **`"base"`.** A style name or a list of names, applied left to right (later ones win);
|
|
2791
|
+
the dict's own keys are applied over them. Registered styles use the same form.
|
|
2792
|
+
* **Resolution.** The cascade of [conventions](#1-conventions): the object's own value,
|
|
2793
|
+
class rules, `"Class.name"` keys along the class hierarchy, the parent (inherited
|
|
2794
|
+
settings), `"Group.member"` keys, the class and group defaults, then the bare name. The
|
|
2795
|
+
effective theme is the inherited defaults (the bare names of `DEFAULTS`) with the
|
|
2796
|
+
expanded style merged over it.
|
|
2797
|
+
* **Default.** Without `style`, a figure takes the session style current when it is
|
|
2798
|
+
created (`use_style` innermost, else `set_style`), else `"default"`, which adds nothing
|
|
2799
|
+
to `DEFAULTS`.
|
|
2800
|
+
* **`scaling`.** A figure setting (default 1, or `"Figure.scaling"` in the style) that
|
|
2801
|
+
multiplies every absolute length: font sizes, line widths, marker sizes, tick lengths,
|
|
2802
|
+
pads and gaps, from the defaults, the style or set on objects (not the figure size).
|
|
2803
|
+
Lengths in `em` follow the scaled font size.
|
|
2804
|
+
|
|
2805
|
+
Bundled styles (`pl.styles.names()`), each the defaults of a library expressed in these
|
|
2806
|
+
settings (colors, fonts, grid, axis lines, ticks, legend and title placement, palette,
|
|
2807
|
+
color map, default series looks). They never change plot sizes or the minus sign
|
|
2808
|
+
(`style={"base": "matplotlib", "minus": "minus"}` gets matplotlib's).
|
|
2809
|
+
|
|
2810
|
+
| Style | Follows | Variants |
|
|
2811
|
+
|---|---|---|
|
|
2812
|
+
| `default` | `DEFAULTS` | — |
|
|
2813
|
+
| `matplotlib` | matplotlib ≥ 2.0 defaults (tab10, viridis, four spines, rounded legend frame) | `matplotlib-classic` (1.x: ticks in on all sides, b g r c m y k, jet) |
|
|
2814
|
+
| `seaborn` | seaborn darkgrid, notebook context, deep, rocket | `seaborn-darkgrid`, `-whitegrid`, `-dark`, `-white`, `-ticks`; `-paper`, `-talk`, `-poster` (scaling 0.8, 1.5, 2) |
|
|
2815
|
+
| `ggplot2` | `theme_grey()`: grey panel, white grid with minor lines, left title, legend outside, `hue` palette | `ggplot2-bw`, `-light`, `-minimal`, `-classic` |
|
|
2816
|
+
| `altair` | Vega-Lite: grey axis lines and grid, view frame, bold titles, hollow points, tableau10, YlGnBu, nice limits | — |
|
|
2817
|
+
| `matlab` | MATLAB R2014b+: ticks in, `lines` colors, parula, hollow circles, nice limits, framed legend | `matlab-box` (box on) |
|
|
2818
|
+
| `chartjs` | Chart.js 4: light grid, grey text, legend boxes on top, translucent points | — |
|
|
2819
|
+
| `plotly` | plotly: blue-grey panel, white grid, no ticks, left title, plasma | `plotly-white` |
|
|
2820
|
+
| `bokeh` | Bokeh 3: light grid and frame, italic axis titles, bold left titles, Category10, framed legend top right | — |
|
|
2821
|
+
| `observable` | Observable Plot: no axis lines or grid, 10 px system font, hollow points, observable10, turbo | — |
|
|
2822
|
+
| `excel` | Excel 2013+: Calibri-like font, grey text, horizontal grid only, Office palette, legend below | — |
|
|
2823
|
+
| `fivethirtyeight` | matplotlib's `fivethirtyeight`: `#f0f0f0` background, large text, thick lines, grid, no ticks | — |
|
|
2824
|
+
| `economist` | ggthemes' `theme_economist`: blue-grey background, white horizontal grid, y labels on the right, red rule above the figure title | — |
|
|
2825
|
+
| `tufte` | ggthemes' `theme_tufte` with a range frame: serif, no grid, axis lines trimmed to the ticks and offset, greys | — |
|
|
2826
|
+
|
|
2827
|
+
Values come from matplotlib's and seaborn's rcParams, ggplot2's `theme-defaults.R`, the
|
|
2828
|
+
Vega and Vega-Lite default configs, Chart.js's defaults, plotly's templates and MATLAB's
|
|
2829
|
+
documented default properties. What cannot be expressed: legend titles naming a variable
|
|
2830
|
+
(series carry no variable names).
|
|
2831
|
+
|
|
2832
|
+
## 11. Errors
|
|
2833
|
+
|
|
2834
|
+
| Exception | Raised for |
|
|
2835
|
+
|---|---|
|
|
2836
|
+
| `NoFontError` (a `ValueError`, `vec_io.text.NoFontError`) | text with no outline font available at all ([fonts](#1-conventions)) |
|
|
2837
|
+
| `ValueError` | unknown settings or invalid values; mismatched data lengths; grids whose ids are not rectangles; ids outside the grid or taken; a full `rows` × `cols` arrangement; `width` with `plot_width`; a grid `layout` with `rows`/`cols`; ratios of the wrong length; mixed category and numeric series on an axis; limits outside a scale's domain; a colorbar without a mapped source, or of a `ColorMap`; `color_map`, `color_limits` or `color_scale` with a shared `color_axis`; shared color axes with different limits or scales; heatmap value labels on more than 2,500 cells; unknown formats or output options, or options of another format (`dpi` for a PDF, `compress` for an image); unknown bin rules or decreasing bin edges; negative pie values; pies with axis series on one plot; `axline` slopes on non-linear axes; decoration positions that are not categories of a category axis |
|
|
2838
|
+
|
|
2839
|
+
## 12. Modules
|
|
2840
|
+
|
|
2841
|
+
`pl.__all__` (51 names) is the API. These modules are public too:
|
|
2842
|
+
`plot_io.styles` (`pl.styles`: `names`, `settings`, `register_style`, `set_style`,
|
|
2843
|
+
`use_style`), `plot_io.genome` (`parse_region`, `Region`), `plot_io.markers`
|
|
2844
|
+
(`marker_path`, `marker_area`), `plot_io.color.palettes` (`PALETTE`), and the modules of
|
|
2845
|
+
the types calls return: `plot_io.facets` (`FacetSet`, `LayerSet`), `plot_io.tables`
|
|
2846
|
+
(`SeriesGroup`), `plot_io.colorbar` (`Colorbar`). The others are internal: their names
|
|
2847
|
+
may change in any release.
|
|
2848
|
+
|
|
2849
|
+
| Module | Role |
|
|
2850
|
+
|---|---|
|
|
2851
|
+
| `settings.py` | `Setting`, `Settings` (validation, the cascade, explain), class rules and `"auto"` rules, keyword routing, validators |
|
|
2852
|
+
| `groups.py` | setting groups (`Font`, `TextStyle`, `Stroke`, `Marker`, `FillStyle`, `NumberFormat`) and their embedding under a prefix |
|
|
2853
|
+
| `defaults.py`, `units.py` | `DEFAULTS`; units, `var()`/`calc()`/`inherit`, `%` referents, `explain` traces |
|
|
2854
|
+
| `spec.py` | a render's specs (the model resolved once, frozen), layout boxes, palette colors and trained color and size axes |
|
|
2855
|
+
| `figure.py`, `plot.py` | `Figure` (arrangement, tracks layout, figure axes, sizes, output), `Plot`, `Title`, `Legend` |
|
|
2856
|
+
| `rows.py` | row labels in a band left of the plots, groups of rows (`FigureGroup`), lines and bands through rows (`FigureVLine`, `FigureVSpan`) |
|
|
2857
|
+
| `axis.py`, `scales.py`, `limits.py`, `ticks.py` | axes, scale functions, limits syntax, tick choice and labels |
|
|
2858
|
+
| `states.py` | the render's state of each plot: calls, palette, axes and their limits, legend, colorbars |
|
|
2859
|
+
| `layout.py`, `geometry.py` | the box model: bands measured around each plot's axes, the grid solved in rounds, the frozen geometry (`layout.layout(fig, fonts)`: text shaped with a font database, no canvas) |
|
|
2860
|
+
| `render.py` | drawing from the geometry; the page of a px document and its outputs (`doc.to_bytes`, `page.render(…).encode`) |
|
|
2861
|
+
| `mapped.py` | color and size axes (`ColorAxis`, `SizeAxis`): own and shared axes of series, their training |
|
|
2862
|
+
| `legend.py`, `colorbar.py` | legend (with size keys) and colorbar: measured, placed, drawn |
|
|
2863
|
+
| `layers/` | plot types as layers: `base.py` (`Series`, the model of a call; `data=`/`group=`), `core.py` (`Layer`, `Call`, `Table`), `stats.py` (columns from data), `positions.py` (stack, dodge, jitter, swarm, packing), `geoms.py` (the eight geoms: extent, drawing, legend symbol, occupancy, hit area), `pipeline.py` (calls per plot, palette training), `paint.py` (colors, mapped values, markers), `context.py` (drawing context, the x↔y swap); `register_layer` |
|
|
2864
|
+
| `presets/` | the plot types (`Scatter`, `Box`, …): settings, and the layers each draws; error bars |
|
|
2865
|
+
| `labels.py`, `shapes.py`, `seams.py` | value labels, bulk rectangles and polygons, seams between touching outlines |
|
|
2866
|
+
| `stats.py` | bins, densities, contours, LOWESS and swarm layout, adapted to plot_io's needs |
|
|
2867
|
+
| `kernels.py`, `_native/` | the numeric kernels (statistics, scaling, gathering) and their C library `plio`: sources, built binaries, bindings generated from `src/plio_api.h` (see `_native/README.md`) |
|
|
2868
|
+
| `decorations.py` | reference lines, spans, text and annotations |
|
|
2869
|
+
| `color/` | colors: `values.py` (the `color` validator, named color scales, palette references, alpha, saturation, luminance), `palettes.py` (palettes: the discrete colors series take in turn; registry, ggplot2's hues), `maps.py` (`ColorMap`: the gradients of color axes and the palette indices or positions of heatmap cells, evaluated in plot_io's C library), `data.py` (bundled map and palette colors) |
|
|
2870
|
+
| `sizemaps.py` | `SizeMap`: the diameters of size axes |
|
|
2871
|
+
| `markers.py`, `lines.py`, `text.py` | marker shapes, line dash styles, one-line text through `vec_io.text`: shaped lines (memoized in the font database, rich content per render), placed runs drawn as shaped, the title's paragraphs |
|
|
2872
|
+
| `styles/` | style registry and expansion; bundled styles (point libraries in `pt`) |
|
|
2873
|
+
| `values.py`, `density.py` | values given to `color`/`size` and their rules; `Density` (point density) |
|
|
2874
|
+
| `tables.py`, `facets.py` | columns of tables, `group=` splitting (`SeriesGroup`); `facet`, `FacetSet`, `LayerSet` |
|
|
2875
|
+
| `sharing.py`, `times.py` | shared axes; dates and times on axes |
|
|
2876
|
+
| `genome/` | genome tracks: `layout.py` (`Tracks`, the `Track` preset), `scale.py` (the genome scale: tick labels, label, origin), `tracks.py` (`BigWig`, `Bed`, `Genes`, `Gtf`, `HiC`: layers over stats `region_signal`, `intervals`, `contact_matrix`; registered layers), `sources.py` (reading readers by their methods), `regions.py`, `pack.py` (rows of intervals) |
|
|
2877
|
+
| `_backend.py` | the vec_io calls plot_io relies on (buffer intake, font databases shared between renders, path areas) |
|