check_circleMark as learned
Removing the legend in Matplotlib
schedule Mar 5, 2023Last updated
tocTable of Contentsexpand_more
Check out the interactive map of data science
To remove the legend in Matplotlib:
plt.plot([1,2,3])plt.plot([3,2,1])# Add the legendplt.legend(["my_blue", "my_orange"])# Remove the legendplt.gca().get_legend().remove()plt.show()
This gives you the following:
Notice how we don't have the legend since we deleted the one we added.
Published by Isshin Inada
Edited by 0 others
Did you find this page useful?
Ask a question or leave a feedback...
Enjoy our search
Hit / to insta-search docs and recipes!