简体   繁体   中英

Connect markers in lineplot seaborn

I have a dataset as:

road,rate
DP,95.78
TR,95.02
SP,86.02
HD,45
SP_HD, 86

and I use seaborn to visualize a line plot like this:

def line_plot_compression_rate():
    label_text = pd.read_csv("comp_rate.csv")
    plot = sns.lineplot(x="road", y="rate", hue="road", style="road",
                        markers=True, data=label_text)

    plt.show()


line_plot_compression_rate()

Produced result:

在此处输入图像描述 How can I connect the markers with a line? Also, is it possible to enlarge the markers size?

This should do it:

plot = sns.lineplot(x="road", y="rate", data=df, sort=False)
sns.lineplot(x="road", y="rate", hue="road", style="road", hue_order=df.road,markers=True, data=df, ax=plot)
plt.show()

Figure:

在此处输入图像描述

And to change markers and line size :

paper_rc = {'lines.linewidth': 3, 'lines.markersize': 10}                  
sns.set_context("paper", rc = paper_rc) 

plot = sns.lineplot(x="road", y="rate", data=df, sort=False)
plot  = sns.lineplot(x="road", y="rate", hue="road", style="road",
             hue_order=df.road,markers=True,sizes=600,
             data=df, ax=plot)

Figure:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM