4

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()

2 Answers 2

5

What about this:

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

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.