Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Backport PR #11353 on branch v2.2.2-doc#11364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletionexamples/api/agg_oo_sgskip.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,8 @@
The object-oriented interface
=============================

A pure OO (look Ma, no pyplot!) example using the agg backend.
A pure object-oriented example using the agg backend. Notice that there is no
``pyplot`` used here.
"""

from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
Expand All@@ -21,3 +22,24 @@
ax.set_xlabel('time')
ax.set_ylabel('volts')
fig.savefig('test')

#############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions, methods, classes and modules is shown
# in this example:

import matplotlib
matplotlib.backends.backend_agg.FigureCanvasAgg
matplotlib.figure.Figure
matplotlib.figure.Figure.add_subplot
matplotlib.figure.Figure.savefig
matplotlib.axes.Axes.plot
matplotlib.axes.Axes.set_title
matplotlib.axes.Axes.grid
matplotlib.axes.Axes.set_xlabel
matplotlib.axes.Axes.set_ylabel
15 changes: 15 additions & 0 deletionsexamples/api/filled_step.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -222,3 +222,18 @@ def stack_hist(ax, stacked_data, sty_cycle, bottoms=None,
ax2.set_ylabel('x')

plt.show()

#############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions, methods, classes and modules is shown
# in this example:

import matplotlib
matplotlib.axes.Axes.fill_betweenx
matplotlib.axes.Axes.fill_between
matplotlib.axis.Axis.set_major_locator
15 changes: 15 additions & 0 deletionsexamples/api/font_file.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,3 +27,18 @@
ax.set_xlabel('This is the default font')

plt.show()


#############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions, methods, classes and modules is shown
# in this example:

import matplotlib
matplotlib.font_manager.FontProperties
matplotlib.axes.Axes.set_title
52 changes: 49 additions & 3 deletionsexamples/api/histogram_path.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,17 +8,19 @@
the faster method of using PolyCollections, were implemented before we
had proper paths with moveto/lineto, closepoly etc in mpl. Now that
we have them, we can draw collections of regularly shaped objects with
homogeneous properties more efficiently with a PathCollection.This
example makes a histogram --its more work to set up the vertex arrays
homogeneous properties more efficiently with a PathCollection. This
example makes a histogram --it's more work to set up the vertex arrays
at the outset, but it should be much faster for large numbers of
objects
objects.
"""

import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.path as path


fig, ax = plt.subplots()

# Fixing random state for reproducibility
Expand DownExpand Up@@ -53,3 +55,47 @@
ax.set_ylim(bottom.min(), top.max())

plt.show()

#############################################################################
# It should be noted that instead of creating a three-dimensional array and
# using `~.path.Path.make_compound_path_from_polys`, we could as well create
# the compound path directly using vertices and codes as shown below

nrects = len(left)
nverts = nrects*(1+3+1)
verts = np.zeros((nverts, 2))
codes = np.ones(nverts, int) * path.Path.LINETO
codes[0::5] = path.Path.MOVETO
codes[4::5] = path.Path.CLOSEPOLY
verts[0::5, 0] = left
verts[0::5, 1] = bottom
verts[1::5, 0] = left
verts[1::5, 1] = top
verts[2::5, 0] = right
verts[2::5, 1] = top
verts[3::5, 0] = right
verts[3::5, 1] = bottom

barpath = path.Path(verts, codes)

#############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions, methods, classes and modules is shown
# in this example:

matplotlib.patches
matplotlib.patches.PathPatch
matplotlib.path
matplotlib.path.Path
matplotlib.path.Path.make_compound_path_from_polys
matplotlib.axes.Axes.add_patch
matplotlib.collections.PathCollection

# This example shows an alternative to
matplotlib.collections.PolyCollection
matplotlib.axes.Axes.hist
19 changes: 18 additions & 1 deletionexamples/api/image_zcoord.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,10 @@
==================================

Modify the coordinate formatter to report the image "z"
value of the nearest pixel given x and y
value of the nearest pixel given x and y.
This functionality is built in by default, but it
is still useful to show how to customize the
`~.axes.Axes.format_coord` function.
"""
import numpy as np
import matplotlib.pyplot as plt
Expand DownExpand Up@@ -32,3 +35,17 @@ def format_coord(x, y):

ax.format_coord = format_coord
plt.show()

#############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions, methods, classes and modules is shown
# in this example:

import matplotlib
matplotlib.axes.Axes.format_coord
matplotlib.axes.Axes.imshow
14 changes: 14 additions & 0 deletionsexamples/api/joinstyle.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,3 +31,17 @@ def plot_angle(ax, x, y, angle, style):
ax.set_xlim(-.5, 2.75)
ax.set_ylim(-.5, 5.5)
plt.show()

#############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions, methods, classes and modules is shown
# in this example:

import matplotlib
matplotlib.axes.Axes.plot
matplotlib.pyplot.plot
16 changes: 16 additions & 0 deletionsexamples/api/legend.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,3 +27,19 @@
legend.get_frame().set_facecolor('#00FFCC')

plt.show()

#############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions, methods, classes and modules is shown
# in this example:

import matplotlib
matplotlib.axes.Axes.plot
matplotlib.pyplot.plot
matplotlib.axes.Axes.legend
matplotlib.pyplot.legend
31 changes: 28 additions & 3 deletionsexamples/api/line_with_text.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@ def __init__(self, *args, **kwargs):
lines.Line2D.__init__(self, *args, **kwargs)

# we can't access the label attr until *after* the line is
#inited
#initiated
self.text.set_text(self.get_label())

def set_figure(self, figure):
Expand DownExpand Up@@ -59,8 +59,33 @@ def draw(self, renderer):
line.text.set_color('red')
line.text.set_fontsize(16)


ax.add_line(line)


plt.show()

#############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions, methods, classes and modules is shown
# in this example:

import matplotlib
matplotlib.lines
matplotlib.lines.Line2D
matplotlib.lines.Line2D.set_data
matplotlib.artist
matplotlib.artist.Artist
matplotlib.artist.Artist.draw
matplotlib.artist.Artist.set_transform
matplotlib.text
matplotlib.text.Text
matplotlib.text.Text.set_color
matplotlib.text.Text.set_fontsize
matplotlib.text.Text.set_position
matplotlib.axes.Axes.add_line
matplotlib.transforms
matplotlib.transforms.Affine2D
17 changes: 17 additions & 0 deletionsexamples/api/mathtext_asarray.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,3 +26,20 @@
fig.figimage(rgba2, 100, 300)

plt.show()

#############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions, methods, classes and modules is shown
# in this example:

import matplotlib
matplotlib.mathtext
matplotlib.mathtext.MathTextParser
matplotlib.mathtext.MathTextParser.to_png
matplotlib.mathtext.MathTextParser.to_rgba
matplotlib.figure.Figure.figimage
23 changes: 22 additions & 1 deletionexamples/api/patch_collection.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,8 @@
Circles, Wedges and Polygons
============================

This example demonstrates how to use patch collections.
This example demonstrates how to use
:class:`patch collections<~.collections.PatchCollection>`.
"""

import numpy as np
Expand DownExpand Up@@ -56,3 +57,23 @@
fig.colorbar(p, ax=ax)

plt.show()

#############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions, methods, classes and modules is shown
# in this example:

import matplotlib
matplotlib.patches
matplotlib.patches.Circle
matplotlib.patches.Wedge
matplotlib.patches.Polygon
matplotlib.collections.PatchCollection
matplotlib.collections.Collection.set_array
matplotlib.axes.Axes.add_collection
matplotlib.figure.Figure.colorbar
16 changes: 16 additions & 0 deletionsexamples/api/power_norm.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,3 +32,19 @@
fig.tight_layout()

plt.show()

#############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions, methods, classes and modules is shown
# in this example:

import matplotlib
matplotlib.colors
matplotlib.colors.PowerNorm
matplotlib.axes.Axes.hist2d
matplotlib.pyplot.hist2d
21 changes: 19 additions & 2 deletionsexamples/api/quad_bezier.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,8 +3,8 @@
Bezier Curve
============

This example showcases the PathPatch object to create a Bezier polycurve path
patch.
This example showcases the`~.patches.PathPatch` object to create a Bezier
polycurve pathpatch.
"""

import matplotlib.path as mpath
Expand All@@ -24,3 +24,20 @@
ax.set_title('The red point should be on the path')

plt.show()

#############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions, methods, classes and modules is shown
# in this example:

import matplotlib
matplotlib.path
matplotlib.path.Path
matplotlib.patches
matplotlib.patches.PathPatch
matplotlib.axes.Axes.add_patch
21 changes: 21 additions & 0 deletionsexamples/api/radar_chart.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -203,3 +203,24 @@ def example_data():
size='large')

plt.show()


#############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions, methods, classes and modules is shown
# in this example:

import matplotlib
matplotlib.path
matplotlib.path.Path
matplotlib.spines
matplotlib.spines.Spine
matplotlib.projections
matplotlib.projections.polar
matplotlib.projections.polar.PolarAxes
matplotlib.projections.register_projection
Loading

[8]ページ先頭

©2009-2025 Movatter.jp