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

Commit140fb77

Browse files
authored
Merge pull request#12005 from meeseeksmachine/auto-backport-of-pr-12000-on-v2.2.3-doc
Backport PR#12000 on branch v2.2.3-doc (Improve layout of Fill Betweenx Demo)
2 parents45fcd11 +ac2dbdc commit140fb77

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

‎examples/lines_bars_and_markers/fill_betweenx_demo.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
Fill Betweenx Demo
44
==================
55
6-
Using ``fill_betweenx`` to color between two horizontal curves.
6+
Using `~.Axes.fill_betweenx` to color along the horizontal direction between
7+
two curves.
78
"""
89
importmatplotlib.pyplotasplt
910
importnumpyasnp
@@ -13,35 +14,35 @@
1314
x1=np.sin(2*np.pi*y)
1415
x2=1.2*np.sin(4*np.pi*y)
1516

16-
fig, [ax1,ax2,ax3]=plt.subplots(3,1,sharex=True)
17+
fig, [ax1,ax2,ax3]=plt.subplots(1,3,sharey=True,figsize=(6,6))
1718

1819
ax1.fill_betweenx(y,0,x1)
19-
ax1.set_ylabel('(x1, 0)')
20+
ax1.set_title('between(x1, 0)')
2021

2122
ax2.fill_betweenx(y,x1,1)
22-
ax2.set_ylabel('(x1, 1)')
23+
ax2.set_title('between (x1, 1)')
24+
ax2.set_xlabel('x')
2325

2426
ax3.fill_betweenx(y,x1,x2)
25-
ax3.set_ylabel('(x1, x2)')
26-
ax3.set_xlabel('x')
27+
ax3.set_title('between (x1, x2)')
2728

2829
# now fill between x1 and x2 where a logical condition is met. Note
2930
# this is different than calling
3031
# fill_between(y[where], x1[where], x2[where])
3132
# because of edge effects over multiple contiguous regions.
3233

33-
fig, [ax,ax1]=plt.subplots(2,1,sharex=True)
34+
fig, [ax,ax1]=plt.subplots(1,2,sharey=True,figsize=(6,6))
3435
ax.plot(x1,y,x2,y,color='black')
3536
ax.fill_betweenx(y,x1,x2,where=x2>=x1,facecolor='green')
3637
ax.fill_betweenx(y,x1,x2,where=x2<=x1,facecolor='red')
37-
ax.set_title('fill between where')
38+
ax.set_title('fill_betweenx where')
3839

3940
# Test support for masked arrays.
4041
x2=np.ma.masked_greater(x2,1.0)
4142
ax1.plot(x1,y,x2,y,color='black')
4243
ax1.fill_betweenx(y,x1,x2,where=x2>=x1,facecolor='green')
4344
ax1.fill_betweenx(y,x1,x2,where=x2<=x1,facecolor='red')
44-
ax1.set_title('Nowregions with x2 > 1 are masked')
45+
ax1.set_title('regions with x2 > 1 are masked')
4546

4647
# This example illustrates a problem; because of the data
4748
# gridding, there are undesired unfilled triangles at the crossover

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp