kaxe 1.4.4.dev11__tar.gz → 1.4.4.dev13__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.
- {kaxe-1.4.4.dev11/src/kaxe.egg-info → kaxe-1.4.4.dev13}/PKG-INFO +1 -1
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/pyproject.toml +1 -1
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/axis.py +1 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/svg.py +44 -11
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d2/point.py +29 -6
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/grid.py +24 -2
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13/src/kaxe.egg-info}/PKG-INFO +1 -1
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/LICENSE +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/MANIFEST.in +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/README.md +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/setup.cfg +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/__init__.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/chart/__init__.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/chart/bar.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/chart/box.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/chart/pie.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/chart/qqplot.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/__init__.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/color.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/d3/backend.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/d3/camera.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/d3/helper.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/d3/hud.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/d3/objects/__init__.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/d3/objects/color.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/d3/objects/line.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/d3/objects/point.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/d3/objects/pointer.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/d3/objects/triangle.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/d3/openglrender.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/d3/translator.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/draw.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/fileloader.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/helper.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/legend.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/line.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/marker.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/profiler.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/round.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/shapes.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/styles.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/svg_pdf.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/symbol.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/text.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/core/window.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/data/__init__.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/data/excel.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/__init__.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/_lazy.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d2/__init__.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d2/arrow.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d2/bubble.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d2/contour.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d2/equation.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d2/fill.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d2/function.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d2/map.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d2/parameter.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d2/pillar.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d3/__init__.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d3/base.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d3/function.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d3/mesh.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d3/point.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/d3/potato.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/function.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/legend.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/mapdata.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/point.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/objects/text.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/__init__.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/_lazy.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/box.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/constants.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/d3/__init__.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/d3/axes.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/d3/geometry.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/d3/plot3d.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/d3/variants.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/double.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/empty.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/log.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/polar.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/standard.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/themes.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/zoom.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/plot/zoom_connector.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/__init__.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/__init__.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.bright-oblique.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.bright-roman.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.bright-semibold.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.bright-semiboldoblique.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.classical-serif-italic.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.concrete-bold.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.concrete-bolditalic.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.concrete-italic.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.concrete-roman.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.sans-serif-bold.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.sans-serif-boldoblique.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.sans-serif-demi-condensed-demicondensed.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.sans-serif-medium.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.sans-serif-oblique.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.serif-bold.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.serif-bolditalic.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.serif-extra-boldslanted.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.serif-extra-romanslanted.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.serif-italic.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.serif-roman.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.serif-upright-italic-uprightitalic.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.typewriter-text-bold.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.typewriter-text-bolditalic.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.typewriter-text-italic.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.typewriter-text-light.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.typewriter-text-lightoblique.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.typewriter-text-regular.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.typewriter-text-variable-width-italic.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.typewriter-text-variable-width-medium.ttf +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/readme.txt +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/logo-small.png +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/symbolcross.png +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/symboldonut.png +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/symbollollipop.png +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/symboltriangle.png +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe.egg-info/SOURCES.txt +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe.egg-info/dependency_links.txt +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe.egg-info/requires.txt +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe.egg-info/top_level.txt +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/tests/test.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/tests/test2.py +0 -0
- {kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/tests/test3.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kaxe
|
|
3
|
-
Version: 1.4.4.
|
|
3
|
+
Version: 1.4.4.dev13
|
|
4
4
|
Summary: A small graphing tool for functions, points, equations and more
|
|
5
5
|
Author-email: Valter Yde Daugberg <valteryde@hotmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/valteryde/kaxe
|
|
@@ -57,6 +57,8 @@ class SvgDocument:
|
|
|
57
57
|
self._width, self._height = int(size[0]), int(size[1])
|
|
58
58
|
self._elements: list[ET.Element] = []
|
|
59
59
|
self._fondi_font_css: Optional[str] = None
|
|
60
|
+
self._clip_defs: list[ET.Element] = []
|
|
61
|
+
self._clip_counter = 0
|
|
60
62
|
|
|
61
63
|
@property
|
|
62
64
|
def height(self) -> int:
|
|
@@ -285,9 +287,11 @@ class SvgDocument:
|
|
|
285
287
|
rotate: float = 0,
|
|
286
288
|
rotate_center: Optional[tuple[float, float]] = None,
|
|
287
289
|
) -> None:
|
|
288
|
-
"""Place an image; y is in kaxe coords (y-up)
|
|
290
|
+
"""Place an image; y is in kaxe coords (y-up) unless y_coord='svg_top'."""
|
|
289
291
|
href = pil_to_data_uri(img)
|
|
290
|
-
if y_coord == "
|
|
292
|
+
if y_coord == "svg_top":
|
|
293
|
+
svg_top = y
|
|
294
|
+
elif y_coord == "top":
|
|
291
295
|
svg_top = self.flip_y(y)
|
|
292
296
|
else:
|
|
293
297
|
svg_top = self.flip_y(y) - img.height
|
|
@@ -359,15 +363,22 @@ class SvgDocument:
|
|
|
359
363
|
"viewBox": f"0 0 {self._width} {self._height}",
|
|
360
364
|
},
|
|
361
365
|
)
|
|
362
|
-
if self._fondi_font_css is not None:
|
|
366
|
+
if self._fondi_font_css is not None or self._clip_defs:
|
|
363
367
|
defs = ET.SubElement(root, f"{{{SVG_NS}}}defs")
|
|
364
|
-
|
|
365
|
-
|
|
368
|
+
if self._fondi_font_css is not None:
|
|
369
|
+
style = ET.SubElement(defs, f"{{{SVG_NS}}}style")
|
|
370
|
+
style.text = self._fondi_font_css
|
|
371
|
+
for clip_el in self._clip_defs:
|
|
372
|
+
defs.append(clip_el)
|
|
366
373
|
for el in self._elements:
|
|
367
374
|
root.append(el)
|
|
368
375
|
body = ET.tostring(root, encoding="unicode")
|
|
369
|
-
|
|
370
|
-
|
|
376
|
+
try:
|
|
377
|
+
from fondi.backends.svg import _ascii_safe_svg_markup
|
|
378
|
+
|
|
379
|
+
body = _ascii_safe_svg_markup(body)
|
|
380
|
+
except ImportError:
|
|
381
|
+
pass
|
|
371
382
|
return '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n' + body
|
|
372
383
|
|
|
373
384
|
def to_pdf(self, fname: Optional[Union[str, BytesIO]] = None) -> bytes:
|
|
@@ -408,14 +419,36 @@ def embed_svg_children(
|
|
|
408
419
|
children: list[ET.Element],
|
|
409
420
|
tx: float,
|
|
410
421
|
ty: float,
|
|
422
|
+
*,
|
|
423
|
+
clip_size: Optional[tuple[float, float]] = None,
|
|
411
424
|
) -> None:
|
|
412
425
|
"""Embed copied SVG children at top-left offset (SVG y-down coordinates)."""
|
|
413
426
|
if not children:
|
|
414
427
|
return
|
|
415
|
-
|
|
416
|
-
f"{{
|
|
417
|
-
|
|
418
|
-
|
|
428
|
+
attribs: dict[str, str] = {
|
|
429
|
+
"transform": f"translate({round(tx, 3)},{round(ty, 3)})",
|
|
430
|
+
}
|
|
431
|
+
if clip_size is not None:
|
|
432
|
+
clip_w, clip_h = clip_size
|
|
433
|
+
clip_id = f"kaxe-clip-{doc._clip_counter}"
|
|
434
|
+
doc._clip_counter += 1
|
|
435
|
+
clip_path = ET.Element(
|
|
436
|
+
f"{{{SVG_NS}}}clipPath",
|
|
437
|
+
{"id": clip_id},
|
|
438
|
+
)
|
|
439
|
+
ET.SubElement(
|
|
440
|
+
clip_path,
|
|
441
|
+
f"{{{SVG_NS}}}rect",
|
|
442
|
+
{
|
|
443
|
+
"x": "0",
|
|
444
|
+
"y": "0",
|
|
445
|
+
"width": str(round(clip_w, 3)),
|
|
446
|
+
"height": str(round(clip_h, 3)),
|
|
447
|
+
},
|
|
448
|
+
)
|
|
449
|
+
doc._clip_defs.append(clip_path)
|
|
450
|
+
attribs["clip-path"] = f"url(#{clip_id})"
|
|
451
|
+
group = ET.Element(f"{{{SVG_NS}}}g", attribs)
|
|
419
452
|
for child in children:
|
|
420
453
|
group.append(copy.deepcopy(child))
|
|
421
454
|
doc._elements.append(group)
|
|
@@ -28,9 +28,8 @@ class Points2D:
|
|
|
28
28
|
lollipop : bool, optional
|
|
29
29
|
If True, the points will be represented as lollipops. Default is False.
|
|
30
30
|
show_points : bool, optional
|
|
31
|
-
If False, point markers are not drawn. With ``connect=True``,
|
|
32
|
-
|
|
33
|
-
Default is True.
|
|
31
|
+
If False, point markers are not drawn. With ``connect=True``, only the
|
|
32
|
+
connector polyline is drawn. Default is True.
|
|
34
33
|
"""
|
|
35
34
|
|
|
36
35
|
def __init__(self, x, y, color:tuple=None, size:int=None, symbol:str=None, connect:bool=False, lollipop=False, show_points:bool=True):
|
|
@@ -89,6 +88,10 @@ class Points2D:
|
|
|
89
88
|
size = max(1, round(self.size * scale))
|
|
90
89
|
line_width = max(1, int(size * 0.5))
|
|
91
90
|
|
|
91
|
+
if self.connect and not self.show_points:
|
|
92
|
+
self.__finalizeConnectedLine__(parent, line_width)
|
|
93
|
+
return
|
|
94
|
+
|
|
92
95
|
for i, (x,y) in enumerate(zip(self.x,self.y)):
|
|
93
96
|
x,y = parent.pixel(x, y)
|
|
94
97
|
|
|
@@ -106,8 +109,6 @@ class Points2D:
|
|
|
106
109
|
else:
|
|
107
110
|
radius = line_width / 2 if self.connect else size / 2
|
|
108
111
|
shapes.Circle(x, y, radius, self.color, batch=self.batch)
|
|
109
|
-
elif self.connect:
|
|
110
|
-
shapes.Circle(x, y, line_width / 2, self.color, batch=self.batch)
|
|
111
112
|
|
|
112
113
|
# lollipop (lagt til lines)
|
|
113
114
|
if self.lollipop:
|
|
@@ -123,7 +124,7 @@ class Points2D:
|
|
|
123
124
|
if x1 is None or y1 is None or x is None or y is None:
|
|
124
125
|
continue
|
|
125
126
|
|
|
126
|
-
skip_dist = size if self.symbol else
|
|
127
|
+
skip_dist = size if self.symbol else None
|
|
127
128
|
if skip_dist and vlen(vdiff((x1, y1), (x,y))) < skip_dist:
|
|
128
129
|
continue
|
|
129
130
|
|
|
@@ -132,6 +133,28 @@ class Points2D:
|
|
|
132
133
|
|
|
133
134
|
line = shapes.Line(x,y, x1, y1, color=self.color, width=line_width, batch=self.batch, center=True)
|
|
134
135
|
self.lines.append(line)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def __finalizeConnectedLine__(self, parent, line_width):
|
|
139
|
+
points = []
|
|
140
|
+
for x_val, y_val in zip(self.x, self.y):
|
|
141
|
+
px, py = parent.pixel(x_val, y_val)
|
|
142
|
+
if px is None or py is None:
|
|
143
|
+
continue
|
|
144
|
+
if not parent.inside(px, py):
|
|
145
|
+
continue
|
|
146
|
+
points.append(parent.clamp(px, py))
|
|
147
|
+
|
|
148
|
+
if len(points) < 2:
|
|
149
|
+
return
|
|
150
|
+
if len(points) == 2:
|
|
151
|
+
x0, y0 = points[0]
|
|
152
|
+
x1, y1 = points[1]
|
|
153
|
+
line = shapes.Line(x0, y0, x1, y1, color=self.color, width=line_width, batch=self.batch, center=True)
|
|
154
|
+
self.lines.append(line)
|
|
155
|
+
return
|
|
156
|
+
|
|
157
|
+
shapes.LineSegment(points, color=self.color, width=line_width, batch=self.batch)
|
|
135
158
|
|
|
136
159
|
|
|
137
160
|
def draw(self, *args, **kwargs):
|
|
@@ -94,6 +94,7 @@ class Grid(AttrObject):
|
|
|
94
94
|
"""
|
|
95
95
|
|
|
96
96
|
self.__legends = legends
|
|
97
|
+
self._invalidate_bake_cache()
|
|
97
98
|
|
|
98
99
|
|
|
99
100
|
def theme(self, theme):
|
|
@@ -110,10 +111,21 @@ class Grid(AttrObject):
|
|
|
110
111
|
plot.__included__ = []
|
|
111
112
|
plot.__baked__ = False
|
|
112
113
|
plot.__bakedImage__ = False
|
|
114
|
+
for axis in (getattr(plot, "firstAxis", None), getattr(plot, "secondAxis", None)):
|
|
115
|
+
if axis is not None:
|
|
116
|
+
axis.markers = []
|
|
117
|
+
axis.title = None
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _invalidate_bake_cache(self):
|
|
121
|
+
self.__bakedImage__ = False
|
|
122
|
+
self.__bakedSvg__ = None
|
|
123
|
+
self.__bakedPdf__ = None
|
|
113
124
|
|
|
114
125
|
|
|
115
126
|
def _apply_cell_styles(self, plot, cellWidth, cellHeight):
|
|
116
127
|
self._reset_cell_bake_state(plot)
|
|
128
|
+
plot.showLegend = False
|
|
117
129
|
plot.style(
|
|
118
130
|
width=cellWidth,
|
|
119
131
|
height=cellHeight,
|
|
@@ -315,12 +327,19 @@ class Grid(AttrObject):
|
|
|
315
327
|
xml = plot.__ioBytes.read().decode("utf-8")
|
|
316
328
|
root = parse_svg_root(xml)
|
|
317
329
|
children, fondi_css = extract_svg_children(root)
|
|
318
|
-
|
|
330
|
+
cell_w, cell_h = plot.getSize()
|
|
331
|
+
embed_svg_children(
|
|
332
|
+
doc,
|
|
333
|
+
children,
|
|
334
|
+
px,
|
|
335
|
+
py,
|
|
336
|
+
clip_size=(cell_w, cell_h),
|
|
337
|
+
)
|
|
319
338
|
merge_fondi_css(doc, fondi_css)
|
|
320
339
|
else:
|
|
321
340
|
plot.__ioBytes.seek(0)
|
|
322
341
|
img = Image.open(plot.__ioBytes)
|
|
323
|
-
doc.add_image(img, px, py, y_coord="
|
|
342
|
+
doc.add_image(img, px, py, y_coord="svg_top")
|
|
324
343
|
|
|
325
344
|
x += cellWidth + gapcol
|
|
326
345
|
|
|
@@ -364,6 +383,7 @@ class Grid(AttrObject):
|
|
|
364
383
|
|
|
365
384
|
"""
|
|
366
385
|
|
|
386
|
+
self._invalidate_bake_cache()
|
|
367
387
|
self.grid.append(row)
|
|
368
388
|
|
|
369
389
|
|
|
@@ -377,6 +397,8 @@ class Grid(AttrObject):
|
|
|
377
397
|
A list of plots to be added as a column in the grid.
|
|
378
398
|
"""
|
|
379
399
|
|
|
400
|
+
self._invalidate_bake_cache()
|
|
401
|
+
|
|
380
402
|
for i, plot in enumerate(column):
|
|
381
403
|
|
|
382
404
|
if i >= len(self.grid):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kaxe
|
|
3
|
-
Version: 1.4.4.
|
|
3
|
+
Version: 1.4.4.dev13
|
|
4
4
|
Summary: A small graphing tool for functions, points, equations and more
|
|
5
5
|
Author-email: Valter Yde Daugberg <valteryde@hotmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/valteryde/kaxe
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.bright-roman.ttf
RENAMED
|
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
|
{kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.serif-bold.ttf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.serif-italic.ttf
RENAMED
|
File without changes
|
{kaxe-1.4.4.dev11 → kaxe-1.4.4.dev13}/src/kaxe/resources/computer-modern-family/cmu.serif-roman.ttf
RENAMED
|
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
|