Skip to content

Commit 8ed5e63

Browse files
author
Sam Vaughan
committed
Changed polygon, removed grid and added outline
1 parent 258f2fb commit 8ed5e63

File tree

1 file changed

+9
-9
lines changed
  • examples/lines_bars_and_markers

1 file changed

+9
-9
lines changed

examples/lines_bars_and_markers/fill.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@
1111
import numpy as np
1212
import matplotlib.pyplot as plt
1313

14-
15-
x = [0, 0, 1, 2, 2]
16-
y = [0, 1, 2, 1, 0]
14+
x = [0, 1, 2, 1]
15+
y = [1, 2, 1, 0]
1716

1817
fig, ax = plt.subplots()
19-
ax.fill(x, y, zorder=10)
20-
ax.grid(True, zorder=5)
21-
22-
18+
ax.fill(x, y)
19+
# Outline of the region we've filled in
20+
ax.plot([x[0], x[1]], [y[0], y[1]], c='k', linewidth=2.0)
21+
ax.plot([x[1], x[2]], [y[1], y[2]], c='k', linewidth=2.0)
22+
ax.plot([x[2], x[3]], [y[2], y[3]], c='k', linewidth=2.0)
23+
ax.plot([x[3], x[0]], [y[3], y[0]], c='k', linewidth=2.0)
2324

2425
###############################################################################
2526
# Next, a few more optional features:
@@ -37,11 +38,10 @@
3738

3839
ax.fill(x, y1, 'b', x, y2, 'r', alpha=0.3)
3940

40-
# Also outline the region we've filled in
41+
# Outline of the region we've filled in
4142
ax.plot(x, y1, c='b', alpha=0.8)
4243
ax.plot(x, y2, c='r', alpha=0.8)
4344
ax.plot([x[0], x[-1]], [y1[0], y1[-1]], c='b', alpha=0.8)
4445
ax.plot([x[0], x[-1]], [y2[0], y2[-1]], c='r', alpha=0.8)
4546

46-
4747
plt.show()

0 commit comments

Comments
 (0)