PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, June 28, 2022

[FIXED] Why does Seaborn lineplot "size" argument end up as legend artist?

 June 28, 2022     graph, matplotlib, plot, python, seaborn     No comments   

Issue

In a simple lineplot from Seaborn sample data, adding a "size" argument to control linewidth automatically adds an artist/handle to the legend generated from the "label" argument.

import seaborn as sns
from matplotlib import pyplot as plt

df = sns.load_dataset('geyser')

fig, ax = plt.subplots()

sns.lineplot(
    x=df.waiting,
    y=df.duration,
    label='Label',
    size=3,
    ax=ax
)
plt.show()

enter image description here

What is the reason for this behavior, and what can be done to prevent it?


Solution

Use the linewidth parameter to set the width of the line. The size parameter does something else. Check out the examples in the docs to see how to use it. The image below gives a good impression, and also makes it clear why the parameter results in a legend entry.

enter image description here



Answered By - mcsoini
Answer Checked By - Willingham (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing