Reputation: 2781
I'm plotting a grid of subplots (6x2) with matplotlib (version 1.3.1) and Python 2.7. I set up my figure and plot things in the subplots like this:
fig, axes = plt.subplots(ncols=6, nrows=2,
sharex=True, sharey=True, figsize=(30,5))
axes[0,0].plot(x, y)
axes[1,5].plot(z, a)
etc.
My question is this: is there a way to change the line properties on all of these plots at once? I could manually specify axes[0,0].plot(x,y,'k',linewidth=2.0)
on each of the axes, but I thought there must be a way to do it for all 12 plots at once.
Cheers.
Upvotes: 10
Views: 18768
Reputation: 332
In my Jupyter notebook I do
%matplotlib inline
# plt.style.use('fivethirtyeight') # first, small enchancements, xlabels, ylabels, legand sizing...
plt.rcParams['lines.linewidth'] = 2 # Change linewidth of plots
# plt.rcParams['figure.figsize'] = (12, 8) # Change the size of plots
Upvotes: 1
Reputation: 1169
Try this:
import matplotlib as mpl
mpl.rcParams['lines.linewidth'] = 2
This should dynamically change the default matplotlibrc configuration.
Edit: nevermind, already mentioned in the comments to your question.
Upvotes: 11