Last answered:

01 Apr 2024

Posted on:

28 Mar 2024

0

Resolved: Legend not displaying properly

Hi,

In the scatter plot, the "square" marker for the first class '0' is not displayed correctly in the legend. Please see attached image. What could be wrong?

Regards,

Dhaivat Parekh 

3 answers ( 1 marked as helpful)
Instructor
Posted on:

29 Mar 2024

0

Hey Dhaivat,


Thank you for reaching out!


Frankly, I'm not sure why this problem occurs. Could you please try switching the places of the markers? For example, could you experiment with ['^', ',', 'P'] or any other combination. You could also try substituting the square marker with any of the other markers listed on seaborn's website:

https://seaborn.pydata.org/tutorial/properties.html#marker

Does the problem persist?


If yes, then another possibility would be to access seaborn's legend property and use it to construct the legend, as suggested in the following Stackoverflow thread:

https://stackoverflow.com/questions/56027304/seaborn-scatterplot-legend-breaks-when-editing-with-plt-legend


Finally, could you tell me the versions of matplotlib and seaborn you are working with?


Kind regards,

365 Hristina

Posted on:

31 Mar 2024

0

Hi Hristina,

Issue resolved by choosing a different marker symbol! Thanks for the support!

Incidentally, the square marker has an 's' as the symbol, and comma (',') is not seen as a symbol of any marker. Maybe during an update, they have removed the comma string as any marker indication. Please check if you need to make any modifications in the lesson to eliminate use of comma string for any marker representation. Please see attached screenshot of the available marker strings as taken from the site https://seaborn.pydata.org/tutorial/properties.html#marker

Instructor
Posted on:

01 Apr 2024

0

Hey Dhaivat,


Thank you for the follow-up! We'll add this remark to the course as soon as possible.


Kind regards,

365 Hristina

Submit an answer