user2242044
user2242044

Reputation: 9213

Setting color of stack plot line not working

I am trying to set the line color of a stack plot to white, but the solution I researched seems to not be working. What other options are there?

from matplotlib import pyplot as plt
y = [1,3,5]
x = [0,1,2]
fig, ax = plt.subplots()
ax.stackplot(x, y)
ax.fill_between(x, y, facecolor='#ededed')
plt.show()

Upvotes: 4

Views: 4717

Answers (2)

yeeking
yeeking

Reputation: 988

use edgecolor (I added a second stack to illustrate the white line):

from matplotlib import pyplot as plt
y = [[1,3,5], [3,4,5]]
x = [0,1,2]
fig, ax = plt.subplots()
ax.stackplot(x, y, edgecolor='white')
plt.show()

enter image description here

Upvotes: 1

Sede
Sede

Reputation: 61225

What about this:

ax.stackplot(x, y, color='b', colors=('red',))

enter image description here

Upvotes: 5

Related Questions