figrecipe 0.5.0__py3-none-any.whl → 0.7.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.
- figrecipe/__init__.py +220 -819
- figrecipe/_api/__init__.py +48 -0
- figrecipe/_api/_extract.py +108 -0
- figrecipe/_api/_notebook.py +61 -0
- figrecipe/_api/_panel.py +46 -0
- figrecipe/_api/_save.py +191 -0
- figrecipe/_api/_seaborn_proxy.py +34 -0
- figrecipe/_api/_style_manager.py +153 -0
- figrecipe/_api/_subplots.py +333 -0
- figrecipe/_api/_validate.py +82 -0
- figrecipe/_dev/__init__.py +29 -0
- figrecipe/_dev/_plotters.py +76 -0
- figrecipe/_dev/_run_demos.py +56 -0
- figrecipe/_dev/demo_plotters/__init__.py +64 -0
- figrecipe/_dev/demo_plotters/_categories.py +81 -0
- figrecipe/_dev/demo_plotters/_figure_creators.py +119 -0
- figrecipe/_dev/demo_plotters/_helpers.py +31 -0
- figrecipe/_dev/demo_plotters/_registry.py +50 -0
- figrecipe/_dev/demo_plotters/bar_categorical/__init__.py +4 -0
- figrecipe/_dev/demo_plotters/bar_categorical/plot_bar.py +25 -0
- figrecipe/_dev/demo_plotters/bar_categorical/plot_barh.py +25 -0
- figrecipe/_dev/demo_plotters/contour_surface/__init__.py +4 -0
- figrecipe/_dev/demo_plotters/contour_surface/plot_contour.py +30 -0
- figrecipe/_dev/demo_plotters/contour_surface/plot_contourf.py +29 -0
- figrecipe/_dev/demo_plotters/contour_surface/plot_tricontour.py +28 -0
- figrecipe/_dev/demo_plotters/contour_surface/plot_tricontourf.py +28 -0
- figrecipe/_dev/demo_plotters/contour_surface/plot_tripcolor.py +29 -0
- figrecipe/_dev/demo_plotters/contour_surface/plot_triplot.py +25 -0
- figrecipe/_dev/demo_plotters/distribution/__init__.py +4 -0
- figrecipe/_dev/demo_plotters/distribution/plot_boxplot.py +24 -0
- figrecipe/_dev/demo_plotters/distribution/plot_ecdf.py +24 -0
- figrecipe/_dev/demo_plotters/distribution/plot_hist.py +24 -0
- figrecipe/_dev/demo_plotters/distribution/plot_hist2d.py +25 -0
- figrecipe/_dev/demo_plotters/distribution/plot_violinplot.py +25 -0
- figrecipe/_dev/demo_plotters/image_matrix/__init__.py +4 -0
- figrecipe/_dev/demo_plotters/image_matrix/plot_hexbin.py +25 -0
- figrecipe/_dev/demo_plotters/image_matrix/plot_imshow.py +23 -0
- figrecipe/_dev/demo_plotters/image_matrix/plot_matshow.py +23 -0
- figrecipe/_dev/demo_plotters/image_matrix/plot_pcolor.py +29 -0
- figrecipe/_dev/demo_plotters/image_matrix/plot_pcolormesh.py +29 -0
- figrecipe/_dev/demo_plotters/image_matrix/plot_spy.py +29 -0
- figrecipe/_dev/demo_plotters/line_curve/__init__.py +4 -0
- figrecipe/_dev/demo_plotters/line_curve/plot_errorbar.py +28 -0
- figrecipe/_dev/demo_plotters/line_curve/plot_fill.py +29 -0
- figrecipe/_dev/demo_plotters/line_curve/plot_fill_between.py +30 -0
- figrecipe/_dev/demo_plotters/line_curve/plot_fill_betweenx.py +28 -0
- figrecipe/_dev/demo_plotters/line_curve/plot_plot.py +28 -0
- figrecipe/_dev/demo_plotters/line_curve/plot_stackplot.py +29 -0
- figrecipe/_dev/demo_plotters/line_curve/plot_stairs.py +27 -0
- figrecipe/_dev/demo_plotters/line_curve/plot_step.py +27 -0
- figrecipe/_dev/demo_plotters/scatter_points/__init__.py +4 -0
- figrecipe/_dev/demo_plotters/scatter_points/plot_scatter.py +24 -0
- figrecipe/_dev/demo_plotters/special/__init__.py +4 -0
- figrecipe/_dev/demo_plotters/special/plot_eventplot.py +25 -0
- figrecipe/_dev/demo_plotters/special/plot_loglog.py +27 -0
- figrecipe/_dev/demo_plotters/special/plot_pie.py +27 -0
- figrecipe/_dev/demo_plotters/special/plot_semilogx.py +27 -0
- figrecipe/_dev/demo_plotters/special/plot_semilogy.py +27 -0
- figrecipe/_dev/demo_plotters/special/plot_stem.py +27 -0
- figrecipe/_dev/demo_plotters/spectral_signal/__init__.py +4 -0
- figrecipe/_dev/demo_plotters/spectral_signal/plot_acorr.py +24 -0
- figrecipe/_dev/demo_plotters/spectral_signal/plot_angle_spectrum.py +28 -0
- figrecipe/_dev/demo_plotters/spectral_signal/plot_cohere.py +29 -0
- figrecipe/_dev/demo_plotters/spectral_signal/plot_csd.py +29 -0
- figrecipe/_dev/demo_plotters/spectral_signal/plot_magnitude_spectrum.py +28 -0
- figrecipe/_dev/demo_plotters/spectral_signal/plot_phase_spectrum.py +28 -0
- figrecipe/_dev/demo_plotters/spectral_signal/plot_psd.py +29 -0
- figrecipe/_dev/demo_plotters/spectral_signal/plot_specgram.py +30 -0
- figrecipe/_dev/demo_plotters/spectral_signal/plot_xcorr.py +25 -0
- figrecipe/_dev/demo_plotters/vector_flow/__init__.py +4 -0
- figrecipe/_dev/demo_plotters/vector_flow/plot_barbs.py +30 -0
- figrecipe/_dev/demo_plotters/vector_flow/plot_quiver.py +30 -0
- figrecipe/_dev/demo_plotters/vector_flow/plot_streamplot.py +30 -0
- figrecipe/_editor/__init__.py +278 -0
- figrecipe/_editor/_bbox/__init__.py +43 -0
- figrecipe/_editor/_bbox/_collections.py +177 -0
- figrecipe/_editor/_bbox/_elements.py +159 -0
- figrecipe/_editor/_bbox/_extract.py +256 -0
- figrecipe/_editor/_bbox/_extract_axes.py +370 -0
- figrecipe/_editor/_bbox/_extract_text.py +342 -0
- figrecipe/_editor/_bbox/_lines.py +173 -0
- figrecipe/_editor/_bbox/_transforms.py +146 -0
- figrecipe/_editor/_flask_app.py +258 -0
- figrecipe/_editor/_helpers.py +242 -0
- figrecipe/_editor/_hitmap/__init__.py +76 -0
- figrecipe/_editor/_hitmap/_artists/__init__.py +21 -0
- figrecipe/_editor/_hitmap/_artists/_collections.py +345 -0
- figrecipe/_editor/_hitmap/_artists/_images.py +68 -0
- figrecipe/_editor/_hitmap/_artists/_lines.py +107 -0
- figrecipe/_editor/_hitmap/_artists/_patches.py +163 -0
- figrecipe/_editor/_hitmap/_artists/_text.py +190 -0
- figrecipe/_editor/_hitmap/_colors.py +181 -0
- figrecipe/_editor/_hitmap/_detect.py +137 -0
- figrecipe/_editor/_hitmap/_restore.py +154 -0
- figrecipe/_editor/_hitmap_main.py +182 -0
- figrecipe/_editor/_overrides.py +318 -0
- figrecipe/_editor/_preferences.py +135 -0
- figrecipe/_editor/_render_overrides.py +480 -0
- figrecipe/_editor/_renderer.py +199 -0
- figrecipe/_editor/_routes_axis.py +453 -0
- figrecipe/_editor/_routes_core.py +284 -0
- figrecipe/_editor/_routes_element.py +317 -0
- figrecipe/_editor/_routes_style.py +223 -0
- figrecipe/_editor/_templates/__init__.py +152 -0
- figrecipe/_editor/_templates/_html.py +502 -0
- figrecipe/_editor/_templates/_scripts/__init__.py +120 -0
- figrecipe/_editor/_templates/_scripts/_api.py +228 -0
- figrecipe/_editor/_templates/_scripts/_colors.py +485 -0
- figrecipe/_editor/_templates/_scripts/_core.py +436 -0
- figrecipe/_editor/_templates/_scripts/_debug_snapshot.py +186 -0
- figrecipe/_editor/_templates/_scripts/_element_editor.py +310 -0
- figrecipe/_editor/_templates/_scripts/_files.py +195 -0
- figrecipe/_editor/_templates/_scripts/_hitmap.py +509 -0
- figrecipe/_editor/_templates/_scripts/_inspector.py +315 -0
- figrecipe/_editor/_templates/_scripts/_labels.py +464 -0
- figrecipe/_editor/_templates/_scripts/_legend_drag.py +265 -0
- figrecipe/_editor/_templates/_scripts/_modals.py +226 -0
- figrecipe/_editor/_templates/_scripts/_overlays.py +292 -0
- figrecipe/_editor/_templates/_scripts/_panel_drag.py +334 -0
- figrecipe/_editor/_templates/_scripts/_panel_position.py +279 -0
- figrecipe/_editor/_templates/_scripts/_selection.py +237 -0
- figrecipe/_editor/_templates/_scripts/_tabs.py +89 -0
- figrecipe/_editor/_templates/_scripts/_view_mode.py +107 -0
- figrecipe/_editor/_templates/_scripts/_zoom.py +179 -0
- figrecipe/_editor/_templates/_styles/__init__.py +69 -0
- figrecipe/_editor/_templates/_styles/_base.py +64 -0
- figrecipe/_editor/_templates/_styles/_buttons.py +206 -0
- figrecipe/_editor/_templates/_styles/_color_input.py +123 -0
- figrecipe/_editor/_templates/_styles/_controls.py +265 -0
- figrecipe/_editor/_templates/_styles/_dynamic_props.py +144 -0
- figrecipe/_editor/_templates/_styles/_forms.py +126 -0
- figrecipe/_editor/_templates/_styles/_hitmap.py +184 -0
- figrecipe/_editor/_templates/_styles/_inspector.py +90 -0
- figrecipe/_editor/_templates/_styles/_labels.py +118 -0
- figrecipe/_editor/_templates/_styles/_modals.py +98 -0
- figrecipe/_editor/_templates/_styles/_overlays.py +130 -0
- figrecipe/_editor/_templates/_styles/_preview.py +225 -0
- figrecipe/_editor/_templates/_styles/_selection.py +73 -0
- figrecipe/_params/_DECORATION_METHODS.py +33 -0
- figrecipe/_params/_PLOTTING_METHODS.py +58 -0
- figrecipe/_params/__init__.py +9 -0
- figrecipe/_recorder.py +92 -110
- figrecipe/_recorder_utils.py +124 -0
- figrecipe/_reproducer/__init__.py +18 -0
- figrecipe/_reproducer/_core.py +498 -0
- figrecipe/_reproducer/_custom_plots.py +279 -0
- figrecipe/_reproducer/_seaborn.py +100 -0
- figrecipe/_reproducer/_violin.py +186 -0
- figrecipe/_seaborn.py +14 -9
- figrecipe/_serializer.py +2 -2
- figrecipe/_signatures/README.md +68 -0
- figrecipe/_signatures/__init__.py +12 -2
- figrecipe/_signatures/_kwargs.py +273 -0
- figrecipe/_signatures/_loader.py +114 -57
- figrecipe/_signatures/_parsing.py +147 -0
- figrecipe/_utils/__init__.py +6 -4
- figrecipe/_utils/_crop.py +10 -4
- figrecipe/_utils/_image_diff.py +37 -33
- figrecipe/_utils/_numpy_io.py +0 -1
- figrecipe/_utils/_units.py +11 -3
- figrecipe/_validator.py +12 -3
- figrecipe/_wrappers/_axes.py +193 -170
- figrecipe/_wrappers/_axes_helpers.py +136 -0
- figrecipe/_wrappers/_axes_plots.py +418 -0
- figrecipe/_wrappers/_axes_seaborn.py +157 -0
- figrecipe/_wrappers/_figure.py +277 -18
- figrecipe/_wrappers/_panel_labels.py +127 -0
- figrecipe/_wrappers/_plot_helpers.py +143 -0
- figrecipe/_wrappers/_violin_helpers.py +180 -0
- figrecipe/plt.py +0 -1
- figrecipe/pyplot.py +2 -1
- figrecipe/styles/__init__.py +12 -11
- figrecipe/styles/_dotdict.py +72 -0
- figrecipe/styles/_finalize.py +134 -0
- figrecipe/styles/_fonts.py +77 -0
- figrecipe/styles/_kwargs_converter.py +178 -0
- figrecipe/styles/_plot_styles.py +209 -0
- figrecipe/styles/_style_applier.py +60 -202
- figrecipe/styles/_style_loader.py +73 -121
- figrecipe/styles/_themes.py +151 -0
- figrecipe/styles/presets/MATPLOTLIB.yaml +95 -0
- figrecipe/styles/presets/SCITEX.yaml +181 -0
- figrecipe-0.7.4.dist-info/METADATA +429 -0
- figrecipe-0.7.4.dist-info/RECORD +188 -0
- figrecipe/_reproducer.py +0 -358
- figrecipe-0.5.0.dist-info/METADATA +0 -336
- figrecipe-0.5.0.dist-info/RECORD +0 -26
- {figrecipe-0.5.0.dist-info → figrecipe-0.7.4.dist-info}/WHEEL +0 -0
- {figrecipe-0.5.0.dist-info → figrecipe-0.7.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""imshow: image display demo."""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def plot_imshow(plt, rng, ax=None):
|
|
7
|
+
"""Image display demo.
|
|
8
|
+
|
|
9
|
+
Demonstrates: ax.imshow()
|
|
10
|
+
"""
|
|
11
|
+
if ax is None:
|
|
12
|
+
fig, ax = plt.subplots()
|
|
13
|
+
else:
|
|
14
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
15
|
+
|
|
16
|
+
data = rng.uniform(0, 1, (20, 20))
|
|
17
|
+
ax.imshow(data, id="imshow")
|
|
18
|
+
ax.axis("off")
|
|
19
|
+
ax.set_title("imshow")
|
|
20
|
+
return fig, ax
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# EOF
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""matshow: matrix display demo."""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def plot_matshow(plt, rng, ax=None):
|
|
7
|
+
"""Matrix display demo.
|
|
8
|
+
|
|
9
|
+
Demonstrates: ax.matshow()
|
|
10
|
+
"""
|
|
11
|
+
if ax is None:
|
|
12
|
+
fig, ax = plt.subplots()
|
|
13
|
+
else:
|
|
14
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
15
|
+
|
|
16
|
+
data = rng.uniform(0, 1, (10, 10))
|
|
17
|
+
ax.matshow(data, id="matshow")
|
|
18
|
+
ax.axis("off")
|
|
19
|
+
ax.set_title("matshow")
|
|
20
|
+
return fig, ax
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# EOF
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""pcolor: pseudocolor plot demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_pcolor(plt, rng, ax=None):
|
|
9
|
+
"""Pseudocolor plot demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.pcolor()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
x = np.arange(0, 10, 1)
|
|
19
|
+
y = np.arange(0, 10, 1)
|
|
20
|
+
X, Y = np.meshgrid(x, y)
|
|
21
|
+
Z = np.sin(X) * np.cos(Y)
|
|
22
|
+
ax.pcolor(X, Y, Z, id="pcolor")
|
|
23
|
+
ax.set_xlabel("X")
|
|
24
|
+
ax.set_ylabel("Y")
|
|
25
|
+
ax.set_title("pcolor")
|
|
26
|
+
return fig, ax
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# EOF
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""pcolormesh: pseudocolor mesh plot demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_pcolormesh(plt, rng, ax=None):
|
|
9
|
+
"""Pseudocolor mesh plot demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.pcolormesh()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
x = np.linspace(0, 2 * np.pi, 50)
|
|
19
|
+
y = np.linspace(0, 2 * np.pi, 50)
|
|
20
|
+
X, Y = np.meshgrid(x, y)
|
|
21
|
+
Z = np.sin(X) * np.cos(Y)
|
|
22
|
+
ax.pcolormesh(X, Y, Z, id="pcolormesh")
|
|
23
|
+
ax.set_xlabel("X")
|
|
24
|
+
ax.set_ylabel("Y")
|
|
25
|
+
ax.set_title("pcolormesh")
|
|
26
|
+
return fig, ax
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# EOF
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""spy: sparse matrix visualization demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_spy(plt, rng, ax=None):
|
|
9
|
+
"""Sparse matrix visualization demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.spy()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
# Create sparse-like matrix
|
|
19
|
+
data = np.zeros((20, 20))
|
|
20
|
+
for _ in range(50):
|
|
21
|
+
i, j = rng.integers(0, 20, 2)
|
|
22
|
+
data[i, j] = 1
|
|
23
|
+
ax.spy(data, id="spy")
|
|
24
|
+
ax.axis("off")
|
|
25
|
+
ax.set_title("spy")
|
|
26
|
+
return fig, ax
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# EOF
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""errorbar: error bar plot demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_errorbar(plt, rng, ax=None):
|
|
9
|
+
"""Error bar plot demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.errorbar()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
x = np.arange(5)
|
|
19
|
+
y = rng.uniform(2, 8, 5)
|
|
20
|
+
yerr = rng.uniform(0.3, 0.8, 5)
|
|
21
|
+
ax.errorbar(x, y, yerr=yerr, id="errorbar")
|
|
22
|
+
ax.set_xlabel("X")
|
|
23
|
+
ax.set_ylabel("Y")
|
|
24
|
+
ax.set_title("errorbar")
|
|
25
|
+
return fig, ax
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# EOF
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""fill: filled polygon demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_fill(plt, rng, ax=None):
|
|
9
|
+
"""Filled polygon demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.fill()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
theta = np.linspace(0, 2 * np.pi, 6)
|
|
19
|
+
x = np.cos(theta)
|
|
20
|
+
y = np.sin(theta)
|
|
21
|
+
ax.fill(x, y, alpha=0.5, id="fill")
|
|
22
|
+
ax.set_xlabel("X")
|
|
23
|
+
ax.set_ylabel("Y")
|
|
24
|
+
ax.set_title("fill")
|
|
25
|
+
ax.set_aspect("equal")
|
|
26
|
+
return fig, ax
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# EOF
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""fill_between: filled area between curves demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_fill_between(plt, rng, ax=None):
|
|
9
|
+
"""Filled area between curves demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.fill_between()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
x = np.linspace(0, 10, 100)
|
|
19
|
+
y1 = np.sin(x)
|
|
20
|
+
y2 = np.sin(x) + 0.5
|
|
21
|
+
ax.fill_between(x, y1, y2, alpha=0.5, id="fill_between")
|
|
22
|
+
ax.plot(x, y1, id="lower")
|
|
23
|
+
ax.plot(x, y2, id="upper")
|
|
24
|
+
ax.set_xlabel("X")
|
|
25
|
+
ax.set_ylabel("Y")
|
|
26
|
+
ax.set_title("fill_between")
|
|
27
|
+
return fig, ax
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# EOF
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""fill_betweenx: horizontal filled area demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_fill_betweenx(plt, rng, ax=None):
|
|
9
|
+
"""Horizontal filled area demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.fill_betweenx()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
y = np.linspace(0, 10, 100)
|
|
19
|
+
x1 = np.sin(y)
|
|
20
|
+
x2 = np.sin(y) + 0.5
|
|
21
|
+
ax.fill_betweenx(y, x1, x2, alpha=0.5, id="fill_betweenx")
|
|
22
|
+
ax.set_xlabel("X")
|
|
23
|
+
ax.set_ylabel("Y")
|
|
24
|
+
ax.set_title("fill_betweenx")
|
|
25
|
+
return fig, ax
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# EOF
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""plot: line plot demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_plot(plt, rng, ax=None):
|
|
9
|
+
"""Line plot demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.plot()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
x = np.linspace(0, 2 * np.pi, 100)
|
|
19
|
+
ax.plot(x, np.sin(x), label="sin", id="sin")
|
|
20
|
+
ax.plot(x, np.cos(x), label="cos", id="cos")
|
|
21
|
+
ax.legend()
|
|
22
|
+
ax.set_xlabel("X")
|
|
23
|
+
ax.set_ylabel("Y")
|
|
24
|
+
ax.set_title("plot")
|
|
25
|
+
return fig, ax
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# EOF
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""stackplot: stacked area plot demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_stackplot(plt, rng, ax=None):
|
|
9
|
+
"""Stacked area plot demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.stackplot()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
x = np.arange(10)
|
|
19
|
+
y1 = rng.uniform(1, 3, 10)
|
|
20
|
+
y2 = rng.uniform(1, 3, 10)
|
|
21
|
+
y3 = rng.uniform(1, 3, 10)
|
|
22
|
+
ax.stackplot(x, y1, y2, y3, id="stackplot")
|
|
23
|
+
ax.set_xlabel("X")
|
|
24
|
+
ax.set_ylabel("Y")
|
|
25
|
+
ax.set_title("stackplot")
|
|
26
|
+
return fig, ax
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# EOF
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""stairs: staircase plot demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_stairs(plt, rng, ax=None):
|
|
9
|
+
"""Staircase plot demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.stairs()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
values = rng.uniform(1, 5, 10)
|
|
19
|
+
edges = np.arange(11)
|
|
20
|
+
ax.stairs(values, edges, fill=True, alpha=0.5, id="stairs")
|
|
21
|
+
ax.set_xlabel("X")
|
|
22
|
+
ax.set_ylabel("Y")
|
|
23
|
+
ax.set_title("stairs")
|
|
24
|
+
return fig, ax
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# EOF
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""step: step plot demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_step(plt, rng, ax=None):
|
|
9
|
+
"""Step plot demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.step()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
x = np.arange(10)
|
|
19
|
+
y = rng.uniform(0, 1, 10)
|
|
20
|
+
ax.step(x, y, where="mid", id="step")
|
|
21
|
+
ax.set_xlabel("X")
|
|
22
|
+
ax.set_ylabel("Y")
|
|
23
|
+
ax.set_title("step")
|
|
24
|
+
return fig, ax
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# EOF
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""scatter: scatter plot demo."""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def plot_scatter(plt, rng, ax=None):
|
|
7
|
+
"""Scatter plot demo.
|
|
8
|
+
|
|
9
|
+
Demonstrates: ax.scatter()
|
|
10
|
+
"""
|
|
11
|
+
if ax is None:
|
|
12
|
+
fig, ax = plt.subplots()
|
|
13
|
+
else:
|
|
14
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
15
|
+
|
|
16
|
+
x, y = rng.uniform(0, 10, 50), rng.uniform(0, 10, 50)
|
|
17
|
+
ax.scatter(x, y, id="scatter")
|
|
18
|
+
ax.set_xlabel("X")
|
|
19
|
+
ax.set_ylabel("Y")
|
|
20
|
+
ax.set_title("scatter")
|
|
21
|
+
return fig, ax
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# EOF
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""eventplot: event/spike raster demo."""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def plot_eventplot(plt, rng, ax=None):
|
|
7
|
+
"""Event/spike raster demo.
|
|
8
|
+
|
|
9
|
+
Demonstrates: ax.eventplot()
|
|
10
|
+
"""
|
|
11
|
+
if ax is None:
|
|
12
|
+
fig, ax = plt.subplots()
|
|
13
|
+
else:
|
|
14
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
15
|
+
|
|
16
|
+
# Multiple event sequences
|
|
17
|
+
events = [rng.uniform(0, 10, 20) for _ in range(5)]
|
|
18
|
+
ax.eventplot(events, id="eventplot")
|
|
19
|
+
ax.set_xlabel("Time")
|
|
20
|
+
ax.set_ylabel("Channel")
|
|
21
|
+
ax.set_title("eventplot")
|
|
22
|
+
return fig, ax
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# EOF
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""loglog: log-log plot demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_loglog(plt, rng, ax=None):
|
|
9
|
+
"""Log-log plot demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.loglog()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
x = np.logspace(0, 3, 50)
|
|
19
|
+
y = x**2
|
|
20
|
+
ax.loglog(x, y, id="loglog")
|
|
21
|
+
ax.set_xlabel("X")
|
|
22
|
+
ax.set_ylabel("Y")
|
|
23
|
+
ax.set_title("loglog")
|
|
24
|
+
return fig, ax
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# EOF
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""pie: pie chart demo."""
|
|
4
|
+
|
|
5
|
+
import matplotlib.pyplot as mpl_plt
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_pie(plt, rng, ax=None):
|
|
9
|
+
"""Pie chart demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.pie()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
sizes = [35, 25, 20, 20]
|
|
19
|
+
labels = ["A", "B", "C", "D"]
|
|
20
|
+
# Get colors from current style's color cycle
|
|
21
|
+
colors = mpl_plt.rcParams["axes.prop_cycle"].by_key()["color"][:4]
|
|
22
|
+
ax.pie(sizes, labels=labels, colors=colors, id="pie")
|
|
23
|
+
ax.set_title("pie")
|
|
24
|
+
return fig, ax
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# EOF
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""semilogx: semi-log X plot demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_semilogx(plt, rng, ax=None):
|
|
9
|
+
"""Semi-log X plot demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.semilogx()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
x = np.logspace(0, 3, 50)
|
|
19
|
+
y = np.log10(x)
|
|
20
|
+
ax.semilogx(x, y, id="semilogx")
|
|
21
|
+
ax.set_xlabel("X (log)")
|
|
22
|
+
ax.set_ylabel("Y")
|
|
23
|
+
ax.set_title("semilogx")
|
|
24
|
+
return fig, ax
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# EOF
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""semilogy: semi-log Y plot demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_semilogy(plt, rng, ax=None):
|
|
9
|
+
"""Semi-log Y plot demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.semilogy()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
x = np.linspace(0, 5, 50)
|
|
19
|
+
y = np.exp(x)
|
|
20
|
+
ax.semilogy(x, y, id="semilogy")
|
|
21
|
+
ax.set_xlabel("X")
|
|
22
|
+
ax.set_ylabel("Y (log)")
|
|
23
|
+
ax.set_title("semilogy")
|
|
24
|
+
return fig, ax
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# EOF
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""stem: stem plot demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_stem(plt, rng, ax=None):
|
|
9
|
+
"""Stem plot demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.stem()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
x = np.arange(10)
|
|
19
|
+
y = rng.uniform(0, 1, 10)
|
|
20
|
+
ax.stem(x, y, id="stem")
|
|
21
|
+
ax.set_xlabel("X")
|
|
22
|
+
ax.set_ylabel("Y")
|
|
23
|
+
ax.set_title("stem")
|
|
24
|
+
return fig, ax
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# EOF
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""acorr: autocorrelation demo."""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def plot_acorr(plt, rng, ax=None):
|
|
7
|
+
"""Autocorrelation demo.
|
|
8
|
+
|
|
9
|
+
Demonstrates: ax.acorr()
|
|
10
|
+
"""
|
|
11
|
+
if ax is None:
|
|
12
|
+
fig, ax = plt.subplots()
|
|
13
|
+
else:
|
|
14
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
15
|
+
|
|
16
|
+
x = rng.normal(0, 1, 100)
|
|
17
|
+
ax.acorr(x, maxlags=50, id="acorr")
|
|
18
|
+
ax.set_xlabel("Lag")
|
|
19
|
+
ax.set_ylabel("Autocorrelation")
|
|
20
|
+
ax.set_title("acorr")
|
|
21
|
+
return fig, ax
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# EOF
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""angle_spectrum: phase angle spectrum demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_angle_spectrum(plt, rng, ax=None):
|
|
9
|
+
"""Phase angle spectrum demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.angle_spectrum()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
fs = 1000
|
|
19
|
+
t = np.linspace(0, 1, fs)
|
|
20
|
+
signal = np.sin(2 * np.pi * 50 * t) + 0.5 * np.sin(2 * np.pi * 120 * t + np.pi / 3)
|
|
21
|
+
ax.angle_spectrum(signal, Fs=fs, id="angle_spectrum")
|
|
22
|
+
ax.set_xlabel("Frequency")
|
|
23
|
+
ax.set_ylabel("Phase (radians)")
|
|
24
|
+
ax.set_title("angle_spectrum")
|
|
25
|
+
return fig, ax
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# EOF
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""cohere: coherence demo."""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def plot_cohere(plt, rng, ax=None):
|
|
9
|
+
"""Coherence demo.
|
|
10
|
+
|
|
11
|
+
Demonstrates: ax.cohere()
|
|
12
|
+
"""
|
|
13
|
+
if ax is None:
|
|
14
|
+
fig, ax = plt.subplots()
|
|
15
|
+
else:
|
|
16
|
+
fig = ax.get_figure() if hasattr(ax, "get_figure") else ax.fig
|
|
17
|
+
|
|
18
|
+
fs = 1000
|
|
19
|
+
t = np.linspace(0, 1, fs)
|
|
20
|
+
x = np.sin(2 * np.pi * 50 * t) + rng.normal(0, 0.3, len(t))
|
|
21
|
+
y = np.sin(2 * np.pi * 50 * t + np.pi / 4) + rng.normal(0, 0.3, len(t))
|
|
22
|
+
ax.cohere(x, y, Fs=fs, id="cohere")
|
|
23
|
+
ax.set_xlabel("Frequency")
|
|
24
|
+
ax.set_ylabel("Coherence")
|
|
25
|
+
ax.set_title("cohere")
|
|
26
|
+
return fig, ax
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# EOF
|