0

I recently resumed to work on a project and noticed that when I recreated a plot via matplotlib.pyplot, the default style has changed. This is a plot that was made earlier: The plot that was made before the change And this is how it currently produces plots: The plot that was made today I want to use the same style across all my plots, but changing all my old plots to this new style would take a lot of work. Is there a way I can change the style back to the old style? I just use the normal plot function without any parameters (except for the color of each line).

This is my code: (both plots were made with this code, the only difference is when it was run)

colors=['red', 'blue', 'green', 'yellow', 'cyan', 'black', 'gray', 'orange', 'brown']
for i in range(len(pos)):
    plt.plot(leps[i], pos[i], color=colors[i%len(colors)], label="k: "+str(cubes[i])[:3])
    plt.legend()
    plt.xlabel("number of elements")
    plt.ylabel("quality of classification")

plt.show()
2
  • Side note: you shouldn't go out of your way to use colours that are hostile to colourblind people. Matplotlib makes it a point to default to colours that are more suitable for audiences who might have colour deficiencies. This is especially true for colourmaps; I hope you don't also use jet (which is also bad for people without colourblindness). Commented Sep 10 at 14:15
  • Matplotlib's default style currently look like this: matplotlib.org/stable/users/explain/… The style change you are concerned about is likely coming from a local configuration setting somewhere. Commented Sep 10 at 15:02

1 Answer 1

1

Now the matplotlibs has changed to a bit modern style that is why you are seeing difference in the plots. Although you can still use the old style of plots using this line in your code -

plt.style.use('classic') 
Sign up to request clarification or add additional context in comments.

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.