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.
Files changed (81) hide show
  1. {plot3-0.5.0 → plot3-0.5.1}/PKG-INFO +1 -1
  2. plot3-0.5.1/plot3/__version__.py +1 -0
  3. {plot3-0.5.0 → plot3-0.5.1}/plot3/build.py +18 -4
  4. {plot3-0.5.0 → plot3-0.5.1}/plot3.egg-info/PKG-INFO +1 -1
  5. {plot3-0.5.0 → plot3-0.5.1}/tests/test_grammar.py +24 -0
  6. plot3-0.5.0/plot3/__version__.py +0 -1
  7. {plot3-0.5.0 → plot3-0.5.1}/LICENSE +0 -0
  8. {plot3-0.5.0 → plot3-0.5.1}/README.md +0 -0
  9. {plot3-0.5.0 → plot3-0.5.1}/plot3/__init__.py +0 -0
  10. {plot3-0.5.0 → plot3-0.5.1}/plot3/aesexpr.py +0 -0
  11. {plot3-0.5.0 → plot3-0.5.1}/plot3/calculus.py +0 -0
  12. {plot3-0.5.0 → plot3-0.5.1}/plot3/compose.py +0 -0
  13. {plot3-0.5.0 → plot3-0.5.1}/plot3/contour.py +0 -0
  14. {plot3-0.5.0 → plot3-0.5.1}/plot3/craft.py +0 -0
  15. {plot3-0.5.0 → plot3-0.5.1}/plot3/encode.py +0 -0
  16. {plot3-0.5.0 → plot3-0.5.1}/plot3/expr.py +0 -0
  17. {plot3-0.5.0 → plot3-0.5.1}/plot3/flip.py +0 -0
  18. {plot3-0.5.0 → plot3-0.5.1}/plot3/function.py +0 -0
  19. {plot3-0.5.0 → plot3-0.5.1}/plot3/geoms.py +0 -0
  20. {plot3-0.5.0 → plot3-0.5.1}/plot3/ggplot.py +0 -0
  21. {plot3-0.5.0 → plot3-0.5.1}/plot3/io.py +0 -0
  22. {plot3-0.5.0 → plot3-0.5.1}/plot3/jupyter.py +0 -0
  23. {plot3-0.5.0 → plot3-0.5.1}/plot3/latexin.py +0 -0
  24. {plot3-0.5.0 → plot3-0.5.1}/plot3/masking.py +0 -0
  25. {plot3-0.5.0 → plot3-0.5.1}/plot3/mathtext.py +0 -0
  26. {plot3-0.5.0 → plot3-0.5.1}/plot3/payload.py +0 -0
  27. {plot3-0.5.0 → plot3-0.5.1}/plot3/remote.py +0 -0
  28. {plot3-0.5.0 → plot3-0.5.1}/plot3/scales.py +0 -0
  29. {plot3-0.5.0 → plot3-0.5.1}/plot3/scaling.py +0 -0
  30. {plot3-0.5.0 → plot3-0.5.1}/plot3/special.py +0 -0
  31. {plot3-0.5.0 → plot3-0.5.1}/plot3/stat2d.py +0 -0
  32. {plot3-0.5.0 → plot3-0.5.1}/plot3/static.py +0 -0
  33. {plot3-0.5.0 → plot3-0.5.1}/plot3/stats3d.py +0 -0
  34. {plot3-0.5.0 → plot3-0.5.1}/plot3/table.py +0 -0
  35. {plot3-0.5.0 → plot3-0.5.1}/plot3/themes.py +0 -0
  36. {plot3-0.5.0 → plot3-0.5.1}/plot3/viewer.py +0 -0
  37. {plot3-0.5.0 → plot3-0.5.1}/plot3.egg-info/SOURCES.txt +0 -0
  38. {plot3-0.5.0 → plot3-0.5.1}/plot3.egg-info/dependency_links.txt +0 -0
  39. {plot3-0.5.0 → plot3-0.5.1}/plot3.egg-info/requires.txt +0 -0
  40. {plot3-0.5.0 → plot3-0.5.1}/plot3.egg-info/top_level.txt +0 -0
  41. {plot3-0.5.0 → plot3-0.5.1}/pyproject.toml +0 -0
  42. {plot3-0.5.0 → plot3-0.5.1}/setup.cfg +0 -0
  43. {plot3-0.5.0 → plot3-0.5.1}/tests/test_2d_density.py +0 -0
  44. {plot3-0.5.0 → plot3-0.5.1}/tests/test_3d.py +0 -0
  45. {plot3-0.5.0 → plot3-0.5.1}/tests/test_animation.py +0 -0
  46. {plot3-0.5.0 → plot3-0.5.1}/tests/test_annotate.py +0 -0
  47. {plot3-0.5.0 → plot3-0.5.1}/tests/test_api_public.py +0 -0
  48. {plot3-0.5.0 → plot3-0.5.1}/tests/test_array_backend.py +0 -0
  49. {plot3-0.5.0 → plot3-0.5.1}/tests/test_arrow.py +0 -0
  50. {plot3-0.5.0 → plot3-0.5.1}/tests/test_build_contract.py +0 -0
  51. {plot3-0.5.0 → plot3-0.5.1}/tests/test_contour.py +0 -0
  52. {plot3-0.5.0 → plot3-0.5.1}/tests/test_everyday_ggplot2.py +0 -0
  53. {plot3-0.5.0 → plot3-0.5.1}/tests/test_expr.py +0 -0
  54. {plot3-0.5.0 → plot3-0.5.1}/tests/test_facets_compose.py +0 -0
  55. {plot3-0.5.0 → plot3-0.5.1}/tests/test_geom_function.py +0 -0
  56. {plot3-0.5.0 → plot3-0.5.1}/tests/test_geoms_ds.py +0 -0
  57. {plot3-0.5.0 → plot3-0.5.1}/tests/test_ggplot2_extras2.py +0 -0
  58. {plot3-0.5.0 → plot3-0.5.1}/tests/test_ggplot2_parity.py +0 -0
  59. {plot3-0.5.0 → plot3-0.5.1}/tests/test_ggplot_extras.py +0 -0
  60. {plot3-0.5.0 → plot3-0.5.1}/tests/test_latex_input.py +0 -0
  61. {plot3-0.5.0 → plot3-0.5.1}/tests/test_lidar_scene.py +0 -0
  62. {plot3-0.5.0 → plot3-0.5.1}/tests/test_masking.py +0 -0
  63. {plot3-0.5.0 → plot3-0.5.1}/tests/test_math_layers.py +0 -0
  64. {plot3-0.5.0 → plot3-0.5.1}/tests/test_mathtext.py +0 -0
  65. {plot3-0.5.0 → plot3-0.5.1}/tests/test_payload.py +0 -0
  66. {plot3-0.5.0 → plot3-0.5.1}/tests/test_payload_display.py +0 -0
  67. {plot3-0.5.0 → plot3-0.5.1}/tests/test_point_cloud.py +0 -0
  68. {plot3-0.5.0 → plot3-0.5.1}/tests/test_r_oracle_parity.py +0 -0
  69. {plot3-0.5.0 → plot3-0.5.1}/tests/test_readme.py +0 -0
  70. {plot3-0.5.0 → plot3-0.5.1}/tests/test_remote_bridge.py +0 -0
  71. {plot3-0.5.0 → plot3-0.5.1}/tests/test_review_fixes.py +0 -0
  72. {plot3-0.5.0 → plot3-0.5.1}/tests/test_save_menu.py +0 -0
  73. {plot3-0.5.0 → plot3-0.5.1}/tests/test_scales_api.py +0 -0
  74. {plot3-0.5.0 → plot3-0.5.1}/tests/test_scales_themes.py +0 -0
  75. {plot3-0.5.0 → plot3-0.5.1}/tests/test_special.py +0 -0
  76. {plot3-0.5.0 → plot3-0.5.1}/tests/test_stat2d.py +0 -0
  77. {plot3-0.5.0 → plot3-0.5.1}/tests/test_static_save.py +0 -0
  78. {plot3-0.5.0 → plot3-0.5.1}/tests/test_stats_semantic.py +0 -0
  79. {plot3-0.5.0 → plot3-0.5.1}/tests/test_step3_geoms.py +0 -0
  80. {plot3-0.5.0 → plot3-0.5.1}/tests/test_table_backends.py +0 -0
  81. {plot3-0.5.0 → plot3-0.5.1}/tests/test_titles_theme.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plot3
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: ggplot2 grammar of graphics for Python: interactive WebGL figures and journal-ready PNG, SVG, and PDF
5
5
  Author: Rigoberto Leyva Salmeron
6
6
  License-Expression: MIT
@@ -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 = _apply_fill(dict(base_mapping), geom.kind)
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 = _apply_fill(dict(g.mapping), geom.kind)
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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plot3
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: ggplot2 grammar of graphics for Python: interactive WebGL figures and journal-ready PNG, SVG, and PDF
5
5
  Author: Rigoberto Leyva Salmeron
6
6
  License-Expression: MIT
@@ -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
@@ -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