I am new to Python, pandas DataFrames and Seaborn. When I tried to understand Seaborn better, especially sns.lmplot, I came across the difference between two digits from the same data, which I thought should have looked the same, and I wonder why that is.
Data: My data is a pandas DataFrame that contains 454 rows and 19 columns. The data related to this question includes 4 columns and looks something like this:
Columns: Av_density; pred2; LOC; Year;
Variable Type: Continuous Variable; Continuous variable; Categorical variable 1 ... 4, categorical 2012 ... 2014
Missing data points missing.
My goal is to draw a 2x2 shape panel describing the relationship between Av_density and pred2 separately for each LOC (= location) with years marked in different colors. I call the seabed:
import seaborn as sns
sns.set(style="whitegrid")
np.random.seed(sum(map(ord, "linear_categorical")))
(Lateral point: for some reason, calling "linear_quantitative" does not work, that is, I get "File" stdin ", line 2 sns.lmplot (" Av_density "," pred2 ", Data, col =" LOC ", hue = "YEAR", col_wrap = 2);
^ SyntaxError : invalid syntax ")
Figure 1 method, FacetGrid + scatter:
sur=sns.FacetGrid(Data,col="LOC", col_wrap=2,hue="YEAR")
sur.map(plt.scatter, "Av_density", "pred2" );
plt.legend()
This gives a good spread of data for sure. You can see the image here: https://drive.google.com/file/d/0B7h2wsx9mUBScEdUbGRlRk5PV1E/view?usp=sharing
Figure 2 method, sns.lmplot:
sns.lmplot("Av_density", "pred2", Data, col="LOC", hue="YEAR", col_wrap=2);
, , LOC , , . , , lmplot , , , .
: https://drive.google.com/file/d/0B7h2wsx9mUBSRkN5ZXhBeW9ob1E/view?usp=sharing
, , "" datapoint lmplot. , , .
, , -, , , lmplot, ?
, !
-TA -
Ps. Python 2.7.8 Spyder 2.3.4
EDIT: " " , :
sur.map(plt.plot,"Av_density", "pred2" );
, lmplot.