0

I've never used stack overflow so please tell me if you need more of my code to figure out a solution

I want the y-label colours to be different. "Kjoeretoey i alt/Doedsfall" is the text on the y-label and I want "Kjoeretoey i alt" to be blue, "/" to be black and "Doedsfall" to be orange to seperate them from one another.

This is what Itried, it didn't work and I got the error message: File "", line 24 SyntaxError: positional argument follows keyword argument

gs = gridspec.GridSpec(2, 2)

pl.figure()
ax = pl.subplot(gs[0, 0]) # row 0, col 0
plt.plot(x, y, label='Kjoeretoey')
plt.xlabel("Ar")
#plt.ylabel is line 24
plt.ylabel("Kjoeretoey i alt", color='blue', "/", "Doedsfall", color='orange')
plt.legend()

ASTH
  • 1
  • 1
  • I don't think you can do that in a plot object. You can change the color of the axis line + corresponding label text, but changing the color of parts of the label text is something else. –  Jun 01 '22 at 12:04
  • I think this is what you are looking for. https://stackoverflow.com/questions/33159134/matplotlib-y-axis-label-with-multiple-colors – ashah Jun 01 '22 at 15:07

0 Answers0