Skip to content

Commit 7539b61

Browse files
committed
Merge pull request matplotlib#4804 from QuLogic/radaraxes-example-sorting
DOC: Fix ordering in radar chart example.
2 parents 168f3f2 + eff6561 commit 7539b61

File tree

1 file changed

+30
-31
lines changed

1 file changed

+30
-31
lines changed

examples/api/radar_chart.py

+30-31
Original file line numberDiff line numberDiff line change
@@ -132,34 +132,33 @@ def example_data():
132132
# 2)Inclusion of gas-phase specie carbon monoxide (CO)
133133
# 3)Inclusion of gas-phase specie ozone (O3).
134134
# 4)Inclusion of both gas-phase speciesis present...
135-
data = {
136-
'column names':
137-
['Sulfate', 'Nitrate', 'EC', 'OC1', 'OC2', 'OC3', 'OP', 'CO',
138-
'O3'],
139-
'Basecase':
140-
[[0.88, 0.01, 0.03, 0.03, 0.00, 0.06, 0.01, 0.00, 0.00],
141-
[0.07, 0.95, 0.04, 0.05, 0.00, 0.02, 0.01, 0.00, 0.00],
142-
[0.01, 0.02, 0.85, 0.19, 0.05, 0.10, 0.00, 0.00, 0.00],
143-
[0.02, 0.01, 0.07, 0.01, 0.21, 0.12, 0.98, 0.00, 0.00],
144-
[0.01, 0.01, 0.02, 0.71, 0.74, 0.70, 0.00, 0.00, 0.00]],
145-
'With CO':
146-
[[0.88, 0.02, 0.02, 0.02, 0.00, 0.05, 0.00, 0.05, 0.00],
147-
[0.08, 0.94, 0.04, 0.02, 0.00, 0.01, 0.12, 0.04, 0.00],
148-
[0.01, 0.01, 0.79, 0.10, 0.00, 0.05, 0.00, 0.31, 0.00],
149-
[0.00, 0.02, 0.03, 0.38, 0.31, 0.31, 0.00, 0.59, 0.00],
150-
[0.02, 0.02, 0.11, 0.47, 0.69, 0.58, 0.88, 0.00, 0.00]],
151-
'With O3':
152-
[[0.89, 0.01, 0.07, 0.00, 0.00, 0.05, 0.00, 0.00, 0.03],
153-
[0.07, 0.95, 0.05, 0.04, 0.00, 0.02, 0.12, 0.00, 0.00],
154-
[0.01, 0.02, 0.86, 0.27, 0.16, 0.19, 0.00, 0.00, 0.00],
155-
[0.01, 0.03, 0.00, 0.32, 0.29, 0.27, 0.00, 0.00, 0.95],
156-
[0.02, 0.00, 0.03, 0.37, 0.56, 0.47, 0.87, 0.00, 0.00]],
157-
'CO & O3':
158-
[[0.87, 0.01, 0.08, 0.00, 0.00, 0.04, 0.00, 0.00, 0.01],
159-
[0.09, 0.95, 0.02, 0.03, 0.00, 0.01, 0.13, 0.06, 0.00],
160-
[0.01, 0.02, 0.71, 0.24, 0.13, 0.16, 0.00, 0.50, 0.00],
161-
[0.01, 0.03, 0.00, 0.28, 0.24, 0.23, 0.00, 0.44, 0.88],
162-
[0.02, 0.00, 0.18, 0.45, 0.64, 0.55, 0.86, 0.00, 0.16]]}
135+
data = [
136+
['Sulfate', 'Nitrate', 'EC', 'OC1', 'OC2', 'OC3', 'OP', 'CO', 'O3'],
137+
('Basecase', [
138+
[0.88, 0.01, 0.03, 0.03, 0.00, 0.06, 0.01, 0.00, 0.00],
139+
[0.07, 0.95, 0.04, 0.05, 0.00, 0.02, 0.01, 0.00, 0.00],
140+
[0.01, 0.02, 0.85, 0.19, 0.05, 0.10, 0.00, 0.00, 0.00],
141+
[0.02, 0.01, 0.07, 0.01, 0.21, 0.12, 0.98, 0.00, 0.00],
142+
[0.01, 0.01, 0.02, 0.71, 0.74, 0.70, 0.00, 0.00, 0.00]]),
143+
('With CO', [
144+
[0.88, 0.02, 0.02, 0.02, 0.00, 0.05, 0.00, 0.05, 0.00],
145+
[0.08, 0.94, 0.04, 0.02, 0.00, 0.01, 0.12, 0.04, 0.00],
146+
[0.01, 0.01, 0.79, 0.10, 0.00, 0.05, 0.00, 0.31, 0.00],
147+
[0.00, 0.02, 0.03, 0.38, 0.31, 0.31, 0.00, 0.59, 0.00],
148+
[0.02, 0.02, 0.11, 0.47, 0.69, 0.58, 0.88, 0.00, 0.00]]),
149+
('With O3', [
150+
[0.89, 0.01, 0.07, 0.00, 0.00, 0.05, 0.00, 0.00, 0.03],
151+
[0.07, 0.95, 0.05, 0.04, 0.00, 0.02, 0.12, 0.00, 0.00],
152+
[0.01, 0.02, 0.86, 0.27, 0.16, 0.19, 0.00, 0.00, 0.00],
153+
[0.01, 0.03, 0.00, 0.32, 0.29, 0.27, 0.00, 0.00, 0.95],
154+
[0.02, 0.00, 0.03, 0.37, 0.56, 0.47, 0.87, 0.00, 0.00]]),
155+
('CO & O3', [
156+
[0.87, 0.01, 0.08, 0.00, 0.00, 0.04, 0.00, 0.00, 0.01],
157+
[0.09, 0.95, 0.02, 0.03, 0.00, 0.01, 0.13, 0.06, 0.00],
158+
[0.01, 0.02, 0.71, 0.24, 0.13, 0.16, 0.00, 0.50, 0.00],
159+
[0.01, 0.03, 0.00, 0.28, 0.24, 0.23, 0.00, 0.44, 0.88],
160+
[0.02, 0.00, 0.18, 0.45, 0.64, 0.55, 0.86, 0.00, 0.16]])
161+
]
163162
return data
164163

165164

@@ -168,19 +167,19 @@ def example_data():
168167
theta = radar_factory(N, frame='polygon')
169168

170169
data = example_data()
171-
spoke_labels = data.pop('column names')
170+
spoke_labels = data.pop(0)
172171

173172
fig = plt.figure(figsize=(9, 9))
174173
fig.subplots_adjust(wspace=0.25, hspace=0.20, top=0.85, bottom=0.05)
175174

176175
colors = ['b', 'r', 'g', 'm', 'y']
177176
# Plot the four cases from the example data on separate axes
178-
for n, title in enumerate(data.keys()):
177+
for n, (title, case_data) in enumerate(data):
179178
ax = fig.add_subplot(2, 2, n + 1, projection='radar')
180179
plt.rgrids([0.2, 0.4, 0.6, 0.8])
181180
ax.set_title(title, weight='bold', size='medium', position=(0.5, 1.1),
182181
horizontalalignment='center', verticalalignment='center')
183-
for d, color in zip(data[title], colors):
182+
for d, color in zip(case_data, colors):
184183
ax.plot(theta, d, color=color)
185184
ax.fill(theta, d, facecolor=color, alpha=0.25)
186185
ax.set_varlabels(spoke_labels)

0 commit comments

Comments
 (0)