Wykresy typu sns.relplot

In [3]:
import pandas as pd
import seaborn as sns

df2 = pd.read_csv('c:/8/dots2.txt')
df2.sample(8)
Out[3]:
align choice time coherence firing_rate
367 dots T2 540 3.2 37.178237
503 sacc T1 -80 51.2 61.654558
809 sacc T2 180 12.8 28.983229
472 sacc T1 -180 12.8 57.013895
55 dots T1 100 3.2 31.547619
566 sacc T1 140 6.4 24.388753
322 dots T2 340 6.4 41.525582
280 dots T2 200 6.4 42.994999
In [4]:
sns.set(style="dark")
In [5]:
df2['align'].value_counts()
Out[5]:
sacc    454
dots    394
Name: align, dtype: int64
In [6]:
df2['choice'].value_counts()
Out[6]:
T2    430
T1    418
Name: choice, dtype: int64
In [7]:
sns.relplot(x="time", y="firing_rate",hue="coherence", size="choice", col="align", kind="line", data=df2)
Out[7]:
<seaborn.axisgrid.FacetGrid at 0x189adf490f0>
In [8]:
df2['coherence'].value_counts()
Out[8]:
0.0     174
3.2     170
6.4     156
12.8    142
25.6    116
51.2     90
Name: coherence, dtype: int64

Odwrócenie osi

In [9]:
sns.relplot(x="time", y="firing_rate",hue="coherence", size="align", col="choice", kind="line", data=df2)
Out[9]:
<seaborn.axisgrid.FacetGrid at 0x189ae2beb70>
In [10]:
sns.set(style="whitegrid")
sns.relplot(x="time", y="firing_rate",hue="coherence", size="choice", col="align",height=6, aspect=.65,legend="full", palette="coolwarm", kind="line",data=df2)
Out[10]:
<seaborn.axisgrid.FacetGrid at 0x189adf49048>

Zanieczyszczenie chińskich miast

In [11]:
import pandas as pd
import seaborn as sns
import matplotlib as plt

df = pd.read_csv('c:/8/ShenyangPM20100101_20151231.csv')
df.head(3)
Out[11]:
No year month day hour season PM_Taiyuanjie PM_US Post PM_Xiaoheyan DEWP HUMI PRES TEMP cbwd Iws precipitation Iprec
0 1 2010 1 1 0 4 NaN NaN NaN -26.0 69.79 1024.0 -22.0 NE 1.0289 NaN NaN
1 2 2010 1 1 1 4 NaN NaN NaN -26.0 76.26 1024.0 -23.0 NE 2.5722 NaN NaN
2 3 2010 1 1 2 4 NaN NaN NaN -27.0 69.56 1023.0 -23.0 NE 5.1444 NaN NaN
In [12]:
df['cbwd'].value_counts()
Out[12]:
SW    18718
SE    12652
NW     8611
NE     8223
cv     3688
Name: cbwd, dtype: int64
In [14]:
df['winter/summer']= df['month'].apply(lambda x: " winter" if x < 4 or x > 10 else " summer ")
In [15]:
kot = ['pressure High','pressure Medium','pressure Low']
df['Pres_cat'] = pd.qcut(df['PRES'],3, labels=kot)
In [16]:
foka = ['humidity High','humidity Low']
df['HUMI_cat'] = pd.qcut(df['HUMI'],2, labels=foka)
In [18]:
sns.set(style="ticks")
sns.relplot(x="TEMP", y="PM_Taiyuanjie",hue="Pres_cat", size="HUMI_cat", col='winter/summer',size_order=["humidity High", "humidity Low"],height=5, aspect=0.75,palette="rocket_r",legend="full",kind="line",data=df)
Out[18]:
<seaborn.axisgrid.FacetGrid at 0x189ae703c18>