matplotlib / cheatsheets

Official Matplotlib cheat sheets

Home Page:https://matplotlib.org/cheatsheets/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error with legend locations?

zfasnacht1013 opened this issue · comments

Think there may be an error in your cheatsheet. The legend locations seem to be different than those in the matplotlib documentation:

https://matplotlib.org/3.2.1/api/_as_gen/matplotlib.pyplot.legend.html#:~:text=matplotlib.pyplot.legend%20%C2%B6%20%20%20%20Location%20String%20,%20%203%20%207%20more%20rows%20

I suppose the numbers are only intended as a link between the position and the string given below.

While one can use integers as location codes, that use is discouraged. It's also not easy to remember as the numbers jump a bit because you first count the corners then the edges the the center. Therefore, I would not show the location codes.

Possible fixes:

  • use lowercase letters on the inside (for the orange boxes)
  • alternatively, directly write the string at the postition.

There's a pending PR (#40) to fix that that still needs to be merged. I'll check it.

I found this quite confusing and frustrating too. If the code allows me to write "loc = 2" then I would have hoped that this corresponds to the "2" in the orange box. But no. I spoke about this with some co-workers, who had the same issue with the cheat sheet. Please consider changing this. Thank you!

Actually it has been fixed with #40 but it is not displayed yet. We now have an automated build that will upload the cheatsheets at the proper place.

With #69, this issue can probably be closed. The up-to-date cheatsheets and handouts are now shown in the README, and are available at https://matplotlib.org/cheatsheets/.