sympy-plot-backends 4.1.0__tar.gz → 4.1.2__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.
- {sympy_plot_backends-4.1.0/sympy_plot_backends.egg-info → sympy_plot_backends-4.1.2}/PKG-INFO +1 -1
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/__init__.py +2 -1
- sympy_plot_backends-4.1.2/spb/_version.py +1 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/line2d.py +8 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/k3d/renderers/surface.py +51 -2
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/line2d.py +14 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/line3d.py +30 -7
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/surface.py +18 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/line2d.py +10 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/line3d.py +18 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/surface.py +10 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/utils.py +41 -27
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/graphics/control.py +31 -6
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/graphics/functions_2d.py +3 -2
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/graphics/functions_3d.py +14 -10
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/plot_functions/control.py +14 -2
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/plot_functions/functions_2d.py +3 -2
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/plot_functions/functions_3d.py +11 -9
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/series/series_2d_3d.py +29 -7
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2/sympy_plot_backends.egg-info}/PKG-INFO +1 -1
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/backends/make_tests.py +49 -1
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/backends/test_bokeh.py +17 -1
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/backends/test_color_utils.py +10 -1
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/backends/test_matplotlib.py +77 -2
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/backends/test_plotly.py +56 -1
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/graphics/test_control.py +46 -1
- sympy_plot_backends-4.1.0/spb/_version.py +0 -1
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/LICENSE +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/MANIFEST.in +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/README.md +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/setup.cfg +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/setup.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/animation/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/animation/ipywidgets.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/animation/panel.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/base_backend.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/base_renderer.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/bokeh.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/arrow2d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/complex.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/contour.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/generic.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/geometry.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/hvline.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/mcircles.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/ngrid.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/nichols.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/nyquist.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/polezero.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/root_locus.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/sgrid.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/vector2d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/zgrid.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/k3d/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/k3d/k3d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/k3d/renderers/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/k3d/renderers/arrow3d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/k3d/renderers/complex.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/k3d/renderers/geometry.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/k3d/renderers/implicit3d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/k3d/renderers/line3d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/k3d/renderers/vector3d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/matplotlib.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/_sgrid_helper.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/arrow2d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/arrow3d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/complex.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/contour.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/generic.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/geometry.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/hvline.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/implicit2d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/mcircles.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/ngrid.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/nichols.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/nyquist.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/polezero.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/renderer.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/root_locus.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/sgrid.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/vector2d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/vector3d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/zgrid.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/plotly.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/arrow2d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/complex.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/contour.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/generic.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/geometry.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/hvline.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/implicit3d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/vector2d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/vector3d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/defaults.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/doc_utils/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/doc_utils/docstrings.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/doc_utils/html.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/doc_utils/ipython.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/graphics/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/graphics/complex_analysis.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/graphics/graphics.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/graphics/utils.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/graphics/vector_transforms.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/graphics/vectors.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/interactive/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/interactive/bootstrap_spb/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/interactive/bootstrap_spb/bootstrap.css +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/interactive/bootstrap_spb/bootstrap.html +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/interactive/ipywidgets.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/interactive/panel.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/plot_functions/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/plot_functions/complex_analysis.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/plot_functions/vectors.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/plotgrid.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/series/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/series/base.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/series/complex_analysis.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/series/control.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/series/evaluator.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/series/vectors.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/utils.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/wegert.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/sympy_plot_backends.egg-info/SOURCES.txt +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/sympy_plot_backends.egg-info/dependency_links.txt +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/sympy_plot_backends.egg-info/not-zip-safe +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/sympy_plot_backends.egg-info/requires.txt +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/sympy_plot_backends.egg-info/top_level.txt +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/animation/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/animation/test_animation.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/animation/test_panel_ipywidgets.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/backends/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/backends/test_base_backend.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/backends/test_k3d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/doc_utils/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/doc_utils/test_html.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/doc_utils/test_ipython.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/graphics/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/graphics/test_complex_analysis.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/graphics/test_control_min_module.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/graphics/test_functions_2d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/graphics/test_functions_3d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/graphics/test_graphics.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/graphics/test_vector_transformation.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/graphics/test_vectors.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/interactive/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/interactive/test_interactive.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/interactive/test_ipywidgets.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/interactive/test_panel.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/plot_functions/__init__.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/plot_functions/test_complex.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/plot_functions/test_control.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/plot_functions/test_functions_2d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/plot_functions/test_functions_3d.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/plot_functions/test_vectors.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/test_defaults.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/test_plotgrid.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/test_series.py +0 -0
- {sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/tests/test_utils.py +0 -0
|
@@ -38,6 +38,7 @@ from spb.backends.bokeh import BB
|
|
|
38
38
|
from spb.backends.plotly import PB
|
|
39
39
|
from spb.backends.k3d import KB
|
|
40
40
|
from spb.backends.utils import (
|
|
41
|
+
convert_colormap,
|
|
41
42
|
tick_formatter_multiples_of,
|
|
42
43
|
multiples_of_2_pi,
|
|
43
44
|
multiples_of_pi,
|
|
@@ -97,5 +98,5 @@ __all__ = [
|
|
|
97
98
|
"arrow_2d", "arrow_3d", "root_locus", "sgrid", "plot_root_locus", "zgrid",
|
|
98
99
|
"ngrid", "mcircles", "tick_formatter_multiples_of", "multiples_of_2_pi",
|
|
99
100
|
"multiples_of_pi", "multiples_of_pi_over_2", "multiples_of_pi_over_3",
|
|
100
|
-
"multiples_of_pi_over_4"
|
|
101
|
+
"multiples_of_pi_over_4", "convert_colormap"
|
|
101
102
|
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "4.1.2"
|
{sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/bokeh/renderers/line2d.py
RENAMED
|
@@ -23,6 +23,14 @@ def _draw_line2d_helper(renderer, data):
|
|
|
23
23
|
handle.append(h)
|
|
24
24
|
tooltips = [("x", "@xs"), ("y", "@ys"), ("u", "@us")]
|
|
25
25
|
if s.colorbar:
|
|
26
|
+
if s.colorbar_ticks_formatter:
|
|
27
|
+
cb.ticker = s.colorbar_ticks_formatter.BB_ticker()
|
|
28
|
+
cb.formatter = s.colorbar_ticks_formatter.BB_formatter()
|
|
29
|
+
# tickvals, ticktext = s.colorbar_ticks_formatter.PB_ticks(
|
|
30
|
+
# min(param), max(param))
|
|
31
|
+
# lkw["marker"]["colorbar"]["tickvals"] = tickvals
|
|
32
|
+
# lkw["marker"]["colorbar"]["ticktext"] = ticktext
|
|
33
|
+
|
|
26
34
|
handle.append(cb)
|
|
27
35
|
p._fig.add_layout(cb, "right")
|
|
28
36
|
else:
|
{sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/k3d/renderers/surface.py
RENAMED
|
@@ -41,15 +41,23 @@ def _draw_surface_helper(renderer, data):
|
|
|
41
41
|
),
|
|
42
42
|
colorLegend=p.legend or s.use_cm,
|
|
43
43
|
)
|
|
44
|
+
|
|
44
45
|
if s.use_cm:
|
|
46
|
+
cmap = s.rendering_kw.get("color_map", next(p._cm))
|
|
45
47
|
cmin, cmax = _get_cmin_cmax(attribute, p, s)
|
|
46
|
-
a["color_map"] = next(p._cm)
|
|
47
|
-
a["attribute"] = attribute
|
|
48
48
|
# NOTE: color_range must contains elements of type float.
|
|
49
49
|
# If np.float32 is provided, mgspack will fail to serialize
|
|
50
50
|
# it, hence no html export, hence no screenshots on
|
|
51
51
|
# documentation.
|
|
52
52
|
a["color_range"] = [float(cmin), float(cmax)]
|
|
53
|
+
a["color_map"] = cmap
|
|
54
|
+
a["attribute"] = attribute
|
|
55
|
+
|
|
56
|
+
is_cyclic_cmap = s.rendering_kw.get("cyclic", False)
|
|
57
|
+
if is_cyclic_cmap:
|
|
58
|
+
# NOTE: by pre-computing colors, we avoid artifacts when the
|
|
59
|
+
# parameter value wraps around at the limits of the color map.
|
|
60
|
+
a["colors"] = _apply_cyclic_colormap(attribute, cmap, np)
|
|
53
61
|
|
|
54
62
|
kw = p.merge({}, a, s.rendering_kw)
|
|
55
63
|
surf = p.k3d.mesh(vertices, indices, **kw)
|
|
@@ -58,6 +66,39 @@ def _draw_surface_helper(renderer, data):
|
|
|
58
66
|
return surf
|
|
59
67
|
|
|
60
68
|
|
|
69
|
+
def _apply_cyclic_colormap(t, cmap, np):
|
|
70
|
+
"""Map t to colors from the cyclic color map.
|
|
71
|
+
|
|
72
|
+
Parameters
|
|
73
|
+
----------
|
|
74
|
+
t : array
|
|
75
|
+
An array of N elements containing cyclic data.
|
|
76
|
+
cmap : list
|
|
77
|
+
A K3D colormap.
|
|
78
|
+
|
|
79
|
+
Return
|
|
80
|
+
------
|
|
81
|
+
colors : array
|
|
82
|
+
An array of N elements with integer colors.
|
|
83
|
+
"""
|
|
84
|
+
cmap = np.array(cmap).reshape(-1, 4)
|
|
85
|
+
pos = cmap[:, 0]
|
|
86
|
+
rgb_colors = (cmap[:, 1:4] * 255).astype(np.uint32)
|
|
87
|
+
|
|
88
|
+
N = len(pos)
|
|
89
|
+
t = t / t.max()
|
|
90
|
+
idx = np.round(t * N).astype(int) % N
|
|
91
|
+
|
|
92
|
+
mapped_rgb = rgb_colors[idx]
|
|
93
|
+
colors = (
|
|
94
|
+
mapped_rgb[..., 0] << 16 |
|
|
95
|
+
mapped_rgb[..., 1] << 8 |
|
|
96
|
+
mapped_rgb[..., 2]
|
|
97
|
+
).flatten()
|
|
98
|
+
|
|
99
|
+
return colors
|
|
100
|
+
|
|
101
|
+
|
|
61
102
|
def _update_surface_helper(renderer, data, handle):
|
|
62
103
|
p, s = renderer.plot, renderer.series
|
|
63
104
|
np = p.np
|
|
@@ -98,6 +139,14 @@ def _update_surface_helper(renderer, data, handle):
|
|
|
98
139
|
cmin, cmax = _get_cmin_cmax(attribute, p, s)
|
|
99
140
|
handle.attribute = attribute
|
|
100
141
|
handle.color_range = [float(cmin), float(cmax)]
|
|
142
|
+
|
|
143
|
+
is_cyclic_cmap = s.rendering_kw.get("cyclic", False)
|
|
144
|
+
if is_cyclic_cmap:
|
|
145
|
+
# NOTE: by pre-computing colors, we avoid artifacts when the
|
|
146
|
+
# parameter value wraps around at the limits of the color map.
|
|
147
|
+
handle.colors = _apply_cyclic_colormap(
|
|
148
|
+
attribute, handle.color_map, np)
|
|
149
|
+
|
|
101
150
|
p._high_aspect_ratio(x, y, z)
|
|
102
151
|
|
|
103
152
|
|
{sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/line2d.py
RENAMED
|
@@ -28,6 +28,13 @@ def _draw_line2d_helper(renderer, data):
|
|
|
28
28
|
colorbar = p._add_colorbar(
|
|
29
29
|
c, s.get_label(p.use_latex), s.use_cm and s.colorbar
|
|
30
30
|
)
|
|
31
|
+
if s.colorbar_ticks_formatter:
|
|
32
|
+
ticks, labels = s.colorbar_ticks_formatter.PB_ticks(
|
|
33
|
+
param.min(), param.max(), latex=True)
|
|
34
|
+
colorbar.set_ticks(
|
|
35
|
+
ticks=ticks,
|
|
36
|
+
labels=labels
|
|
37
|
+
)
|
|
31
38
|
handle = (c, kw, colorbar, p.fig.axes[-1])
|
|
32
39
|
else:
|
|
33
40
|
if s.get_label(False) != "__k__":
|
|
@@ -83,6 +90,13 @@ def _update_line2d_helper(renderer, data, handles):
|
|
|
83
90
|
|
|
84
91
|
if colorbar:
|
|
85
92
|
colorbar.update_normal(line)
|
|
93
|
+
if s.colorbar_ticks_formatter:
|
|
94
|
+
ticks, labels = s.colorbar_ticks_formatter.PB_ticks(
|
|
95
|
+
param.min(), param.max(), latex=True)
|
|
96
|
+
colorbar.set_ticks(
|
|
97
|
+
ticks=ticks,
|
|
98
|
+
labels=labels
|
|
99
|
+
)
|
|
86
100
|
|
|
87
101
|
else:
|
|
88
102
|
line = line_handles[0]
|
{sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/line3d.py
RENAMED
|
@@ -18,9 +18,17 @@ def _draw_line3d_helper(renderer, data):
|
|
|
18
18
|
kw = p.merge({}, lkw, s.rendering_kw)
|
|
19
19
|
c = p.Line3DCollection(segments, **kw)
|
|
20
20
|
p._ax.add_collection(c)
|
|
21
|
-
p._add_colorbar(
|
|
21
|
+
colorbar = p._add_colorbar(
|
|
22
22
|
c, s.get_label(p.use_latex), s.use_cm and s.colorbar)
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
if s.colorbar_ticks_formatter:
|
|
25
|
+
ticks, labels = s.colorbar_ticks_formatter.PB_ticks(
|
|
26
|
+
param.min(), param.max(), latex=True)
|
|
27
|
+
colorbar.set_ticks(
|
|
28
|
+
ticks=ticks,
|
|
29
|
+
labels=labels
|
|
30
|
+
)
|
|
31
|
+
handle = (c, kw, colorbar)
|
|
24
32
|
else:
|
|
25
33
|
slabel = s.get_label(p.use_latex)
|
|
26
34
|
lkw["label"] = slabel if s.show_in_legend else "_nolegend_"
|
|
@@ -50,9 +58,17 @@ def _draw_line3d_helper(renderer, data):
|
|
|
50
58
|
kw = p.merge({}, lkw, s.rendering_kw)
|
|
51
59
|
l = p._ax.scatter(x, y, z, **kw)
|
|
52
60
|
if s.use_cm:
|
|
53
|
-
p._add_colorbar(
|
|
61
|
+
colorbar = p._add_colorbar(
|
|
54
62
|
l, s.get_label(p.use_latex), s.use_cm and s.colorbar)
|
|
55
|
-
handle = [l, kw,
|
|
63
|
+
handle = [l, kw, colorbar]
|
|
64
|
+
|
|
65
|
+
if s.colorbar_ticks_formatter:
|
|
66
|
+
ticks, labels = s.colorbar_ticks_formatter.PB_ticks(
|
|
67
|
+
param.min(), param.max(), latex=True)
|
|
68
|
+
colorbar.set_ticks(
|
|
69
|
+
ticks=ticks,
|
|
70
|
+
labels=labels
|
|
71
|
+
)
|
|
56
72
|
else:
|
|
57
73
|
handle = [l]
|
|
58
74
|
return handle
|
|
@@ -82,10 +98,17 @@ def _update_line3d_helper(renderer, data, handle):
|
|
|
82
98
|
line.set_offset(p.np.c_[x, y, z])
|
|
83
99
|
|
|
84
100
|
if s.is_parametric and s.use_cm:
|
|
101
|
+
line.set_clim(vmin=min(param), vmax=max(param))
|
|
85
102
|
line.set_array(param)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
103
|
+
colorbar = handle[-1]
|
|
104
|
+
colorbar.update_normal(line)
|
|
105
|
+
if s.colorbar_ticks_formatter:
|
|
106
|
+
ticks, labels = s.colorbar_ticks_formatter.PB_ticks(
|
|
107
|
+
param.min(), param.max(), latex=True)
|
|
108
|
+
colorbar.set_ticks(
|
|
109
|
+
ticks=ticks,
|
|
110
|
+
labels=labels
|
|
111
|
+
)
|
|
89
112
|
|
|
90
113
|
|
|
91
114
|
class Line3DRenderer(MatplotlibRenderer):
|
{sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/matplotlib/renderers/surface.py
RENAMED
|
@@ -43,6 +43,15 @@ def _draw_surface_helper(renderer, data):
|
|
|
43
43
|
norm=norm,
|
|
44
44
|
cmap=cmap
|
|
45
45
|
)
|
|
46
|
+
if is_cb_added and s.colorbar_ticks_formatter:
|
|
47
|
+
cb = is_cb_added
|
|
48
|
+
# NOTE: yep, I used PB_ticks because it does the job fine
|
|
49
|
+
ticks, labels = s.colorbar_ticks_formatter.PB_ticks(
|
|
50
|
+
vmin, vmax, latex=True)
|
|
51
|
+
cb.set_ticks(
|
|
52
|
+
ticks=ticks,
|
|
53
|
+
labels=labels
|
|
54
|
+
)
|
|
46
55
|
return [c, kw, is_cb_added, p.fig.axes[-1]]
|
|
47
56
|
|
|
48
57
|
|
|
@@ -76,6 +85,15 @@ def _update_surface_helper(renderer, data, handle):
|
|
|
76
85
|
if is_cb_added:
|
|
77
86
|
p._update_colorbar(
|
|
78
87
|
cax, kw["cmap"], s.get_label(p.use_latex), norm=norm)
|
|
88
|
+
if s.colorbar_ticks_formatter:
|
|
89
|
+
cb = is_cb_added
|
|
90
|
+
# NOTE: yep, I used PB_ticks because it does the job fine
|
|
91
|
+
ticks, labels = s.colorbar_ticks_formatter.PB_ticks(
|
|
92
|
+
vmin, vmax, latex=True)
|
|
93
|
+
cb.set_ticks(
|
|
94
|
+
ticks=ticks,
|
|
95
|
+
labels=labels
|
|
96
|
+
)
|
|
79
97
|
|
|
80
98
|
|
|
81
99
|
class SurfaceRenderer(MatplotlibRenderer):
|
{sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/line2d.py
RENAMED
|
@@ -61,6 +61,11 @@ def _draw_line2d_helper(renderer, data):
|
|
|
61
61
|
# That raises a strange error.
|
|
62
62
|
lkw["marker"]["colorbar"] = p._create_colorbar(
|
|
63
63
|
s.get_label(p.use_latex), True)
|
|
64
|
+
if s.colorbar_ticks_formatter:
|
|
65
|
+
tickvals, ticktext = s.colorbar_ticks_formatter.PB_ticks(
|
|
66
|
+
min(param), max(param))
|
|
67
|
+
lkw["marker"]["colorbar"]["tickvals"] = tickvals
|
|
68
|
+
lkw["marker"]["colorbar"]["ticktext"] = ticktext
|
|
64
69
|
|
|
65
70
|
kw = p.merge({}, lkw, s.rendering_kw)
|
|
66
71
|
|
|
@@ -132,6 +137,11 @@ def _update_line2d_helper(renderer, data, idxs):
|
|
|
132
137
|
handle["y"] = y
|
|
133
138
|
handle["marker"]["color"] = param
|
|
134
139
|
handle["customdata"] = param
|
|
140
|
+
if s.colorbar_ticks_formatter:
|
|
141
|
+
tickvals, ticktext = s.colorbar_ticks_formatter.PB_ticks(
|
|
142
|
+
min(param), max(param))
|
|
143
|
+
handle["marker"]["colorbar"]["tickvals"] = tickvals
|
|
144
|
+
handle["marker"]["colorbar"]["ticktext"] = ticktext
|
|
135
145
|
else:
|
|
136
146
|
x, y = data
|
|
137
147
|
if hasattr(s, "is_polar") and s.is_polar:
|
{sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/line3d.py
RENAMED
|
@@ -41,6 +41,12 @@ def _draw_line3d_helper(renderer, data):
|
|
|
41
41
|
color=param,
|
|
42
42
|
showscale=s.colorbar,
|
|
43
43
|
)
|
|
44
|
+
|
|
45
|
+
if s.colorbar_ticks_formatter:
|
|
46
|
+
tickvals, ticktext = s.colorbar_ticks_formatter.PB_ticks(
|
|
47
|
+
min(param), max(param))
|
|
48
|
+
lkw["line"]["colorbar"]["tickvals"] = tickvals
|
|
49
|
+
lkw["line"]["colorbar"]["ticktext"] = ticktext
|
|
44
50
|
else:
|
|
45
51
|
lkw["line"] = dict(
|
|
46
52
|
width=4,
|
|
@@ -72,6 +78,12 @@ def _draw_line3d_helper(renderer, data):
|
|
|
72
78
|
lkw["marker"]["colorbar"] = p._create_colorbar(
|
|
73
79
|
s.get_label(p.use_latex), p._scale_down_colorbar)
|
|
74
80
|
|
|
81
|
+
if s.colorbar_ticks_formatter:
|
|
82
|
+
tickvals, ticktext = s.colorbar_ticks_formatter.PB_ticks(
|
|
83
|
+
min(param), max(param))
|
|
84
|
+
lkw["marker"]["colorbar"]["tickvals"] = tickvals
|
|
85
|
+
lkw["marker"]["colorbar"]["ticktext"] = ticktext
|
|
86
|
+
|
|
75
87
|
if not s.is_filled:
|
|
76
88
|
# TODO: how to show a colorscale if is_scatter=True
|
|
77
89
|
# and is_filled=False?
|
|
@@ -105,6 +117,12 @@ def _update_line3d_helper(renderer, data, idx):
|
|
|
105
117
|
handle["z"] = z
|
|
106
118
|
if s.use_cm:
|
|
107
119
|
handle["line"]["color"] = param
|
|
120
|
+
_type = "marker" if s.is_scatter else "line"
|
|
121
|
+
if s.colorbar_ticks_formatter:
|
|
122
|
+
tickvals, ticktext = s.colorbar_ticks_formatter.PB_ticks(
|
|
123
|
+
min(param), max(param))
|
|
124
|
+
handle[_type]["colorbar"]["tickvals"] = tickvals
|
|
125
|
+
handle[_type]["colorbar"]["ticktext"] = ticktext
|
|
108
126
|
|
|
109
127
|
|
|
110
128
|
class Line3DRenderer(Renderer):
|
{sympy_plot_backends-4.1.0 → sympy_plot_backends-4.1.2}/spb/backends/plotly/renderers/surface.py
RENAMED
|
@@ -29,6 +29,11 @@ def _draw_surface_helper(renderer, data):
|
|
|
29
29
|
cmax=cmax
|
|
30
30
|
)
|
|
31
31
|
|
|
32
|
+
if s.colorbar_ticks_formatter:
|
|
33
|
+
tickvals, ticktext = s.colorbar_ticks_formatter.PB_ticks(cmin, cmax)
|
|
34
|
+
skw["colorbar"]["tickvals"] = tickvals
|
|
35
|
+
skw["colorbar"]["ticktext"] = ticktext
|
|
36
|
+
|
|
32
37
|
kw = p.merge({}, skw, s.rendering_kw)
|
|
33
38
|
handle = p.go.Surface(x=xx, y=yy, z=zz, **kw)
|
|
34
39
|
p._fig.add_trace(handle)
|
|
@@ -53,6 +58,11 @@ def _update_surface_helper(renderer, data, idx):
|
|
|
53
58
|
handle["cmin"] = cmin
|
|
54
59
|
handle["cmax"] = cmax
|
|
55
60
|
|
|
61
|
+
if s.colorbar_ticks_formatter:
|
|
62
|
+
tickvals, ticktext = s.colorbar_ticks_formatter.PB_ticks(cmin, cmax)
|
|
63
|
+
handle["colorbar"]["tickvals"] = tickvals
|
|
64
|
+
handle["colorbar"]["ticktext"] = ticktext
|
|
65
|
+
|
|
56
66
|
|
|
57
67
|
class SurfaceRenderer(Renderer):
|
|
58
68
|
draw_update_map = {
|
|
@@ -11,31 +11,53 @@ from sympy import (
|
|
|
11
11
|
from spb.doc_utils.ipython import modify_parameterized_doc
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
def convert_colormap(cm, to, n=256):
|
|
14
|
+
def convert_colormap(cm, to, n=256, cyclic=False):
|
|
15
15
|
"""Convert the provided colormap to a format usable by the specified
|
|
16
16
|
plotting library. The following plotting libraries are supported:
|
|
17
17
|
matplotlib, plotly, bokeh, k3d.
|
|
18
18
|
|
|
19
19
|
Parameters
|
|
20
20
|
==========
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
cm : Colormap, list, tuple, ndarray
|
|
22
|
+
The colormap to be converted. It can be:
|
|
23
|
+
|
|
24
|
+
* an instance of matplotlib.colors.Colormap
|
|
25
|
+
* a string with the name of a Plotly color scale
|
|
26
|
+
* a list of string HEX colors (colorcet colormaps)
|
|
27
|
+
* a list of float numbers between 0 and 1 (k3d colormaps)
|
|
28
|
+
to : str
|
|
29
|
+
Specify the plotting library. Must be one of:
|
|
30
|
+
["matplotlib", "plotly", "k3d", "bokeh"]
|
|
31
|
+
n : int
|
|
32
|
+
Number of discretization points in the range [0, 1].
|
|
33
|
+
Default to 256.
|
|
34
|
+
This is only used if `cm` is an instance of Colormap or if `cm` is
|
|
35
|
+
a string with the name of a Plotly color scale.
|
|
36
|
+
cyclic : boolean
|
|
37
|
+
Default to False. If True, takes the necessary measures to return
|
|
38
|
+
a proper cyclic color map in order to avoid rendering artifacts.
|
|
34
39
|
|
|
35
40
|
Returns
|
|
36
41
|
=======
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
new_cm :
|
|
43
|
+
A new colormap. If a colormap is to be converted to "matplotlib", then
|
|
44
|
+
an array of numerical values will be returned, with which the user
|
|
45
|
+
can buil the intended colormap using one of Matplotlib's classes.
|
|
46
|
+
Note that the conversion is not guardanteed. The function returns the
|
|
47
|
+
provided colormap if it cannot be converted.
|
|
48
|
+
|
|
49
|
+
Examples
|
|
50
|
+
========
|
|
51
|
+
|
|
52
|
+
>>> from spb import convert_colormap
|
|
53
|
+
>>> import colorcet as cc
|
|
54
|
+
>>> cyclic_cmap = cc.colorwheel
|
|
55
|
+
>>> cmap_plotly = convert_colormap(cyclic_cmap, "plotly", cyclic=True)
|
|
56
|
+
>>> cmap_plotly[0][1]
|
|
57
|
+
'rgb(46, 33, 234)'
|
|
58
|
+
>>> cmap_plotly[0][1] == cmap_plotly[-1][1]
|
|
59
|
+
True
|
|
60
|
+
|
|
39
61
|
"""
|
|
40
62
|
np = import_module('numpy')
|
|
41
63
|
matplotlib = import_module(
|
|
@@ -47,7 +69,7 @@ def convert_colormap(cm, to, n=256):
|
|
|
47
69
|
|
|
48
70
|
assert isinstance(to, str)
|
|
49
71
|
to = to.lower()
|
|
50
|
-
assert to in ["matplotlib", "plotly", "k3d", "bokeh"
|
|
72
|
+
assert to in ["matplotlib", "plotly", "k3d", "bokeh"]
|
|
51
73
|
if not isinstance(cm, (str, list, tuple, np.ndarray, Colormap)):
|
|
52
74
|
raise ValueError(
|
|
53
75
|
"`cm` must be either:\n"
|
|
@@ -58,16 +80,6 @@ def convert_colormap(cm, to, n=256):
|
|
|
58
80
|
+ "4. an array of colors extracted from a matplotlib.colors.Colormap."
|
|
59
81
|
)
|
|
60
82
|
|
|
61
|
-
if to == "mayavi":
|
|
62
|
-
# NOTE: Mayavi colormaps are based on look up tables.
|
|
63
|
-
# It is possible to modify a colormap after an object (mesh) has been
|
|
64
|
-
# created (see this example):
|
|
65
|
-
# https://docs.enthought.com/mayavi/mayavi/auto/example_custom_colormap.html
|
|
66
|
-
# However, it is not possible to pass a look up table to the colormap
|
|
67
|
-
# keyword argument of a Mayavi function. Hence, we cannot implement
|
|
68
|
-
# intercompatibility with other plotting libraries.
|
|
69
|
-
return cm
|
|
70
|
-
|
|
71
83
|
r = []
|
|
72
84
|
if to == "k3d":
|
|
73
85
|
# K3D color maps are lists of the form:
|
|
@@ -141,6 +153,8 @@ def convert_colormap(cm, to, n=256):
|
|
|
141
153
|
for loc, color in zip(np.linspace(0, 1, len(cm)), cm):
|
|
142
154
|
c = ImageColor.getcolor(color, "RGB")
|
|
143
155
|
r.append([loc, "rgb" + str(tuple(c))])
|
|
156
|
+
if cyclic:
|
|
157
|
+
r[-1][1] = r[0][1]
|
|
144
158
|
elif all([isinstance(t, (float, int)) for t in cm]):
|
|
145
159
|
# k3d color map
|
|
146
160
|
cm = np.array(cm).reshape(-1, 4)
|
|
@@ -19,7 +19,7 @@ from spb.utils import (
|
|
|
19
19
|
from sympy import (
|
|
20
20
|
roots, exp, Poly, degree, re, im, apart, Dummy, symbols,
|
|
21
21
|
I, log, Abs, arg, sympify, S, Min, Max, Piecewise, sqrt,
|
|
22
|
-
floor, ceiling, frac, pi, Expr, inverse_laplace_transform,
|
|
22
|
+
floor, ceiling, frac, pi, Expr, inverse_laplace_transform, Wild
|
|
23
23
|
)
|
|
24
24
|
from sympy.external import import_module
|
|
25
25
|
import warnings
|
|
@@ -479,7 +479,18 @@ def _set_lower_upper_limits(system, lower_limit, upper_limit,
|
|
|
479
479
|
ct = import_module("control")
|
|
480
480
|
if ct and (not kwargs.get("params", None)):
|
|
481
481
|
# this procedure requires the control module
|
|
482
|
-
|
|
482
|
+
try:
|
|
483
|
+
control_sys = tf_to_control(system)
|
|
484
|
+
except TypeError:
|
|
485
|
+
# this is likely the case when complex coefficients are used.
|
|
486
|
+
w = Wild("w", properties=[lambda t: t.is_Number])
|
|
487
|
+
# TODO: of course, setting the imaginary part is going to alter
|
|
488
|
+
# the transfer function. We may not be able to extrapolate the
|
|
489
|
+
# correct initial_exp and final_exp. We need a better procedure
|
|
490
|
+
# for this case.
|
|
491
|
+
system = system.replace(w * I, 0)
|
|
492
|
+
# at this point new_system should have real coefficients
|
|
493
|
+
control_sys = tf_to_control(system)
|
|
483
494
|
tfinal, _ = _ideal_tfinal_and_dt(control_sys, is_step=is_step)
|
|
484
495
|
# if interactive widget plot, or control is not installed, use
|
|
485
496
|
# default value of 10
|
|
@@ -1179,7 +1190,6 @@ def ramp_response(
|
|
|
1179
1190
|
def _bode_common(system, label, initial_exp, final_exp, freq_unit, **kwargs):
|
|
1180
1191
|
# NOTE: why use ``sympy`` and not ``control`` to compute bode plots?
|
|
1181
1192
|
# Because I can easily deal with time delays.
|
|
1182
|
-
|
|
1183
1193
|
original_system = _preprocess_system(system, **kwargs)
|
|
1184
1194
|
system = tf_to_sympy(original_system, skip_check_dt=True)
|
|
1185
1195
|
_check_system(system, bypass_delay_check=True)
|
|
@@ -1210,14 +1220,26 @@ def _bode_common(system, label, initial_exp, final_exp, freq_unit, **kwargs):
|
|
|
1210
1220
|
# affected by it.
|
|
1211
1221
|
for d in tf_find_time_delay(new_system):
|
|
1212
1222
|
new_system = new_system.subs({d: 1})
|
|
1213
|
-
tf = tf_to_control(new_system)
|
|
1214
1223
|
else:
|
|
1215
1224
|
new_system = system
|
|
1216
1225
|
# assume any time delay is in cascade, so that only the phase is
|
|
1217
1226
|
# affected by it.
|
|
1218
1227
|
for d in tf_find_time_delay(new_system):
|
|
1219
1228
|
new_system = new_system.subs({d: 1})
|
|
1229
|
+
|
|
1230
|
+
try:
|
|
1231
|
+
tf = tf_to_control(new_system)
|
|
1232
|
+
except TypeError:
|
|
1233
|
+
# this is likely the case when complex coefficients are used.
|
|
1234
|
+
w = Wild("w", properties=[lambda t: t.is_Number])
|
|
1235
|
+
# TODO: of course, setting the imaginary part is going to alter
|
|
1236
|
+
# the transfer function. We may not be able to extrapolate the
|
|
1237
|
+
# correct initial_exp and final_exp. We need a better procedure
|
|
1238
|
+
# for this case.
|
|
1239
|
+
new_system = new_system.replace(w * I, 0)
|
|
1240
|
+
# at this point new_system should have real coefficients
|
|
1220
1241
|
tf = tf_to_control(new_system)
|
|
1242
|
+
|
|
1221
1243
|
i, f = _default_frequency_exponent_range(tf, freq_unit == 'Hz', 1)
|
|
1222
1244
|
initial_exp = i if initial_exp is None else initial_exp
|
|
1223
1245
|
final_exp = f if final_exp is None else final_exp
|
|
@@ -1236,9 +1258,12 @@ def _bode_magnitude_helper(
|
|
|
1236
1258
|
):
|
|
1237
1259
|
w_expr, _range = _bode_common(
|
|
1238
1260
|
system, label, initial_exp, final_exp, freq_unit, **kwargs)
|
|
1261
|
+
|
|
1239
1262
|
mag = 20*log(Abs(w_expr), 10)
|
|
1240
|
-
|
|
1241
|
-
|
|
1263
|
+
|
|
1264
|
+
kwargs["return"] = "real"
|
|
1265
|
+
kwargs["xscale"] = "log"
|
|
1266
|
+
return LineOver1DRangeSeries(mag, _range, label, **kwargs)
|
|
1242
1267
|
|
|
1243
1268
|
|
|
1244
1269
|
@modify_graphics_series_doc(LineOver1DRangeSeries, replace=_replace_params_docstring)
|
|
@@ -410,7 +410,7 @@ def line_parametric_2d(
|
|
|
410
410
|
>>> t, u, v = symbols('t, u, v')
|
|
411
411
|
|
|
412
412
|
A parametric plot of a single expression (a Hypotrochoid using an equal
|
|
413
|
-
aspect ratio):
|
|
413
|
+
aspect ratio), showing colorbar's ticks at multiple of pi:
|
|
414
414
|
|
|
415
415
|
.. plot::
|
|
416
416
|
:context: close-figs
|
|
@@ -421,7 +421,8 @@ def line_parametric_2d(
|
|
|
421
421
|
... line_parametric_2d(
|
|
422
422
|
... 2 * cos(u) + 5 * cos(2 * u / 3),
|
|
423
423
|
... 2 * sin(u) - 5 * sin(2 * u / 3),
|
|
424
|
-
... (u, 0, 6 * pi)
|
|
424
|
+
... (u, 0, 6 * pi),
|
|
425
|
+
... colorbar_ticks_formatter=multiples_of_pi(),
|
|
425
426
|
... ),
|
|
426
427
|
... aspect="equal"
|
|
427
428
|
... )
|
|
@@ -53,7 +53,7 @@ def line_parametric_3d(
|
|
|
53
53
|
[0]: 3D parametric cartesian line: (cos(t), sin(t), t) for t over (-5, 5)
|
|
54
54
|
|
|
55
55
|
Customize the appearance by setting a label to the colorbar, changing the
|
|
56
|
-
colormap and the
|
|
56
|
+
colormap, the line width, and the ticks on the colorbar.
|
|
57
57
|
|
|
58
58
|
.. plot::
|
|
59
59
|
:context: close-figs
|
|
@@ -63,7 +63,8 @@ def line_parametric_3d(
|
|
|
63
63
|
>>> graphics(
|
|
64
64
|
... line_parametric_3d(
|
|
65
65
|
... 3 * sin(t) + 2 * sin(3 * t), cos(t) - 2 * cos(3 * t), cos(5 * t),
|
|
66
|
-
... (t, 0, 2 * pi), "t [rad]", {"cmap": "hsv", "lw": 1.5}
|
|
66
|
+
... (t, 0, 2 * pi), "t [rad]", {"cmap": "hsv", "lw": 1.5},
|
|
67
|
+
... colorbar_ticks_formatter=multiples_of_pi_over_2()
|
|
67
68
|
... )
|
|
68
69
|
... )
|
|
69
70
|
Plot object containing:
|
|
@@ -458,23 +459,26 @@ def surface_parametric(
|
|
|
458
459
|
color function mapping the `v` values. Activate the wireframe to better
|
|
459
460
|
visualize the parameterization.
|
|
460
461
|
|
|
461
|
-
..
|
|
462
|
-
:
|
|
462
|
+
.. plotly::
|
|
463
|
+
:context: reset
|
|
464
|
+
:camera: 1.25, -1.25, 1.25, 0, 0, -0.3, 0, 0, 1
|
|
463
465
|
|
|
464
466
|
from sympy import *
|
|
465
467
|
from spb import *
|
|
466
|
-
import k3d
|
|
467
468
|
var("u, v")
|
|
468
469
|
|
|
469
470
|
x = (1 + v / 2 * cos(u / 2)) * cos(u)
|
|
470
471
|
y = (1 + v / 2 * cos(u / 2)) * sin(u)
|
|
471
472
|
z = v / 2 * sin(u / 2)
|
|
472
473
|
graphics(
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
474
|
+
surface_parametric(x, y, z, (u, 0, 2*pi), (v, -1, 1),
|
|
475
|
+
"v", {"colorscale": "mygbm"},
|
|
476
|
+
use_cm=True, color_func=lambda u, v: u,
|
|
477
|
+
wireframe=True, wf_n1=20,
|
|
478
|
+
colorbar_ticks_formatter=multiples_of_pi_over_2(label="π")
|
|
479
|
+
),
|
|
480
|
+
xlabel="x", ylabel="y", zlabel="z",
|
|
481
|
+
backend=PB, title="Möbius strip")
|
|
478
482
|
|
|
479
483
|
Riemann surfaces of the real part of the multivalued function `z**n`,
|
|
480
484
|
using Plotly:
|
|
@@ -10,7 +10,7 @@ from spb.graphics.control import (
|
|
|
10
10
|
from spb.interactive import create_interactive_plot
|
|
11
11
|
from spb.plotgrid import plotgrid
|
|
12
12
|
from spb.utils import _instantiate_backend, is_siso, tf_to_sympy, tf_to_control
|
|
13
|
-
from sympy import Expr
|
|
13
|
+
from sympy import Expr, Wild, I
|
|
14
14
|
from sympy.external import import_module
|
|
15
15
|
|
|
16
16
|
|
|
@@ -254,7 +254,18 @@ def _set_upper_limits(systems, upper_limit, is_step=True, **kwargs):
|
|
|
254
254
|
# So, build a temporary MIMO transfer function including all systems
|
|
255
255
|
# in order to compute an appropriate maximum time for the simulation.
|
|
256
256
|
sympy_mimo_sys = TransferFunctionMatrix([all_sympy_systems])
|
|
257
|
-
|
|
257
|
+
try:
|
|
258
|
+
control_mimo_sys = tf_to_control(sympy_mimo_sys)
|
|
259
|
+
except TypeError:
|
|
260
|
+
# this is likely the case when complex coefficients are used.
|
|
261
|
+
w = Wild("w", properties=[lambda t: t.is_Number])
|
|
262
|
+
# TODO: of course, setting the imaginary part is going to alter
|
|
263
|
+
# the transfer function. We may not be able to extrapolate the
|
|
264
|
+
# correct initial_exp and final_exp. We need a better procedure
|
|
265
|
+
# for this case.
|
|
266
|
+
sympy_mimo_sys = sympy_mimo_sys.replace(w * I, 0)
|
|
267
|
+
# at this point new_system should have real coefficients
|
|
268
|
+
control_mimo_sys = tf_to_control(sympy_mimo_sys)
|
|
258
269
|
tfinal, _ = _ideal_tfinal_and_dt(control_mimo_sys)
|
|
259
270
|
if tfinal:
|
|
260
271
|
upper_limit = tfinal
|
|
@@ -1002,6 +1013,7 @@ def plot_bode(
|
|
|
1002
1013
|
plot_bode_magnitude, plot_bode_phase, plot_nyquist, plot_nichols
|
|
1003
1014
|
|
|
1004
1015
|
"""
|
|
1016
|
+
|
|
1005
1017
|
kwargs["plot_function"] = True
|
|
1006
1018
|
show = kwargs.pop("show", True)
|
|
1007
1019
|
kwargs["show"] = False
|
|
@@ -434,7 +434,7 @@ def plot_parametric(*args, **kwargs):
|
|
|
434
434
|
>>> t, u, v = symbols('t, u, v')
|
|
435
435
|
|
|
436
436
|
A parametric plot of a single expression (a Hypotrochoid using an equal
|
|
437
|
-
aspect ratio):
|
|
437
|
+
aspect ratio), showing colorbar's ticks at multiple of pi:
|
|
438
438
|
|
|
439
439
|
.. plot::
|
|
440
440
|
:context: close-figs
|
|
@@ -444,7 +444,8 @@ def plot_parametric(*args, **kwargs):
|
|
|
444
444
|
>>> plot_parametric(
|
|
445
445
|
... 2 * cos(u) + 5 * cos(2 * u / 3),
|
|
446
446
|
... 2 * sin(u) - 5 * sin(2 * u / 3),
|
|
447
|
-
... (u, 0, 6 * pi), aspect="equal"
|
|
447
|
+
... (u, 0, 6 * pi), aspect="equal",
|
|
448
|
+
... colorbar_ticks_formatter=multiples_of_pi())
|
|
448
449
|
Plot object containing:
|
|
449
450
|
[0]: parametric cartesian line: (5*cos(2*u/3) + 2*cos(u), -5*sin(2*u/3) + 2*sin(u)) for u over (0, 6*pi)
|
|
450
451
|
|