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.
Matplotlib allows you to adjust the line width of a graph plot using the linewidth attribute. If you want to make the line width of a graph plot thinner, then you can make linewidth less than 1, such as 0.5 or 0.25.
Linewidth: By default the linewidth is 1. For graphs with multiple lines it becomes difficult to trace the lines with lighter colors.
In the plot() method after declaring the linewidth parameter, you assign it to any number value you want to represent the desired width of your plot.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With