用python画箱体图-python学习笔记21

简介: 用python画箱体图-python学习笔记21

函数:d.plot()

Type:           FramePlotMethods
String form:    <pandas.tools.plotting.FramePlotMethods object at 0x08FC8510>
File:           c:\program files (x86)\python35-32\lib\site-packages\pandas\tools\plotting.py
Signature:      d.plot(x=None, y=None, kind='line', ax=None, subplots=False, sharex=None, sharey=False, layout=None, figsize=None, use_index=True, title=None, grid=None, legend=True, style=None, logx=False, logy=False, loglog=False, xticks=None, yticks=None, xlim=None, ylim=None, rot=None, fontsize=None, colormap=None, table=False, yerr=None, xerr=None, secondary_y=False, sort_columns=False, **kwds)
Docstring:     
DataFrame plotting accessor and method
Examples
--------
df.plot.line()
df.plot.scatter('x', 'y')
df.plot.hexbin()
These plotting methods can also be accessed by calling the accessor as a
method with the ``kind`` argument:
``df.plot(kind='line')`` is equivalent to ``df.plot.line()``
Call docstring:
Make plots of DataFrame using matplotlib / pylab.
*New in version 0.17.0:* Each plot kind has a corresponding method on the
``DataFrame.plot`` accessor:
``df.plot(kind='line')`` is equivalent to
``df.plot.line()``.
Parameters
----------
data : DataFrame
x : label or position, default None
y : label or position, default None
    Allows plotting of one column versus another
kind : str
    - 'line' : line plot (default)
    - 'bar' : vertical bar plot
    - 'barh' : horizontal bar plot
    - 'hist' : histogram
    - 'box' : boxplot
    - 'kde' : Kernel Density Estimation plot
    - 'density' : same as 'kde'
    - 'area' : area plot
    - 'pie' : pie plot
    - 'scatter' : scatter plot
    - 'hexbin' : hexbin plot
ax : matplotlib axes object, default None
subplots : boolean, default False
    Make separate subplots for each column
sharex : boolean, default True if ax is None else False
    In case subplots=True, share x axis and set some x axis labels to
    invisible; defaults to True if ax is None otherwise False if an ax
    is passed in; Be aware, that passing in both an ax and sharex=True
    will alter all x axis labels for all axis in a figure!
sharey : boolean, default False
    In case subplots=True, share y axis and set some y axis labels to
    invisible
layout : tuple (optional)
    (rows, columns) for the layout of subplots
figsize : a tuple (width, height) in inches
use_index : boolean, default True
    Use index as ticks for x axis
title : string
    Title to use for the plot
grid : boolean, default None (matlab style default)
    Axis grid lines
legend : False/True/'reverse'
    Place legend on axis subplots
style : list or dict
    matplotlib line style per column
logx : boolean, default False
    Use log scaling on x axis
logy : boolean, default False
    Use log scaling on y axis
loglog : boolean, default False
    Use log scaling on both x and y axes
xticks : sequence
    Values to use for the xticks
yticks : sequence
    Values to use for the yticks
xlim : 2-tuple/list
ylim : 2-tuple/list
rot : int, default None
    Rotation for ticks (xticks for vertical, yticks for horizontal plots)
fontsize : int, default None
    Font size for xticks and yticks
colormap : str or matplotlib colormap object, default None
    Colormap to select colors from. If string, load colormap with that name
    from matplotlib.
colorbar : boolean, optional
    If True, plot colorbar (only relevant for 'scatter' and 'hexbin' plots)
position : float
    Specify relative alignments for bar plot layout.
    From 0 (left/bottom-end) to 1 (right/top-end). Default is 0.5 (center)
layout : tuple (optional)
    (rows, columns) for the layout of the plot
table : boolean, Series or DataFrame, default False
    If True, draw a table using the data in the DataFrame and the data will
    be transposed to meet matplotlib's default layout.
    If a Series or DataFrame is passed, use passed data to draw a table.
yerr : DataFrame, Series, array-like, dict and str
    See :ref:`Plotting with Error Bars <visualization.errorbars>` for
    detail.
xerr : same types as yerr.
stacked : boolean, default False in line and
    bar plots, and True in area plot. If True, create stacked plot.
sort_columns : boolean, default False
    Sort column names to determine plot ordering
secondary_y : boolean or sequence, default False
    Whether to plot on the secondary y-axis
    If a list/tuple, which columns to plot on secondary y-axis
mark_right : boolean, default True
    When using a secondary_y axis, automatically mark the column
    labels with "(right)" in the legend
kwds : keywords
    Options to pass to matplotlib plotting method
Returns
-------
axes : matplotlib.AxesSubplot or np.array of them
Notes
-----
- See matplotlib documentation online for more on this subject
- If `kind` = 'bar' or 'barh', you can specify relative alignments
  for bar plot layout by `position` keyword.
  From 0 (left/bottom-end) to 1 (right/top-end). Default is 0.5 (center)
- If `kind` = 'scatter' and the argument `c` is the name of a dataframe
  column, the values of that column are used to color each point.
- If `kind` = 'hexbin', you can control the size of the bins with the
  `gridsize` argument. By default, a histogram of the counts around each
  `(x, y)` point is computed. You can specify alternative aggregations
  by passing values to the `C` and `reduce_C_function` arguments.
  `C` specifies the value at each `(x, y)` point and `reduce_C_function`
  is a function of one argument that reduces all the values in a bin to
  a single number (e.g. `mean`, `max`, `sum`, `std`).
代码:
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
plt.figure(figsize=(8,6))#以上为模板
x=np.random.randn(1000)
d=pd.DataFrame([x,x+1]).T
d.plot(kind='box')


图形:

20161210221159608.png

目录
相关文章
|
1月前
|
网络协议 Java Linux
PyAV学习笔记(一):PyAV简介、安装、基础操作、python获取RTSP(海康)的各种时间戳(rtp、dts、pts)
本文介绍了PyAV库,它是FFmpeg的Python绑定,提供了底层库的全部功能和控制。文章详细讲解了PyAV的安装过程,包括在Windows、Linux和ARM平台上的安装步骤,以及安装中可能遇到的错误和解决方法。此外,还解释了时间戳的概念,包括RTP、NTP、PTS和DTS,并提供了Python代码示例,展示如何获取RTSP流中的各种时间戳。最后,文章还提供了一些附录,包括Python通过NTP同步获取时间的方法和使用PyAV访问网络视频流的技巧。
246 4
PyAV学习笔记(一):PyAV简介、安装、基础操作、python获取RTSP(海康)的各种时间戳(rtp、dts、pts)
|
1月前
|
Python
Socket学习笔记(二):python通过socket实现客户端到服务器端的图片传输
使用Python的socket库实现客户端到服务器端的图片传输,包括客户端和服务器端的代码实现,以及传输结果的展示。
140 3
Socket学习笔记(二):python通过socket实现客户端到服务器端的图片传输
|
1月前
|
JSON 数据格式 Python
Socket学习笔记(一):python通过socket实现客户端到服务器端的文件传输
本文介绍了如何使用Python的socket模块实现客户端到服务器端的文件传输,包括客户端发送文件信息和内容,服务器端接收并保存文件的完整过程。
154 1
Socket学习笔记(一):python通过socket实现客户端到服务器端的文件传输
|
1月前
|
关系型数据库 MySQL 数据库
Mysql学习笔记(四):Python与Mysql交互--实现增删改查
如何使用Python与MySQL数据库进行交互,实现增删改查等基本操作的教程。
67 1
|
1月前
|
Ubuntu Linux Python
Ubuntu学习笔记(六):ubuntu切换Anaconda和系统自带Python
本文介绍了在Ubuntu系统中切换Anaconda和系统自带Python的方法。方法1涉及编辑~/.bashrc和/etc/profile文件,更新Anaconda的路径。方法2提供了详细的步骤指导,帮助用户在Anaconda和系统自带Python之间进行切换。
90 1
|
1月前
|
索引 Python
Python学习笔记编程小哥令狐~持续更新、、、(上)
Python学习笔记编程小哥令狐~持续更新、、、(上)
51 2
|
1月前
|
存储 Python
Python学习笔记编程小哥令狐~持续更新、、、 (下)
Python学习笔记编程小哥令狐~持续更新、、、 (下)
33 1
|
1月前
|
存储 Python
【免费分享编程笔记】Python学习笔记(二)
【免费分享编程笔记】Python学习笔记(二)
42 0
【免费分享编程笔记】Python学习笔记(二)
|
1月前
|
Java 编译器 Go
Python学习笔记--- day01计算机基础和环境搭建(一)
Python学习笔记--- day01计算机基础和环境搭建(一)
|
1月前
|
程序员 编译器 Python
Python学习笔记--- day01计算机基础和环境搭建(二)
Python学习笔记--- day01计算机基础和环境搭建(二)
下一篇
无影云桌面