Use of Common Graphics in Seaborn

Source: Internet
Author: User
Keywords seaborn seaborn tutorial seaborn python
Seaborn package is an enhanced version of Matplotlib, which needs to be installed before it can be used.
All graphics plt.show () to display, or use the create canvas below
fig,ax= plt.subplots () a canvas
fig,(ax1,ax2) =  plt.subplots (ncols = 2) two canvases
1) Single feature statistical chart countplot
sn.countplot ( train.mnth )#Discrete features can be used to describe the number of sample points.
2) Distplot of single feature statistics
sn.distplot ( train.cnt.values , bins = 50, KDE = true) ා continuous features can be used, bins = 50 is divided into 50 columns, KDE = true shows the core density line. If the tail of the figure is very special, it may be a singular point (outlier, noise point), consider removing it.
3) Double characteristic violin picture
sn.violinplot (data = train [['yr ','cnt']], x = "yr", y = "CNT"). The data distribution and its probability density are displayed. The thick black bar in the middle represents the quartile range, the fine black line extending from it represents the 95% confidence interval, and the white point is the median.
4) Double feature box
sn.boxplot (data = train, x = "yr, y =" CNT ") ා, also known as box graph, box graph or box line graph, is a statistical graph used to display a group of data dispersion information. It shows the order from top to bottom: abnormal value (may not exist), maximum value, upper quartile, median, lower quartile, minimum value, abnormal value (sometimes not, if any, pay special attention).
5) Double characteristic bar chart
fig,(ax1,ax2) =  plt.subplots (ncols = 2) one canvas, two axes
sn.barplot (data = train, x =, y =, CNT, hue =, ax = ax1) hue =, differentiate by weathersit
sn.barplot (data = train, x = workingday, y = cnt, hue = season, ax = AX2) × (hue = season), distinguished by season
6) Double characteristic line chart
fig,ax =  plt.subplots ()
sn.pointplot (data=train[['dayofyear','cnt', 'yr']],x='dayofyear',y='cnt',hue='yr',ax=ax)
#Hue ='yr 'refers to the year of distinction. Hue refers to color
ax.set (title="dayly distribution of counts")
plt.show ()
7) Relational thermograph
corrMatt = train[["temp","atemp","hum","windspeed","cnt"]].corr()
mask =  np.array (corrMatt)
mask[ np.tril_ indices_ from(mask)] = False
sn.heatmap (corrMatt, mask=mask,
vmax=1, square=True,annot=True)
plt.show ()
8) Double characteristic scatter
sn.scatterplot (x= train.GrLivArea Y= train.SalePrice )
plt.title ("looking for outliers") (drawing title)
plt.show ()
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.