8000 Replace multiple plots in one line calls · matplotlib/matplotlib@654efa6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 654efa6

Browse files
committed
Replace multiple plots in one line calls
1 parent eb8d36b commit 654efa6

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

examples/lines_bars_and_markers/eventcollection_demo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
# plot the data
3333
fig = plt.figure()
3434
ax = fig.add_subplot(1, 1, 1)
35-
ax.plot(xdata1, ydata1, xdata2, ydata2)
35+
ax.plot(xdata1, ydata1, color='tab:blue')
36+
ax.plot(xdata2, ydata2, color='tab:orange')
3637

3738
# create the events marking the x data points
3839
xevents1 = EventCollection(xdata1, color='tab:blue', linelength=0.05)

examples/pyplots/pyplot_two_subplots.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ def f(t):
1818

1919
plt.figure()
2020
plt.subplot(211)
21-
plt.plot(t1, f(t1), 'C0o', t2, f(t2), 'k')
21+
plot.plot(t1, f(t1), color='tab:blue', marker='o')
22+
plt.plot(t2, f(t2), color='black')
2223

2324
plt.subplot(212)
24-
plt.plot(t2, np.cos(2*np.pi*t2), 'C1--')
25+
plt.plot(t2, np.cos(2*np.pi*t2), color='tab:orange', linestyle='--')
2526
plt.show()
2627

2728
#############################################################################

examples/text_labels_and_annotations/figlegend_demo.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
x = np.arange(0.0, 2.0, 0.02)
1616
y1 = np.sin(2 * np.pi * x)
1717
y2 = np.exp(-x)
18-
l1, l2 = axs[0].plot(x, y1, 'C0s-', x, y2, 'C1o')
18+
l1, = axs[0].plot(x, y1)
19+
l2, = axs[0].plot(x, y2, marker='o')
1920

2021
y3 = np.sin(4 * np.pi * x)
2122
y4 = np.exp(-2 * x)
22-
l3, l4 = axs[1].plot(x, y3, 'C2d-', x, y4, 'C3^')
23+
l3, = axs[1].plot(x, y3, color='tab:green')
24+
l4, = axs[1].plot(x, y4, color='tab:red', marker='^')
2325

2426
fig.legend((l1, l2), ('Line 1', 'Line 2'), 'upper left')
2527
fig.legend((l3, l4), ('Line 3', 'Line 4'), 'upper right')

0 commit comments

Comments
 (0)
0