plot3 0.5.0__tar.gz → 0.5.1__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.
- {plot3-0.5.0 → plot3-0.5.1}/PKG-INFO +1 -1
- plot3-0.5.1/plot3/__version__.py +1 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/build.py +18 -4
- {plot3-0.5.0 → plot3-0.5.1}/plot3.egg-info/PKG-INFO +1 -1
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_grammar.py +24 -0
- plot3-0.5.0/plot3/__version__.py +0 -1
- {plot3-0.5.0 → plot3-0.5.1}/LICENSE +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/README.md +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/__init__.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/aesexpr.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/calculus.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/compose.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/contour.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/craft.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/encode.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/expr.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/flip.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/function.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/geoms.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/ggplot.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/io.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/jupyter.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/latexin.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/masking.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/mathtext.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/payload.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/remote.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/scales.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/scaling.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/special.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/stat2d.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/static.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/stats3d.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/table.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/themes.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3/viewer.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3.egg-info/SOURCES.txt +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3.egg-info/dependency_links.txt +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3.egg-info/requires.txt +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/plot3.egg-info/top_level.txt +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/pyproject.toml +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/setup.cfg +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_2d_density.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_3d.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_animation.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_annotate.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_api_public.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_array_backend.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_arrow.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_build_contract.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_contour.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_everyday_ggplot2.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_expr.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_facets_compose.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_geom_function.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_geoms_ds.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_ggplot2_extras2.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_ggplot2_parity.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_ggplot_extras.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_latex_input.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_lidar_scene.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_masking.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_math_layers.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_mathtext.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_payload.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_payload_display.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_point_cloud.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_r_oracle_parity.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_readme.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_remote_bridge.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_review_fixes.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_save_menu.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_scales_api.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_scales_themes.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_special.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_stat2d.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_static_save.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_stats_semantic.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_step3_geoms.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_table_backends.py +0 -0
- {plot3-0.5.0 → plot3-0.5.1}/tests/test_titles_theme.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.5.1"
|
|
@@ -440,6 +440,22 @@ def _apply_fill(mapping: dict, kind: str) -> dict:
|
|
|
440
440
|
return out
|
|
441
441
|
|
|
442
442
|
|
|
443
|
+
def _layer_mapping(base_mapping, geom) -> dict:
|
|
444
|
+
"""The plot's mapping with the layer's own on top, fill resolved per side.
|
|
445
|
+
|
|
446
|
+
A set colour (``geom_point(colour="black")`` under ``aes(colour=g)``)
|
|
447
|
+
replaces the inherited colour mapping for that layer, as in ggplot2, so
|
|
448
|
+
the layer neither recolours nor needs the column. Filled layers keep
|
|
449
|
+
it: there ``colour=`` is the outline.
|
|
450
|
+
"""
|
|
451
|
+
kind = getattr(geom, "kind", None)
|
|
452
|
+
mapping = _apply_fill(dict(base_mapping), kind)
|
|
453
|
+
if getattr(geom, "const_color", None) is not None and kind not in _FILL_KINDS:
|
|
454
|
+
mapping.pop("color", None)
|
|
455
|
+
mapping.update(_apply_fill(dict(geom.mapping), kind))
|
|
456
|
+
return mapping
|
|
457
|
+
|
|
458
|
+
|
|
443
459
|
_REF_KINDS = frozenset({"hline", "vline", "abline"})
|
|
444
460
|
_MM_TO_PX = 96.0 / 25.4
|
|
445
461
|
|
|
@@ -571,8 +587,7 @@ def expand_stat_geom(
|
|
|
571
587
|
layers = expand_vector_field(geom, transition, slider)
|
|
572
588
|
return layers[0] if len(layers) == 1 else layers
|
|
573
589
|
# Resolve fill per mapping, so a layer's own colour beats a base fill.
|
|
574
|
-
mapping =
|
|
575
|
-
mapping.update(_apply_fill(dict(geom.mapping), geom.kind))
|
|
590
|
+
mapping = _layer_mapping(base_mapping, geom)
|
|
576
591
|
if geom.kind == "box3d":
|
|
577
592
|
from plot3.stats3d import box3d_layers
|
|
578
593
|
|
|
@@ -1964,8 +1979,7 @@ def build_spec(g: ggplot) -> tuple[dict, list[tuple[str, str]]]:
|
|
|
1964
1979
|
if getattr(geom, "_replace_mapping", False):
|
|
1965
1980
|
m = dict(geom.mapping)
|
|
1966
1981
|
else:
|
|
1967
|
-
m =
|
|
1968
|
-
m.update(_apply_fill(dict(geom.mapping), geom.kind))
|
|
1982
|
+
m = _layer_mapping(g.mapping, geom)
|
|
1969
1983
|
if "x" not in m or "y" not in m:
|
|
1970
1984
|
raise ValueError("aes(x=, y=) are required (bar/histogram/density supply y)")
|
|
1971
1985
|
if geom.kind == "surface" and "z" not in m:
|
|
@@ -97,3 +97,27 @@ def test_scale_colour_viridis_on_points(cloud):
|
|
|
97
97
|
def test_unknown_add_raises(cars):
|
|
98
98
|
with pytest.raises(TypeError, match="cannot add"):
|
|
99
99
|
_ = ggplot(cars, aes(x="wt", y="mpg")) + 123
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def test_set_colour_replaces_inherited_colour_mapping():
|
|
103
|
+
# ggplot2: geom_point(colour = "black") under aes(colour = g) draws black,
|
|
104
|
+
# and the layer's own data need not have g.
|
|
105
|
+
import pandas as pd
|
|
106
|
+
|
|
107
|
+
from plot3 import aes, geom_boxplot, geom_point, ggplot
|
|
108
|
+
from plot3.build import build_spec
|
|
109
|
+
|
|
110
|
+
df = pd.DataFrame({"x": [1, 2, 3], "y": [1, 2, 3], "g": ["a", "b", "c"]})
|
|
111
|
+
centre = pd.DataFrame({"x": [2], "y": [2]})
|
|
112
|
+
spec, _ = build_spec(
|
|
113
|
+
ggplot(df, aes(x="x", y="y", colour="g")) + geom_point()
|
|
114
|
+
+ geom_point(data=centre, colour="black", shape="cross")
|
|
115
|
+
)
|
|
116
|
+
assert spec["layers"][0].get("color") is not None
|
|
117
|
+
assert spec["layers"][1].get("color") is None
|
|
118
|
+
assert spec["layers"][1]["constColor"] == "#000000"
|
|
119
|
+
# A filled layer keeps its mapped fill under a set outline colour.
|
|
120
|
+
spec, _ = build_spec(
|
|
121
|
+
ggplot(df, aes(x="g", y="y", fill="g")) + geom_boxplot(colour="black")
|
|
122
|
+
)
|
|
123
|
+
assert spec["layers"][0].get("color") is not None
|
plot3-0.5.0/plot3/__version__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.5.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|