import seaborn as sns
sns.set(style="ticks")
exercise = sns.load_dataset("exercise")
g = sns.factorplot(x="time", y="pulse", hue="kind", data=exercise)
In the plot above, if I specify scale as 0.5, it reduces line width but not width of confidence interval lines. Is there a way to reduce width of confidence interval lines?
If you want to change the width of all lines (except axes) in the plot, you can simply change the parameter "lines.linewidth"
in the matplotlib rcparam
through seaborns set
function. Simply add rc={"lines.linewidth":0.7}
as a parameter in your call of sns.set
. Likewise you can also change all (or at least most) of the default design options.
Example:
import seaborn as sns
sns.set(style="ticks", rc={"lines.linewidth": 0.7})
exercise = sns.load_dataset("exercise")
g = sns.factorplot(x="time", y="pulse", hue="kind", data=exercise)
This results in the following plot:
The original plot (without rc={"lines.linewidth":0.7}
) was:
You may get linewidth of first line and set it for all other lines of factor plot:
import seaborn as sns
import matplotlib.pylab as plt
sns.set(style="ticks")
exercise = sns.load_dataset("exercise")
g = sns.factorplot(x="time", y="pulse", hue="kind", data=exercise, scale=.5)
lw = g.ax.lines[0].get_linewidth() # lw of first line
plt.setp(g.ax.lines,linewidth=lw) # set lw for all lines of g axes
plt.show()
And you can set line width for every line in a cycle:
for l in g.ax.lines:
print(l.get_linewidth())
plt.setp(l,linewidth=5)
Output:
1.575
3.15
3.15
3.15
1.575
3.15
3.15
3.15
1.575
3.15
3.15
3.15
Bold lines are according to confidential intervals.
After set line width to 5 all lines became the same:
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