Reputation: 71
i have image containing 4 subplots:
#!/usr/bin/env python3
import matplotlib.pyplot as plt
f, axarr = plt.subplots(2, 2)
axarr[0,1].stem([1,3,-4],linefmt='b-', markerfmt='bs', basefmt='k-')
plt.show()
I want to change the linewidth of one plot (stem plot). Is there an easy way to do this?
Upvotes: 7
Views: 7852
Reputation: 124
The returned stemlines are a matplotlib LineCollection and you can change their format like so:
stem = plt.stem(x,y)
# stem[1] change stemlines
stem[1].set_linewidth(5)
stem[1].set_linestyles("dashed")
Upvotes: 1
Reputation: 2603
Here is my solution:
markerline, stemlines, baseline = plt.stem(x, y)
plt.setp(stemlines, 'linewidth', 3)
Upvotes: 12