Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
569 views
in Technique[技术] by (71.8m points)

pandas - Same line colors on sns.lineplot

I have a task, trying to draw plot where x is year and y is the value of games, released this year. Also, I have information about game platforms. So I want to draw 10 different lines of 10 different colors. I need to do it via for cycle. If I draw it without hue param - lines have different colors, but if I add it, all lines become blue. Code is on screenshot via the link. Code

for platform in top10_platofrm_sales_dict:  
    sns.lineplot(
        data=pivot_top_10
        .query('platform == @platform and year_of_release !=0 '),
        x='year_of_release',
        y='name',
        hue = 'platform'
    )
    plt.gcf().set_size_inches(16, 8)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...