Skip to content

DOC: update suptitle example to remove percent_bachelors_degrees csv #25467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 13 additions & 23 deletions galleries/examples/subplots_axes_and_figures/figure_title.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,21 @@
# A global x- or y-label can be set using the `.FigureBase.supxlabel` and
# `.FigureBase.supylabel` methods.

fig, axs = plt.subplots(3, 5, figsize=(8, 5), layout='constrained',
sharex=True, sharey=True)

fname = get_sample_data('percent_bachelors_degrees_women_usa.csv',
asfileobj=False)
gender_degree_data = np.genfromtxt(fname, delimiter=',', names=True)
def convertdate(x):
return np.datetime64(x, 'D')

majors = ['Health Professions', 'Public Administration', 'Education',
'Psychology', 'Foreign Languages', 'English',
'Art and Performance', 'Biology',
'Agriculture', 'Business',
'Math and Statistics', 'Architecture', 'Physical Sciences',
'Computer Science', 'Engineering']
fname = get_sample_data('Stocks.csv', asfileobj=False)
stocks = np.genfromtxt(fname, encoding='utf-8', delimiter=',',
names=True, dtype=None, converters={0: convertdate},
skip_header=1)

fig, axs = plt.subplots(4, 2, figsize=(9, 5), layout='constrained',
sharex=True, sharey=True)
for nn, ax in enumerate(axs.flat):
ax.set_xlim(1969.5, 2011.1)
column = majors[nn]
column_rec_name = column.replace('\n', '_').replace(' ', '_')

line, = ax.plot('Year', column_rec_name, data=gender_degree_data,
lw=2.5)
ax.set_title(column, fontsize='small', loc='left')
ax.set_ylim([0, 100])
ax.grid()
column_name = stocks.dtype.names[1+nn]
y = stocks[column_name]
line, = ax.plot(stocks['Date'], y / np.nanmax(y), lw=2.5)
ax.set_title(column_name, fontsize='small', loc='left')
fig.supxlabel('Year')
fig.supylabel('Percent Degrees Awarded To Women')

plt.show()
fig.supylabel('Stock price relative to max')

This file was deleted.