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

Appearance settings

Commit 34970ed

Browse filesBrowse files
timhoffmImportanceOfBeingErnest
authored andcommitted
Remove axes border for examples that list styles (#13683)
1 parent e4cc98b commit 34970ed
Copy full SHA for 34970ed

File tree

Expand file treeCollapse file tree

2 files changed

+14
-11
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-11
lines changed

‎examples/lines_bars_and_markers/joinstyle.py

Copy file name to clipboardExpand all lines: examples/lines_bars_and_markers/joinstyle.py
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def plot_angle(ax, x, y, angle, style):
4747

4848
ax.set_xlim(-1.5, 2.75)
4949
ax.set_ylim(-.5, 5.5)
50-
ax.xaxis.set_visible(False)
51-
ax.yaxis.set_visible(False)
50+
ax.set_axis_off()
5251
plt.show()
5352

5453

@@ -66,17 +65,16 @@ def plot_angle(ax, x, y, angle, style):
6665
ax.set_title('Cap style')
6766

6867
for x, style in enumerate(['butt', 'round', 'projecting']):
69-
ax.text(x, 1, style)
68+
ax.text(x+0.25, 1, style, ha='center')
7069
xx = [x, x+0.5]
7170
yy = [0, 0]
7271
ax.plot(xx, yy, lw=12, color='tab:blue', solid_capstyle=style)
7372
ax.plot(xx, yy, lw=1, color='black')
7473
ax.plot(xx, yy, 'o', color='tab:red', markersize=3)
75-
ax.text(2, 0.7, '(default)')
74+
ax.text(2.25, 0.7, '(default)', ha='center')
7675

7776
ax.set_ylim(-.5, 1.5)
78-
ax.xaxis.set_visible(False)
79-
ax.yaxis.set_visible(False)
77+
ax.set_axis_off()
8078

8179

8280
#############################################################################

‎examples/lines_bars_and_markers/linestyles.py

Copy file name to clipboardExpand all lines: examples/lines_bars_and_markers/linestyles.py
+10-5Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,21 @@
4141
('densely dashdotdotted', (0, (3, 1, 1, 1, 1, 1)))]
4242

4343

44-
def plot_linestyles(ax, linestyles):
44+
def plot_linestyles(ax, linestyles, title):
4545
X, Y = np.linspace(0, 100, 10), np.zeros(10)
4646
yticklabels = []
4747

4848
for i, (name, linestyle) in enumerate(linestyles):
4949
ax.plot(X, Y+i, linestyle=linestyle, linewidth=1.5, color='black')
5050
yticklabels.append(name)
5151

52-
ax.set(xticks=[], ylim=(-0.5, len(linestyles)-0.5),
53-
yticks=np.arange(len(linestyles)), yticklabels=yticklabels)
52+
ax.set_title(title)
53+
ax.set(ylim=(-0.5, len(linestyles)-0.5),
54+
yticks=np.arange(len(linestyles)),
55+
yticklabels=yticklabels)
56+
ax.tick_params(left=False, bottom=False, labelbottom=False)
57+
for spine in ax.spines.values():
58+
spine.set_visible(False)
5459

5560
# For each line style, add a text annotation with a small offset from
5661
# the reference point (0 in Axes coords, y tick value in Data coords).
@@ -64,8 +69,8 @@ def plot_linestyles(ax, linestyles):
6469
fig, (ax0, ax1) = plt.subplots(2, 1, gridspec_kw={'height_ratios': [1, 3]},
6570
figsize=(10, 8))
6671

67-
plot_linestyles(ax0, linestyle_str[::-1])
68-
plot_linestyles(ax1, linestyle_tuple[::-1])
72+
plot_linestyles(ax0, linestyle_str[::-1], title='Named linestyles')
73+
plot_linestyles(ax1, linestyle_tuple[::-1], title='Parametrized linestyles')
6974

7075
plt.tight_layout()
7176
plt.show()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.