8000 PEP8 fixes and add labels in 1st subplot · matplotlib/matplotlib@c426b97 · GitHub
[go: up one dir, main page]

Skip to content

Commit c426b97

Browse files
author
Adrien VINCENT
committed
PEP8 fixes and add labels in 1st subplot
1 parent 8b5eefb commit c426b97

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

examples/style_sheets/style_sheets_reference.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@
77
import numpy as np
88
import matplotlib.pyplot as plt
99

10+
1011
def plot_scatter(ax, prng, nb_samples=200):
1112
""" Scatter plot.
1213
1314
NB: `plt.scatter` doesn't use default colors.
1415
"""
1516
x, y = prng.normal(size=(2, nb_samples))
1617
ax.plot(x, y, 'o')
18+
ax.set_xlabel('X-label')
19+
ax.set_ylabel('Y-label')
1720
return ax
1821

22+
1923
def plot_colored_sinusoidal_lines(ax):
2024
""" Plot sinusoidal lines with colors from default color cycle.
2125
"""
@@ -28,6 +32,7 @@ def plot_colored_sinusoidal_lines(ax):
2832
ax.margins(0)
2933
return ax
3034

35+
3136
def plot_bar_graphs(ax, prng, min_value=5, max_value=25, nb_samples=5):
3237
""" Plot two bar graphs side by side, with letters as xticklabels.
3338
"""
@@ -40,6 +45,7 @@ def plot_bar_graphs(ax, prng, min_value=5, max_value=25, nb_samples=5):
4045
ax.set_xticklabels(['a', 'b', 'c', 'd', 'e'])
4146
return ax
4247

48+
4349
def plot_colored_circles(ax, prng, nb_samples=15):
4450
""" Plot circle patches.
4551
@@ -58,6 +64,7 @@ def plot_colored_circles(ax, prng, nb_samples=15):
5864
ax.set_aspect('equal', adjustable='box') # to plot circles as circles
5965
return ax
6066

67+
6168
def plot_image_and_patch(ax, prng, size=(20, 20)):
6269
""" Plot an image with random values and superimpose a circular patch.
6370
"""
@@ -66,6 +73,7 @@ def plot_image_and_patch(ax, prng, size=(20, 20)):
6673
c = plt.Circle((5, 5), radius=5, label='patch')
6774
ax.add_patch(c)
6875

76+
6977
def plot_histograms(ax, prng, nb_samples=10000):
7078
""" Plot 4 histograms and a text annotation.
7179
"""
@@ -82,12 +90,13 @@ def plot_histograms(ax, prng, nb_samples=10000):
8290
)
8391
return ax
8492

93+
8594
def plot_figure(style_label=None):
86-
"""
95+
"""
8796
Setup and plot the demonstration figure with the style `style_label`.
8897
If `style_label`, fall back to the `default` style.
8998
"""
90-
if style_label == None:
99+
if style_label is None:
91100
style_label = 'default'
92101

93102
# Use a dedicated RandomState instance to draw the same "random" values across
@@ -116,4 +125,3 @@ def plot_figure(style_label=None):
116125
fig = plot_figure(style_label=style_label)
117126

118127
plt.show()
119-

0 commit comments

Comments
 (0)
0