-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8,423 changed files
with
9,982,988 additions
and
0 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
Binary file not shown.
79 changes: 79 additions & 0 deletions
79
3.6.0/_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,79 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"%matplotlib inline" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# Line Collection\n\nPlotting lines with Matplotlib.\n\n`~matplotlib.collections.LineCollection` allows one to plot multiple\nlines on a figure. Below we show off some of its properties.\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import matplotlib.pyplot as plt\nfrom matplotlib.collections import LineCollection\nfrom matplotlib import colors as mcolors\n\nimport numpy as np\n\n# In order to efficiently plot many lines in a single set of axes,\n# Matplotlib has the ability to add the lines all at once. Here is a\n# simple example showing how it is done.\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.\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 = [mcolors.to_rgba(c)\n for c in 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 order to efficiently plot many lines in a single set of axes,\nMatplotlib has the ability to add the lines all at once. Here is a\nsimple example showing how it is done.\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"N = 50\nx = np.arange(N)\n# Here are many sets of y to plot vs. x\nys = [x + i for i in x]\n\n# We need to set the plot limits, they will not autoscale\nfig, ax = plt.subplots()\nax.set_xlim(np.min(x), np.max(x))\nax.set_ylim(np.min(ys), np.max(ys))\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)\n# where onoffseq is an even length tuple of on and off ink in points.\n# If linestyle is omitted, 'solid' is used\n# See `matplotlib.collections.LineCollection` for more information\n\n# Make a sequence of (x, y) pairs.\nline_segments = LineCollection([np.column_stack([x, y]) for y in ys],\n linewidths=(0.5, 1, 1.5, 2),\n linestyles='solid')\nline_segments.set_array(x)\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.10.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
38 changes: 38 additions & 0 deletions
38
3.6.0/_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,38 @@ | ||
""" | ||
========== | ||
Hyperlinks | ||
========== | ||
This example demonstrates how to set a hyperlinks on various kinds of elements. | ||
This currently only works with the SVG backend. | ||
""" | ||
|
||
|
||
import numpy as np | ||
import matplotlib.cm as cm | ||
import matplotlib.pyplot as plt | ||
|
||
############################################################################### | ||
|
||
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') |
28 changes: 28 additions & 0 deletions
28
3.6.0/_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,28 @@ | ||
""" | ||
================ | ||
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. | ||
""" | ||
|
||
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) |
97 changes: 97 additions & 0 deletions
97
3.6.0/_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,97 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"%matplotlib inline" | ||
] | ||
}, | ||
{ | ||
"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\nfrom matplotlib.patches import Rectangle\n\nfig, axs = plt.subplots(2, 5, constrained_layout=True, 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, constrained_layout=True, 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, constrained_layout=True, 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.10.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Oops, something went wrong.