plotting multiple column data in the same ecdf plot using seaborn

93 views
Skip to first unread message

saikat ghosh

unread,
Nov 16, 2022, 2:39:31 PM11/16/22
to pvlib-python
Hi,

I want to add different legend to each line plot in the attached image. And also want to modify the axis titles.

How to do that ?

I am plotting ECDF for irradiance values using seaborn library.

The plot is attached. Code is written as follows-


from matplotlib import pyplot as plt
import pandas as pd

import seaborn as sns

amphancomb = pd.read_csv('amphancomb.csv')

sns.ecdfplot(amphancomb.Irradiance19May)
sns.ecdfplot(amphancomb.Irradiance21May)
sns.ecdfplot(amphancomb.Irradiance15May)


====
Actually the doubt is not related to pvlib, its related to python in general. Sorry if this post annoyed you.
 You can just tell me where can i get it solved.


Many thanks,
Figure 2022-11-17 010312.png
Capture.PNG

cwh...@sandia.gov

unread,
Nov 16, 2022, 2:55:14 PM11/16/22
to pvlib-python
I think you need to name each array like this:

snsecdfplot({'<legend label 1>': amphancomb.Irradiance19May, '<legend 2>': amphancomb.Irradiance21May, ...})

Jurand Bien

unread,
Nov 17, 2022, 3:05:37 AM11/17/22
to cwh...@sandia.gov, saika...@gmail.com, pvlib-python
Exactly is as Saika wrote. However in  seaborn.ecdfplot 

seaborn.ecdfplot(data=None*x=Noney=Nonehue=Noneweights=Nonestat='proportion'complementary=Falsepalette=Nonehue_order=Nonehue_norm=Nonelog_scale=Nonelegend=Trueax=None**kwargs

label is under **kwargs to specify line label. So you have two options you can add label in ecdfplot function as was proposed by Saika or put labels in legend function as below 

from matplotlib import pyplot as plt
import pandas as pd

import seaborn as sns

amphancomb = pd.read_csv('amphancomb.csv')
sns.ecdfplot(amphancomb.Irradiance19May)
sns.ecdfplot(amphancomb.Irradiance21May)
sns.ecdfplot(amphancomb.Irradiance15May)
plt.legend(labels = ['May 19','May 21','May 15'])

Regards
Jurand

--
You received this message because you are subscribed to the Google Groups "pvlib-python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pvlib-python...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pvlib-python/b9c795c5-6c3b-46ee-b93f-fa6f01a5e1bdn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages