1

I have a plot that has two lines - I would like to change the color of both lines to something than what it currently is. My code below changes both lines to red and when I try to change the colors portion of the code to color=('red', 'blue'), I get the following error

ValueError: RGBA sequence should have length 3 or 4

Do you know how I can fix my code so I can set my first line to red and my second line to blue?

g3.plot(SZ_ED_TOT['Week'], SZ_ED_TOT['ESI_1_2_3'],SZ_ED_TOT['ESI_4_5'],color=('red'))
g3.set_title('SZ Acuity Count')
g3.tick_params(labelrotation=45)
g3.set_ylabel('Patient Count')
g3.set_xlabel('Week')
g3.legend(['ESI_1_2_3', 'ESI_4_5'],
          loc='upper right', frameon=False)

2 Answers 2

1
g3.plot(SZ_ED_TOT['Week'], SZ_ED_TOT['ESI_1_2_3'], color='blue')
g3.plot(SZ_ED_TOT['Week'], SZ_ED_TOT['ESI_4_5'], color='red')
Sign up to request clarification or add additional context in comments.

Comments

1
import matplotlib.pyplot as plt
import numpy as np

plt.gca().set_color_cycle(['blue', 'green'])

plt.plot(SZ_ED_TOT['Week'], SZ_ED_TOT['ESI_1_2_3'])

plt.plot(Z_ED_TOT['Week'], SZ_ED_TOT['ESI_4_5'])

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.