-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs build of d908b4f561c895f0522bbba39a88fda4824d3c5a
- Loading branch information
MatplotlibCircleBot
authored and
MatplotlibCircleBot
committed
Oct 7, 2023
1 parent
c1b66f3
commit 1c0c5dc
Showing
12,430 changed files
with
3,696,439 additions
and
960,543 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: fee21aba0ad35d7353946075a94d4ae9 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 | ||
config: 0d50caa96d5b284a996b1f358b3aa50a | ||
tags: 526838a1027dd1fd771fd21a9668211e |
68 changes: 68 additions & 0 deletions
68
_downloads/0017d0c84e03d6c5e463e23d8e570671/line_collection.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# Plotting multiple lines with a LineCollection\n\nMatplotlib can efficiently draw multiple lines at once using a\n`~.LineCollection`, as showcased below.\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import matplotlib.pyplot as plt\nimport numpy as np\n\nfrom matplotlib.collections import LineCollection\n\nx = np.arange(100)\n# Here are many sets of y to plot vs. x\nys = x[:50, np.newaxis] + x[np.newaxis, :]\n\nsegs = np.zeros((50, 100, 2))\nsegs[:, :, 1] = ys\nsegs[:, :, 0] = x\n\n# Mask some values to test masked array support:\nsegs = np.ma.masked_where((segs > 50) & (segs < 60), segs)\n\n# We need to set the plot limits, they will not autoscale\nfig, ax = plt.subplots()\nax.set_xlim(x.min(), x.max())\nax.set_ylim(ys.min(), ys.max())\n\n# *colors* is sequence of rgba tuples.\n# *linestyle* is a string or dash tuple. Legal string values are\n# solid|dashed|dashdot|dotted. The dash tuple is (offset, onoffseq) where\n# onoffseq is an even length tuple of on and off ink in points. If linestyle\n# is omitted, 'solid' is used.\n# See `matplotlib.collections.LineCollection` for more information.\ncolors = plt.rcParams['axes.prop_cycle'].by_key()['color']\n\nline_segments = LineCollection(segs, linewidths=(0.5, 1, 1.5, 2),\n colors=colors, linestyle='solid')\nax.add_collection(line_segments)\nax.set_title('Line collection with masked arrays')\nplt.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"In the following example, instead of passing a list of colors\n(``colors=colors``), we pass an array of values (``array=x``) that get\ncolormapped.\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"N = 50\nx = np.arange(N)\nys = [x + i for i in x] # Many sets of y to plot vs. x\nsegs = [np.column_stack([x, y]) for y in ys]\n\nfig, ax = plt.subplots()\nax.set_xlim(np.min(x), np.max(x))\nax.set_ylim(np.min(ys), np.max(ys))\n\nline_segments = LineCollection(segs, array=x,\n linewidths=(0.5, 1, 1.5, 2),\n linestyles='solid')\nax.add_collection(line_segments)\naxcb = fig.colorbar(line_segments)\naxcb.set_label('Line Number')\nax.set_title('Line Collection with mapped colors')\nplt.sci(line_segments) # This allows interactive changing of the colormap.\nplt.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
".. admonition:: References\n\n The use of the following functions, methods, classes and modules is shown\n in this example:\n\n - `matplotlib.collections`\n - `matplotlib.collections.LineCollection`\n - `matplotlib.cm.ScalarMappable.set_array`\n - `matplotlib.axes.Axes.add_collection`\n - `matplotlib.figure.Figure.colorbar` / `matplotlib.pyplot.colorbar`\n - `matplotlib.pyplot.sci`\n\n" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.18" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
============== | ||
stairs(values) | ||
============== | ||
See `~matplotlib.axes.Axes.stairs`. | ||
""" | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
plt.style.use('_mpl-gallery') | ||
|
||
# make data | ||
y = [4.8, 5.5, 3.5, 4.6, 6.5, 6.6, 2.6, 3.0] | ||
|
||
# plot | ||
fig, ax = plt.subplots() | ||
|
||
ax.stairs(y, linewidth=2.5) | ||
|
||
ax.set(xlim=(0, 8), xticks=np.arange(1, 8), | ||
ylim=(0, 8), yticks=np.arange(1, 8)) | ||
|
||
plt.show() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions
7
_downloads/00aacc25eb4ed2eaffa3c821d5562b6d/whats_new_3-6-0-5.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
x = np.linspace(1., 3., 10) | ||
y = x**3 | ||
|
||
fig, ax = plt.subplots() | ||
ax.plot(x, y, linestyle='--', color='orange', gapcolor='blue', | ||
linewidth=3, label='a striped line') | ||
ax.legend() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions
39
_downloads/00c94fd2ec27d6cef4b040acefbf730d/hyperlinks_sgskip.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
========== | ||
Hyperlinks | ||
========== | ||
This example demonstrates how to set a hyperlinks on various kinds of elements. | ||
This currently only works with the SVG backend. | ||
""" | ||
|
||
|
||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
import matplotlib.cm as cm | ||
|
||
# %% | ||
|
||
fig = plt.figure() | ||
s = plt.scatter([1, 2, 3], [4, 5, 6]) | ||
s.set_urls(['https://www.bbc.com/news', 'https://www.google.com/', None]) | ||
fig.savefig('scatter.svg') | ||
|
||
# %% | ||
|
||
fig = plt.figure() | ||
delta = 0.025 | ||
x = y = np.arange(-3.0, 3.0, delta) | ||
X, Y = np.meshgrid(x, y) | ||
Z1 = np.exp(-X**2 - Y**2) | ||
Z2 = np.exp(-(X - 1)**2 - (Y - 1)**2) | ||
Z = (Z1 - Z2) * 2 | ||
|
||
im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray, | ||
origin='lower', extent=(-3, 3, -3, 3)) | ||
|
||
im.set_url('https://www.google.com/') | ||
fig.savefig('image.svg') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions
30
_downloads/00f7f20b47c4afdb8cf00a246bc6af53/animation_demo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
================ | ||
pyplot animation | ||
================ | ||
Generating an animation by calling `~.pyplot.pause` between plotting commands. | ||
The method shown here is only suitable for simple, low-performance use. For | ||
more demanding applications, look at the :mod:`.animation` module and the | ||
examples that use it. | ||
Note that calling `time.sleep` instead of `~.pyplot.pause` would *not* work. | ||
Output generated via `matplotlib.animation.Animation.to_jshtml`. | ||
""" | ||
|
||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
np.random.seed(19680801) | ||
data = np.random.random((50, 50, 50)) | ||
|
||
fig, ax = plt.subplots() | ||
|
||
for i, img in enumerate(data): | ||
ax.clear() | ||
ax.imshow(img) | ||
ax.set_title(f"frame {i}") | ||
# Note that using time.sleep does *not* work here! | ||
plt.pause(0.1) |
86 changes: 86 additions & 0 deletions
86
_downloads/00fb9b6278ae3996d0eda53a7198ae42/hatch_style_reference.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# Hatch style reference\n\nHatches can be added to most polygons in Matplotlib, including `~.Axes.bar`,\n`~.Axes.fill_between`, `~.Axes.contourf`, and children of `~.patches.Polygon`.\nThey are currently supported in the PS, PDF, SVG, OSX, and Agg backends. The WX\nand Cairo backends do not currently support hatching.\n\nSee also :doc:`/gallery/images_contours_and_fields/contourf_hatching` for\nan example using `~.Axes.contourf`, and\n:doc:`/gallery/shapes_and_collections/hatch_demo` for more usage examples.\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import matplotlib.pyplot as plt\n\nfrom matplotlib.patches import Rectangle\n\nfig, axs = plt.subplots(2, 5, layout='constrained', figsize=(6.4, 3.2))\n\nhatches = ['/', '\\\\', '|', '-', '+', 'x', 'o', 'O', '.', '*']\n\n\ndef hatches_plot(ax, h):\n ax.add_patch(Rectangle((0, 0), 2, 2, fill=False, hatch=h))\n ax.text(1, -0.5, f\"' {h} '\", size=15, ha=\"center\")\n ax.axis('equal')\n ax.axis('off')\n\nfor ax, h in zip(axs.flat, hatches):\n hatches_plot(ax, h)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Hatching patterns can be repeated to increase the density.\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"fig, axs = plt.subplots(2, 5, layout='constrained', figsize=(6.4, 3.2))\n\nhatches = ['//', '\\\\\\\\', '||', '--', '++', 'xx', 'oo', 'OO', '..', '**']\n\nfor ax, h in zip(axs.flat, hatches):\n hatches_plot(ax, h)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Hatching patterns can be combined to create additional patterns.\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"fig, axs = plt.subplots(2, 5, layout='constrained', figsize=(6.4, 3.2))\n\nhatches = ['/o', '\\\\|', '|*', '-\\\\', '+o', 'x*', 'o-', 'O|', 'O.', '*-']\n\nfor ax, h in zip(axs.flat, hatches):\n hatches_plot(ax, h)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
".. admonition:: References\n\n The use of the following functions, methods, classes and modules is shown\n in this example:\n\n - `matplotlib.patches`\n - `matplotlib.patches.Rectangle`\n - `matplotlib.axes.Axes.add_patch`\n - `matplotlib.axes.Axes.text`\n\n" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.18" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Oops, something went wrong.