plot3 0.6.2__py3-none-any.whl → 0.6.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plot3/__version__.py +1 -1
- plot3/contour.py +2 -2
- plot3/ggplot.py +3 -3
- plot3/static.py +5 -5
- plot3/viewer.py +16 -7
- {plot3-0.6.2.dist-info → plot3-0.6.4.dist-info}/METADATA +21 -19
- {plot3-0.6.2.dist-info → plot3-0.6.4.dist-info}/RECORD +10 -10
- {plot3-0.6.2.dist-info → plot3-0.6.4.dist-info}/WHEEL +0 -0
- {plot3-0.6.2.dist-info → plot3-0.6.4.dist-info}/licenses/LICENSE +0 -0
- {plot3-0.6.2.dist-info → plot3-0.6.4.dist-info}/top_level.txt +0 -0
plot3/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.6.
|
|
1
|
+
__version__ = "0.6.4"
|
plot3/contour.py
CHANGED
|
@@ -115,7 +115,7 @@ def _backend_name() -> str:
|
|
|
115
115
|
if _load_contourpy() is None:
|
|
116
116
|
raise ValueError(
|
|
117
117
|
"PLOT3_CONTOUR_BACKEND=contourpy but contourpy>=1.0 is not "
|
|
118
|
-
"installed. Install it with: pip install
|
|
118
|
+
"installed. Install it with: pip install contourpy"
|
|
119
119
|
)
|
|
120
120
|
return "contourpy"
|
|
121
121
|
if _load_contourpy() is None:
|
|
@@ -346,7 +346,7 @@ def _contour_contourpy(
|
|
|
346
346
|
if contourpy is None:
|
|
347
347
|
raise ValueError(
|
|
348
348
|
"PLOT3_CONTOUR_BACKEND=contourpy but contourpy>=1.0 is not "
|
|
349
|
-
"installed. Install it with: pip install
|
|
349
|
+
"installed. Install it with: pip install contourpy"
|
|
350
350
|
)
|
|
351
351
|
masked = np.ma.masked_invalid(np.asarray(field, dtype=np.float64))
|
|
352
352
|
generator = contourpy.contour_generator(
|
plot3/ggplot.py
CHANGED
|
@@ -517,7 +517,7 @@ class ggplot:
|
|
|
517
517
|
suffix writes the standalone HTML viewer. ``width`` and ``height``
|
|
518
518
|
are pixels unless ``units`` is ``"in"``, ``"cm"``, or ``"mm"``.
|
|
519
519
|
``dpi`` is the PNG resolution for a physical size (default 300).
|
|
520
|
-
PDF needs
|
|
520
|
+
PDF needs cairosvg and the Cairo C library. ``.svg``
|
|
521
521
|
needs neither.
|
|
522
522
|
"""
|
|
523
523
|
suffix = Path(path).suffix.lower()
|
|
@@ -683,8 +683,8 @@ def ggsave(
|
|
|
683
683
|
"""Save ``plot``.
|
|
684
684
|
|
|
685
685
|
``ggsave("fig.png", p)`` and ``ggsave("fig.svg", p)`` write a static
|
|
686
|
-
image. ``ggsave("fig.pdf", p)`` writes a PDF when
|
|
687
|
-
installed.
|
|
686
|
+
image. ``ggsave("fig.pdf", p)`` writes a PDF when cairosvg is
|
|
687
|
+
installed (``plot3[pdf]``). It also needs the Cairo C library; ``.svg`` writes
|
|
688
688
|
the same drawing with no extra dependencies. Any other suffix,
|
|
689
689
|
including ``.html``, writes the standalone viewer. The plot and the
|
|
690
690
|
filename can be passed in either order.
|
plot3/static.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
PNG, SVG, and PDF replay one list of drawing commands. SVG is text.
|
|
4
4
|
PNG and PDF are that same SVG rendered by cairosvg when the optional
|
|
5
|
-
``plot3[
|
|
5
|
+
``plot3[pdf]`` extra (cairosvg) is installed, so the three files share one
|
|
6
6
|
drawing and one font. That extra needs the Cairo C library as well as
|
|
7
7
|
the Python package (``libcairo2``, or the GTK runtime on Windows).
|
|
8
8
|
Without cairosvg, PNG falls back to a zlib RGB file and a built-in
|
|
@@ -42,7 +42,7 @@ _UNIT_INCH = {
|
|
|
42
42
|
}
|
|
43
43
|
_EXPORT_HINT = (
|
|
44
44
|
"ggsave() needs the Cairo C library to write PDF with a journal font. "
|
|
45
|
-
"Install
|
|
45
|
+
"Install it with: pip install cairosvg. "
|
|
46
46
|
"Windows and minimal Linux images also need the Cairo library itself "
|
|
47
47
|
"(for example the libcairo2 package, or the GTK runtime). "
|
|
48
48
|
"ggsave('fig.svg', plot) writes the same drawing with no extra dependencies."
|
|
@@ -196,8 +196,8 @@ def save_static(
|
|
|
196
196
|
``"cm"`` and ``"mm"``) with ``dpi`` (default 300) sets a physical
|
|
197
197
|
page. Layout stays in CSS pixels (96 per inch) so type keeps its
|
|
198
198
|
size, and cairosvg rasterizes that SVG at ``dpi``. PDF and a
|
|
199
|
-
journal-font PNG need the Cairo C library (``pip install
|
|
200
|
-
|
|
199
|
+
journal-font PNG need cairosvg and the Cairo C library (``pip install
|
|
200
|
+
cairosvg``). ``.svg`` needs nothing extra.
|
|
201
201
|
"""
|
|
202
202
|
path = Path(path)
|
|
203
203
|
suffix = path.suffix.lower()
|
|
@@ -251,7 +251,7 @@ def save_static(
|
|
|
251
251
|
if fallback:
|
|
252
252
|
print(
|
|
253
253
|
"plot3: PNG used the built-in font. "
|
|
254
|
-
"pip install
|
|
254
|
+
"pip install cairosvg for Helvetica."
|
|
255
255
|
)
|
|
256
256
|
return str(path)
|
|
257
257
|
|
plot3/viewer.py
CHANGED
|
@@ -55,6 +55,9 @@ body{display:flex;flex-direction:column}
|
|
|
55
55
|
#legend .sz-block{clear:both;padding-top:6px}
|
|
56
56
|
#legend .bub{display:inline-block;border-radius:50%;box-sizing:border-box;flex:none;
|
|
57
57
|
border:1px solid rgba(0,0,0,.35)}
|
|
58
|
+
#legend.docked{display:flex!important;flex-wrap:wrap;align-items:center;column-gap:14px;row-gap:0;line-height:1.5}
|
|
59
|
+
#legend.docked .sz-block{display:flex;flex-wrap:wrap;align-items:center;column-gap:10px;padding-top:0;clear:none}
|
|
60
|
+
#legend.docked .sz{margin:0}
|
|
58
61
|
#player{display:none;flex:none;align-items:center;flex-wrap:wrap;gap:8px;padding:4px 10px 8px;max-width:100%;box-sizing:border-box}
|
|
59
62
|
#player button{font:inherit;padding:3px 10px;border-radius:5px;cursor:pointer}
|
|
60
63
|
#player #play-range{flex:1;min-width:80px}
|
|
@@ -345,19 +348,25 @@ function showLegendBox() {
|
|
|
345
348
|
legEl.style.border = '1px solid ' + T.grid;
|
|
346
349
|
legEl.style.color = T.ink2;
|
|
347
350
|
}
|
|
351
|
+
// Height the docked legend takes at the bottom; the plot shrinks by it.
|
|
352
|
+
let legendReserve = 0;
|
|
348
353
|
function placeLegend() {
|
|
349
|
-
|
|
354
|
+
legendReserve = 0;
|
|
355
|
+
if (!legEl || legEl.style.display === 'none') return;
|
|
350
356
|
const figH = figEl.clientHeight || 0;
|
|
351
357
|
if (figH < 40) return;
|
|
352
|
-
// A key taller than the panel covers the
|
|
353
|
-
|
|
358
|
+
// A key taller than the panel covers the data (a short notebook output).
|
|
359
|
+
// Lay it out in rows under the axes, and keep that room free.
|
|
360
|
+
if (legEl.dataset.docked !== '1' && legEl.offsetHeight > figH * 0.40) {
|
|
354
361
|
legEl.dataset.docked = '1';
|
|
362
|
+
legEl.classList.add('docked');
|
|
355
363
|
legEl.style.top = 'auto';
|
|
356
|
-
legEl.style.bottom = '
|
|
364
|
+
legEl.style.bottom = '6px';
|
|
357
365
|
legEl.style.left = '8px';
|
|
358
366
|
legEl.style.right = '8px';
|
|
359
367
|
legEl.style.maxWidth = 'none';
|
|
360
368
|
}
|
|
369
|
+
if (legEl.dataset.docked === '1') legendReserve = legEl.offsetHeight + 8;
|
|
361
370
|
}
|
|
362
371
|
const LEGEND_GLYPH = { circle: '●', triangle: '▲', square: '■', diamond: '◆', plus: '+', cross: '×' };
|
|
363
372
|
// Legend keys: a square, the point's symbol, or a short (dashed) line.
|
|
@@ -2036,7 +2045,7 @@ if (!S.is3d) {
|
|
|
2036
2045
|
function layout() {
|
|
2037
2046
|
placeLegend();
|
|
2038
2047
|
W = Math.max(50, figEl.clientWidth - M.l - M.r);
|
|
2039
|
-
H = Math.max(50, figEl.clientHeight - M.t - M.b);
|
|
2048
|
+
H = Math.max(50, figEl.clientHeight - M.t - M.b - legendReserve);
|
|
2040
2049
|
if (equalAspect) applyEqual();
|
|
2041
2050
|
host.style.left = M.l + 'px'; host.style.top = M.t + 'px';
|
|
2042
2051
|
renderer.setSize(W, H);
|
|
@@ -2741,7 +2750,7 @@ if (!S.is3d) {
|
|
|
2741
2750
|
|
|
2742
2751
|
function layout() {
|
|
2743
2752
|
placeLegend();
|
|
2744
|
-
const w = Math.max(figEl.clientWidth, 1), h = Math.max(figEl.clientHeight, 1);
|
|
2753
|
+
const w = Math.max(figEl.clientWidth, 1), h = Math.max(figEl.clientHeight - legendReserve, 1);
|
|
2745
2754
|
renderer.setSize(w, h);
|
|
2746
2755
|
cam.aspect = w / h;
|
|
2747
2756
|
cam.updateProjectionMatrix();
|
|
@@ -2763,7 +2772,7 @@ if (!S.is3d) {
|
|
|
2763
2772
|
const touches = (a, b, air) => a[0] - air < b[0] + b[2] && b[0] - air < a[0] + a[2] &&
|
|
2764
2773
|
a[1] - air < b[1] + b[3] && b[1] - air < a[1] + a[3];
|
|
2765
2774
|
function declutterTicks() {
|
|
2766
|
-
const w = Math.max(figEl.clientWidth, 1), h = Math.max(figEl.clientHeight, 1);
|
|
2775
|
+
const w = Math.max(figEl.clientWidth, 1), h = Math.max(figEl.clientHeight - legendReserve, 1);
|
|
2767
2776
|
const placed = [];
|
|
2768
2777
|
for (const marks of tickSprites) {
|
|
2769
2778
|
if (!marks.length) continue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plot3
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.4
|
|
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
|
|
@@ -17,18 +17,12 @@ Description-Content-Type: text/markdown
|
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: numpy>=1.24
|
|
19
19
|
Requires-Dist: pandas>=2.0
|
|
20
|
-
Provides-Extra:
|
|
21
|
-
Requires-Dist:
|
|
20
|
+
Provides-Extra: pdf
|
|
21
|
+
Requires-Dist: cairosvg>=2.7; extra == "pdf"
|
|
22
22
|
Provides-Extra: dev
|
|
23
23
|
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
24
24
|
Requires-Dist: polars>=1.0; extra == "dev"
|
|
25
25
|
Requires-Dist: contourpy>=1.0; extra == "dev"
|
|
26
|
-
Provides-Extra: jupyter
|
|
27
|
-
Requires-Dist: ipython>=8.0; extra == "jupyter"
|
|
28
|
-
Provides-Extra: polars
|
|
29
|
-
Requires-Dist: polars>=1.0; extra == "polars"
|
|
30
|
-
Provides-Extra: export
|
|
31
|
-
Requires-Dist: cairosvg>=2.7; extra == "export"
|
|
32
26
|
Dynamic: license-file
|
|
33
27
|
|
|
34
28
|
# plot3
|
|
@@ -57,7 +51,7 @@ in the notebook and save as journal-ready PNG, SVG, or PDF.
|
|
|
57
51
|
</table>
|
|
58
52
|
|
|
59
53
|
```bash
|
|
60
|
-
pip install
|
|
54
|
+
pip install plot3
|
|
61
55
|
```
|
|
62
56
|
|
|
63
57
|
Contents: [Plot an equation](#plot-an-equation) ·
|
|
@@ -279,27 +273,35 @@ In notebooks, bare column names work as in R: `aes(x=dose, y=response)`.
|
|
|
279
273
|
## Install
|
|
280
274
|
|
|
281
275
|
```bash
|
|
282
|
-
pip install
|
|
276
|
+
pip install plot3
|
|
283
277
|
```
|
|
284
278
|
|
|
285
279
|
Python 3.10 or newer; NumPy and pandas are the only required packages.
|
|
280
|
+
Notebooks, pandas, and Polars tables work with no extras.
|
|
286
281
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
282
|
+
For PDF, and PNG with real fonts, add cairosvg and the Cairo library. SVG
|
|
283
|
+
needs neither.
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
pip install cairosvg
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
brew install cairo
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
(`apt install libcairo2` on Debian and Ubuntu.) `pip install "plot3[pdf]"`
|
|
294
|
+
installs plot3 and cairosvg together.
|
|
293
295
|
|
|
294
296
|
The latest unreleased code installs from GitHub with
|
|
295
|
-
`pip install "plot3
|
|
297
|
+
`pip install "plot3 @ git+https://github.com/rleyvasal/plot3"`.
|
|
296
298
|
|
|
297
299
|
## Development
|
|
298
300
|
|
|
299
301
|
```bash
|
|
300
302
|
git clone https://github.com/rleyvasal/plot3 && cd plot3
|
|
301
303
|
python3 -m venv .venv && source .venv/bin/activate
|
|
302
|
-
pip install -e ".[dev
|
|
304
|
+
pip install -e ".[dev]"
|
|
303
305
|
pytest -q # includes every example in this README and docs/reference.md
|
|
304
306
|
python examples/showcase_2d.py # 2D gallery in the browser
|
|
305
307
|
python examples/showcase_3d.py # 3D gallery
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
plot3/__init__.py,sha256=-jbV46XmzHZJzv7jrfi50on5Xxs1PJ8U3aV7bbSm1VA,6016
|
|
2
|
-
plot3/__version__.py,sha256=
|
|
2
|
+
plot3/__version__.py,sha256=WMmvm2Keb76yMz8OL_h4fKT34Xpi-1BVfCiTn2QGzz4,22
|
|
3
3
|
plot3/aesexpr.py,sha256=5GbKRX0FZFpDXCDzsZzZW32MKK3uI24Y9nabNJO5RRc,10449
|
|
4
4
|
plot3/build.py,sha256=cEiC9x34uplWWVCuNyAX-vpKbGiF3RIHhCyLHqqJ6EI,171107
|
|
5
5
|
plot3/calculus.py,sha256=yBnZYVHKAehNIdZjYj7fWHadOTQBgSx5Ys8tNQaw11s,45442
|
|
6
6
|
plot3/compose.py,sha256=BICOe1QMnI17k83YqJe8NBKs6lWnjuDox71Sv-erkM0,11513
|
|
7
|
-
plot3/contour.py,sha256=
|
|
7
|
+
plot3/contour.py,sha256=0EA9EJhhlqq8-cXdqHDnEKoNToNtM5NDp-hhL3z5G9I,20397
|
|
8
8
|
plot3/craft.py,sha256=gZMIrLyY0BJhLNJkBUuP7hEKnkvg7_8M5jITsIFwykA,4639
|
|
9
9
|
plot3/encode.py,sha256=1t1XQwbPV-vKJtTAKkJzr2Kc8umfjsuvffVxyICwcpc,2309
|
|
10
10
|
plot3/expr.py,sha256=lRYeAkMIhQzhwl4uz1oX5zc5SIjJkT6L8FaA_7DuYTY,54584
|
|
11
11
|
plot3/flip.py,sha256=Ox9yxjYzbEpm96raN_qupKru__hEfSMkCZxv01vGOuk,9724
|
|
12
12
|
plot3/function.py,sha256=LYKLPEIdoEp_SnoNYNEXMcV3Mkoh4NyMT1FWyERhZ3c,48749
|
|
13
13
|
plot3/geoms.py,sha256=HsD_opv4cM65XK_X2nMjMz59rZhUS6ajkTK24g1lVAA,90151
|
|
14
|
-
plot3/ggplot.py,sha256=
|
|
14
|
+
plot3/ggplot.py,sha256=_QN6_sFJp2-fVbIM5yBNA4vd54Nd9yez4JU3eoCbCYg,26710
|
|
15
15
|
plot3/io.py,sha256=FirkYHP4r1vaG10dmELCaa7JUwvlc1kwwKtp4zXfXHg,2649
|
|
16
16
|
plot3/jupyter.py,sha256=6EgHacP3eBQ9JGM8nXCNgLosA7tTDFjR-gWij1-oaQM,17790
|
|
17
17
|
plot3/latexin.py,sha256=RrXF6UClHLmsmRH8qCkFOCSgFJxrqPeyzik9t7Ce7iE,21007
|
|
@@ -23,13 +23,13 @@ plot3/scales.py,sha256=rBZbM7Z9YcJNjP7Vr3WwAukF2cDqAyGXWPx3Mo8Nko8,14197
|
|
|
23
23
|
plot3/scaling.py,sha256=3z-m5sGh0BQcQQRIwlsX6tVaGGyMIF2DVcIEGHmY00Y,28316
|
|
24
24
|
plot3/special.py,sha256=ARUav8LGcVe_cPbHoLy73O2U_2wuxUVjvoSwVYfm1-Y,12584
|
|
25
25
|
plot3/stat2d.py,sha256=4a4C3HxBEOeRuMCQXHgLClxFIkPT2-Fz6DJZDev5kdg,66429
|
|
26
|
-
plot3/static.py,sha256=
|
|
26
|
+
plot3/static.py,sha256=qzyXkX7AdcQJS4oUadSGuYE1_MTO14e0WuvjMx_qTgc,154532
|
|
27
27
|
plot3/stats3d.py,sha256=B6WCKen7eAHSMlkeo3tnfUGcA1tpdH4OVKOl_5vkbmo,15714
|
|
28
28
|
plot3/table.py,sha256=v4G6NgbEPKv6RakSHLnvfdkWNAaApEgel9be0PzPUMA,26033
|
|
29
29
|
plot3/themes.py,sha256=pQnsBApRRlwQxXPrBFJVYuo6kYan8bgdT3Nlm0T9XFg,5179
|
|
30
|
-
plot3/viewer.py,sha256=
|
|
31
|
-
plot3-0.6.
|
|
32
|
-
plot3-0.6.
|
|
33
|
-
plot3-0.6.
|
|
34
|
-
plot3-0.6.
|
|
35
|
-
plot3-0.6.
|
|
30
|
+
plot3/viewer.py,sha256=TWfHDhmzZkowkidsc2elt4lXkFSeQzBfpxjmfKZj264,141647
|
|
31
|
+
plot3-0.6.4.dist-info/licenses/LICENSE,sha256=OPphTrXUbMt4GNrsK8juVty13iThKFPIPnu_nh4UlAk,1081
|
|
32
|
+
plot3-0.6.4.dist-info/METADATA,sha256=U-FW0uwbsM6nQPdDG_DtBvAKmXoqbDnn7qvB-iYdHAo,14007
|
|
33
|
+
plot3-0.6.4.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
34
|
+
plot3-0.6.4.dist-info/top_level.txt,sha256=wFHSJTzHoaJCrffpONuI8hayEblnTzRMi2y3qCcKzD0,6
|
|
35
|
+
plot3-0.6.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|