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

Fix argument types in examples and tests#28764

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

Open
oscargus wants to merge3 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromoscargus:exampletesttyping
Open
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
4 changes: 2 additions & 2 deletionsdoc/project/history.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -157,7 +157,7 @@ Matplotlib logo (2008 - 2015).


def add_math_background():
ax = fig.add_axes([0., 0., 1., 1.])
ax = fig.add_axes((0., 0., 1., 1.))

text = []
text.append(
Expand DownExpand Up@@ -187,7 +187,7 @@ Matplotlib logo (2008 - 2015).


def add_polar_bar():
ax = fig.add_axes([0.025, 0.075, 0.2, 0.85], projection='polar')
ax = fig.add_axes((0.025, 0.075, 0.2, 0.85), projection='polar')

ax.patch.set_alpha(axalpha)
ax.set_axisbelow(True)
Expand Down
2 changes: 1 addition & 1 deletiondoc/users/prev_whats_new/dflt_style_changes.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1005,7 +1005,7 @@ a cleaner separation between subplots.

ax = fig.add_subplot(2, 2, j)
ax.hist(np.random.beta(0.5, 0.5, 10000), 25, density=True)
ax.set_xlim([0, 1])
ax.set_xlim(0, 1)
ax.set_title(title)

ax = fig.add_subplot(2, 2, j + 2)
Expand Down
14 changes: 7 additions & 7 deletionsdoc/users/prev_whats_new/whats_new_3.5.0.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -274,9 +274,9 @@ of the text inside the Axes of the `.TextBox` widget.

fig = plt.figure(figsize=(4, 3))
for i, alignment in enumerate(['left', 'center', 'right']):
box_input = fig.add_axes([0.1, 0.7 - i*0.3, 0.8, 0.2])
text_box = TextBox(ax=box_input, initial=f'{alignment} alignment',
label='', textalignment=alignment)
box_input = fig.add_axes((0.1, 0.7 - i*0.3, 0.8, 0.2))
text_box = TextBox(ax=box_input, initial=f'{alignment} alignment',
label='', textalignment=alignment)

Simplifying the font setting for usetex mode
--------------------------------------------
Expand DownExpand Up@@ -375,9 +375,9 @@ attribute.
points = ax.scatter((3, 3), (1, 3), (1, 3), c='red', zorder=10,
label='zorder=10')

ax.set_xlim((0, 5))
ax.set_ylim((0, 5))
ax.set_zlim((0, 2.5))
ax.set_xlim(0, 5)
ax.set_ylim(0, 5)
ax.set_zlim(0, 2.5)

plane = mpatches.Patch(facecolor='white', edgecolor='black',
label='zorder=1')
Expand DownExpand Up@@ -485,7 +485,7 @@ new styling parameters for the added handles.
ax = ax_old
valmin = 0
valinit = 0.5
ax.set_xlim([0, 1])
ax.set_xlim(0, 1)
ax_old.axvspan(valmin, valinit, 0, 1)
ax.axvline(valinit, 0, 1, color="r", lw=1)
ax.set_xticks([])
Expand Down
2 changes: 1 addition & 1 deletiongalleries/examples/animation/rain.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,7 +22,7 @@

# Create new Figure and an Axes which fills it.
fig = plt.figure(figsize=(7, 7))
ax = fig.add_axes([0, 0, 1, 1], frameon=False)
ax = fig.add_axes((0, 0, 1, 1), frameon=False)
ax.set_xlim(0, 1), ax.set_xticks([])
ax.set_ylim(0, 1), ax.set_yticks([])

Expand Down
2 changes: 1 addition & 1 deletiongalleries/examples/animation/simple_scatter.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,7 +11,7 @@
import matplotlib.animation as animation

fig, ax = plt.subplots()
ax.set_xlim([0, 10])
ax.set_xlim(0, 10)

scat = ax.scatter(1, 0)
x = np.linspace(0, 10)
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,7 @@
from mpl_toolkits.axes_grid1.axes_divider import make_axes_area_auto_adjustable

fig = plt.figure()
ax = fig.add_axes([0, 0, 1, 1])
ax = fig.add_axes((0, 0, 1, 1))

ax.set_yticks([0.5], labels=["very long label"])

Expand All@@ -19,8 +19,8 @@
# %%

fig = plt.figure()
ax1 = fig.add_axes([0, 0, 1, 0.5])
ax2 = fig.add_axes([0, 0.5, 1, 0.5])
ax1 = fig.add_axes((0, 0, 1, 0.5))
ax2 = fig.add_axes((0, 0.5, 1, 0.5))

ax1.set_yticks([0.5], labels=["very long label"])
ax1.set_ylabel("Y label")
Expand All@@ -33,7 +33,7 @@
# %%

fig = plt.figure()
ax1 = fig.add_axes([0, 0, 1, 1])
ax1 = fig.add_axes((0, 0, 1, 1))
divider = make_axes_locatable(ax1)

ax2 = divider.append_axes("right", "100%", pad=0.3, sharey=ax1)
Expand Down
2 changes: 1 addition & 1 deletiongalleries/examples/axisartist/demo_parasite_axes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,7 +24,7 @@

fig = plt.figure()

host = fig.add_axes([0.15, 0.1, 0.65, 0.8], axes_class=HostAxes)
host = fig.add_axes((0.15, 0.1, 0.65, 0.8), axes_class=HostAxes)
par1 = host.get_aux_axes(viewlim_mode=None, sharex=host)
par2 = host.get_aux_axes(viewlim_mode=None, sharex=host)

Expand Down
4 changes: 2 additions & 2 deletionsgalleries/examples/event_handling/poly_editor.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -203,6 +203,6 @@ def on_mouse_move(self, event):
p = PolygonInteractor(ax, poly)

ax.set_title('Click and drag a point to move it')
ax.set_xlim((-2, 2))
ax.set_ylim((-2, 2))
ax.set_xlim(-2, 2)
ax.set_ylim(-2, 2)
plt.show()
4 changes: 2 additions & 2 deletionsgalleries/examples/event_handling/pong_sgskip.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -134,9 +134,9 @@ def __init__(self, ax):
# create the initial line
self.ax = ax
ax.xaxis.set_visible(False)
ax.set_xlim([0, 7])
ax.set_xlim(0, 7)
ax.yaxis.set_visible(False)
ax.set_ylim([-1, 1])
ax.set_ylim(-1, 1)
pad_a_x = 0
pad_b_x = .50
pad_a_y = pad_b_y = .30
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,7 @@
dpi = 100

fig = plt.figure(figsize=(len(code) * pixel_per_bar / dpi, 2), dpi=dpi)
ax = fig.add_axes([0, 0, 1, 1]) # span the whole figure
ax = fig.add_axes((0, 0, 1, 1)) # span the whole figure
ax.set_axis_off()
ax.imshow(code.reshape(1, -1), cmap='binary', aspect='auto',
interpolation='nearest')
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -245,7 +245,7 @@
# may serve a 100x100 version of the image, which will be downsampled.)

fig = plt.figure(figsize=(2, 2))
ax = fig.add_axes([0, 0, 1, 1])
ax = fig.add_axes((0, 0, 1, 1))
ax.imshow(aa[:400, :400], cmap='RdBu_r', interpolation='nearest')
plt.show()
# %%
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -134,13 +134,13 @@ def annotate_rect(ax):
fig = plt.figure(figsize=(fig_width / dpi, fig_height / dpi), facecolor='aliceblue')

# the position posA must be normalized by the figure width and height:
ax = fig.add_axes([posA[0] / fig_width, posA[1] / fig_height,
posA[2] / fig_width, posA[3] / fig_height])
ax = fig.add_axes((posA[0] / fig_width, posA[1] / fig_height,
posA[2] / fig_width, posA[3] / fig_height))
ax.imshow(A, vmin=-1, vmax=1)
annotate_rect(ax)

ax = fig.add_axes([posB[0] / fig_width, posB[1] / fig_height,
posB[2] / fig_width, posB[3] / fig_height])
ax = fig.add_axes((posB[0] / fig_width, posB[1] / fig_height,
posB[2] / fig_width, posB[3] / fig_height))
ax.imshow(B, vmin=-1, vmax=1)
plt.show()
# %%
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,8 +53,8 @@
ax.add_collection(yevents2)

# set the limits
ax.set_xlim([0, 1])
ax.set_ylim([0, 1])
ax.set_xlim(0, 1)
ax.set_ylim(0, 1)

ax.set_title('line plot with data points')

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,8 +79,8 @@
for ax, markevery in zip(axs.flat, cases):
ax.set_title(f'markevery={markevery}')
ax.plot(x, y, 'o', ls='-', ms=4, markevery=markevery)
ax.set_xlim((6, 6.7))
ax.set_ylim((1.1, 1.7))
ax.set_xlim(6, 6.7)
ax.set_ylim(1.1, 1.7)

# %%
# markevery on polar plots
Expand Down
2 changes: 1 addition & 1 deletiongalleries/examples/misc/svg_filter_line.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,7 +17,7 @@
import matplotlib.transforms as mtransforms

fig1 = plt.figure()
ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8])
ax = fig1.add_axes((0.1, 0.1, 0.8, 0.8))

# draw lines
l1, = ax.plot([0.1, 0.5, 0.9], [0.1, 0.9, 0.5], "bo-",
Expand Down
2 changes: 1 addition & 1 deletiongalleries/examples/misc/svg_filter_pie.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,7 +19,7 @@

# make a square figure and Axes
fig = plt.figure(figsize=(6, 6))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
ax = fig.add_axes((0.1, 0.1, 0.8, 0.8))

labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
fracs = [15, 30, 45, 10]
Expand Down
2 changes: 1 addition & 1 deletiongalleries/examples/mplot3d/box3d.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,7 +51,7 @@
xmin, xmax = X.min(), X.max()
ymin, ymax = Y.min(), Y.max()
zmin, zmax = Z.min(), Z.max()
ax.set(xlim=[xmin, xmax], ylim=[ymin, ymax], zlim=[zmin, zmax])
ax.set(xlim=(xmin, xmax), ylim=(ymin, ymax), zlim=(zmin, zmax))

# Plot edges
edges_kw = dict(color='0.4', linewidth=1, zorder=1e3)
Expand Down
4 changes: 2 additions & 2 deletionsgalleries/examples/shapes_and_collections/hatch_demo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,8 +41,8 @@
hatch='*', facecolor='y'))
axs['patches'].add_patch(Polygon([(10, 20), (30, 50), (50, 10)],
hatch='\\/...', facecolor='g'))
axs['patches'].set_xlim([0, 40])
axs['patches'].set_ylim([10, 60])
axs['patches'].set_xlim(0, 40)
axs['patches'].set_ylim(10, 60)
axs['patches'].set_aspect(1)
plt.show()

Expand Down
2 changes: 1 addition & 1 deletiongalleries/examples/showcase/anatomy.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@
Y3 = np.random.uniform(Y1, Y2, len(X))

fig = plt.figure(figsize=(7.5, 7.5))
ax = fig.add_axes([0.2, 0.17, 0.68, 0.7], aspect=1)
ax = fig.add_axes((0.2, 0.17, 0.68, 0.7), aspect=1)

ax.xaxis.set_major_locator(MultipleLocator(1.000))
ax.xaxis.set_minor_locator(AutoMinorLocator(4))
Expand Down
2 changes: 1 addition & 1 deletiongalleries/examples/showcase/firefox.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@ def svg_parse(path):
xmax, ymax = verts.max(axis=0) + 1

fig = plt.figure(figsize=(5, 5), facecolor="0.75") # gray background
ax = fig.add_axes([0, 0, 1, 1], frameon=False, aspect=1,
ax = fig.add_axes((0, 0, 1, 1), frameon=False, aspect=1,
xlim=(xmin, xmax), # centering
ylim=(ymax, ymin), # centering, upside down
xticks=[], yticks=[]) # no ticks
Expand Down
2 changes: 1 addition & 1 deletiongalleries/examples/showcase/mandelbrot.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -55,7 +55,7 @@ def mandelbrot_set(xmin, xmax, ymin, ymax, xn, yn, maxiter, horizon=2.0):
width = 10
height = 10*yn/xn
fig = plt.figure(figsize=(width, height), dpi=dpi)
ax = fig.add_axes([0, 0, 1, 1], frameon=False, aspect=1)
ax = fig.add_axes((0, 0, 1, 1), frameon=False, aspect=1)

# Shaded rendering
light = colors.LightSource(azdeg=315, altdeg=10)
Expand Down
6 changes: 3 additions & 3 deletionsgalleries/examples/showcase/xkcd.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,7 +19,7 @@
ax.spines[['top', 'right']].set_visible(False)
ax.set_xticks([])
ax.set_yticks([])
ax.set_ylim([-30, 10])
ax.set_ylim(-30, 10)

data = np.ones(100)
data[70:] -= np.arange(30)
Expand DownExpand Up@@ -50,9 +50,9 @@
ax.xaxis.set_ticks_position('bottom')
ax.set_xticks([0, 1])
ax.set_xticklabels(['CONFIRMED BY\nEXPERIMENT', 'REFUTED BY\nEXPERIMENT'])
ax.set_xlim([-0.5, 1.5])
ax.set_xlim(-0.5, 1.5)
ax.set_yticks([])
ax.set_ylim([0, 110])
ax.set_ylim(0, 110)

ax.set_title("CLAIMS OF SUPERNATURAL POWERS")

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -55,7 +55,7 @@ def bullseye_plot(ax, data, seg_bold=None, cmap="viridis", norm=None):

r = np.linspace(0.2, 1, 4)

ax.set(ylim=[0, 1], xticklabels=[], yticklabels=[])
ax.set(ylim=(0, 1), xticklabels=[], yticklabels=[])
ax.grid(False) # Remove grid

# Fill segments 1-6, 7-12, 13-16.
Expand Down
2 changes: 1 addition & 1 deletiongalleries/examples/statistics/errorbar_limits.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -71,7 +71,7 @@
linestyle='none')

# tidy up the figure
ax.set_xlim((0, 5.5))
ax.set_xlim(0, 5.5)
ax.set_title('Errorbar upper and lower limits')
plt.show()

Expand Down
4 changes: 2 additions & 2 deletionsgalleries/examples/subplots_axes_and_figures/axes_demo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,12 +33,12 @@
main_ax.set_title('Gaussian colored noise')

# this is an inset Axes over the main Axes
right_inset_ax = fig.add_axes([.65, .6, .2, .2], facecolor='k')
right_inset_ax = fig.add_axes((.65, .6, .2, .2), facecolor='k')
right_inset_ax.hist(s, 400, density=True)
right_inset_ax.set(title='Probability', xticks=[], yticks=[])

# this is another inset Axes over the main Axes
left_inset_ax = fig.add_axes([.2, .6, .2, .2], facecolor='k')
left_inset_ax = fig.add_axes((.2, .6, .2, .2), facecolor='k')
left_inset_ax.plot(t[:len(r)], r)
left_inset_ax.set(title='Impulse response', xlim=(0, .2), xticks=[], yticks=[])

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -61,7 +61,7 @@ def doall():

# Creating figure and axis.
fig = plt.figure(figsize=(7, 7))
ax = fig.add_axes([0.01, 0.01, 0.98, 0.90],
ax = fig.add_axes((0.01, 0.01, 0.98, 0.90),
facecolor="white", frameon=True)
ax.set_xlim(0, 1)
ax.set_ylim(0, 1)
Expand Down
2 changes: 1 addition & 1 deletiongalleries/examples/ticks/fig_axes_customize_simple.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,7 @@
fig = plt.figure()
fig.patch.set_facecolor('lightgoldenrodyellow')

ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4])
ax1 = fig.add_axes((0.1, 0.3, 0.4, 0.4))
ax1.patch.set_facecolor('lightslategray')

ax1.tick_params(axis='x', labelcolor='tab:red', labelrotation=45, labelsize=16)
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -194,10 +194,10 @@ def createPlots(self):
self.subplot1.set_xlabel("frequency f", fontsize=8)
self.subplot2.set_ylabel("Time Domain Waveform x(t)", fontsize=8)
self.subplot2.set_xlabel("time t", fontsize=8)
self.subplot1.set_xlim([-6, 6])
self.subplot1.set_ylim([0, 1])
self.subplot2.set_xlim([-2, 2])
self.subplot2.set_ylim([-2, 2])
self.subplot1.set_xlim(-6, 6)
self.subplot1.set_ylim(0, 1)
self.subplot2.set_xlim(-2, 2)
self.subplot2.set_ylim(-2, 2)
self.subplot1.text(0.05, .95,
r'$X(f) = \mathcal{F}\{x(t)\}$',
verticalalignment='top',
Expand Down
4 changes: 2 additions & 2 deletionsgalleries/examples/widgets/buttons.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,8 +41,8 @@ def prev(self, event):
plt.draw()

callback = Index()
axprev = fig.add_axes([0.7, 0.05, 0.1, 0.075])
axnext = fig.add_axes([0.81, 0.05, 0.1, 0.075])
axprev = fig.add_axes((0.7, 0.05, 0.1, 0.075))
axnext = fig.add_axes((0.81, 0.05, 0.1, 0.075))
bnext = Button(axnext, 'Next')
bnext.on_clicked(callback.next)
bprev = Button(axprev, 'Previous')
Expand Down
2 changes: 1 addition & 1 deletiongalleries/examples/widgets/range_slider.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,7 +34,7 @@
axs[1].set_title('Histogram of pixel intensities')

# Create the RangeSlider
slider_ax = fig.add_axes([0.20, 0.1, 0.60, 0.03])
slider_ax = fig.add_axes((0.20, 0.1, 0.60, 0.03))
slider = RangeSlider(slider_ax, "Threshold", img.min(), img.max())

# Create the Vertical lines on the histogram
Expand Down
6 changes: 3 additions & 3 deletionsgalleries/examples/widgets/slider_demo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ def f(t, amplitude, frequency):
fig.subplots_adjust(left=0.25, bottom=0.25)

# Make a horizontal slider to control the frequency.
axfreq = fig.add_axes([0.25, 0.1, 0.65, 0.03])
axfreq = fig.add_axes((0.25, 0.1, 0.65, 0.03))
freq_slider = Slider(
ax=axfreq,
label='Frequency [Hz]',
Expand All@@ -48,7 +48,7 @@ def f(t, amplitude, frequency):
)

# Make a vertically oriented slider to control the amplitude
axamp = fig.add_axes([0.1, 0.25, 0.0225, 0.63])
axamp = fig.add_axes((0.1, 0.25, 0.0225, 0.63))
amp_slider = Slider(
ax=axamp,
label="Amplitude",
Expand All@@ -70,7 +70,7 @@ def update(val):
amp_slider.on_changed(update)

# Create a `matplotlib.widgets.Button` to reset the sliders to initial values.
resetax = fig.add_axes([0.8, 0.025, 0.1, 0.04])
resetax = fig.add_axes((0.8, 0.025, 0.1, 0.04))
button = Button(resetax, 'Reset', hovercolor='0.975')


Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp