乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      學(xué)習(xí)pandas下的dataframe畫圖參數(shù)

       imelee 2017-05-13
      [python] view plain copy
      1.   

      學(xué)習(xí)pandas數(shù)據(jù)框的繪圖,輕松搞定各種圖畫法。

      DataFrame.plot(x=Noney=Nonekind='line'ax=Nonesubplots=Falsesharex=Nonesharey=Falselayout=None,figsize=Noneuse_index=Truetitle=Nonegrid=Nonelegend=Truestyle=Nonelogx=Falselogy=False,loglog=Falsexticks=Noneyticks=Nonexlim=Noneylim=Nonerot=Nonefontsize=Nonecolormap=None,table=Falseyerr=Nonexerr=Nonesecondary_y=Falsesort_columns=False**kwds)

      Parameters:

      data : DataFrame

      x : label or position, default None#指數(shù)據(jù)框列的標(biāo)簽或位置參數(shù)

      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#Kernel 的密度估計(jì)圖,主要對(duì)柱狀圖添加Kernel 概率密度線
      • ‘density’ : same as ‘kde’
      • ‘a(chǎn)rea’ : area plot#不了解此圖
      • ‘pie’ : pie plot#餅圖
      • ‘scatter’ : scatter plot#散點(diǎn)圖
      • ‘hexbin’ : hexbin plot#不了解此圖

      ax : matplotlib axes object, default None#一個(gè)圖片切成不同片段,子圖對(duì)象

      subplots : boolean, default False#判斷圖片中是否有子圖

      Make separate subplots for each column

      sharex : boolean, default True if ax is None else False#如果有子圖,子圖共x軸刻度,標(biāo)簽

      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#如果有子圖,子圖共y軸刻度,標(biāo)簽

      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#默認(rèn)用索引做x軸

      Use index as ticks for x axis

      title : string#圖片的標(biāo)題用字符串

      Title to use for the plot

      grid : boolean, default None (matlab style default)#圖片是否有網(wǎng)格

      Axis grid lines

      legend : False/True/’reverse’#子圖的圖例

      Place legend on axis subplots

      style : list or dict#對(duì)每列折線圖設(shè)置線的類型

      matplotlib line style per column

      logx : boolean, default False#設(shè)置x軸刻度是否取對(duì)數(shù)

      Use log scaling on x axis

      logy : boolean, default False

      Use log scaling on y axis

      loglog : boolean, default False#同時(shí)設(shè)置x,y軸刻度是否取對(duì)數(shù)

      Use log scaling on both x and y axes

      xticks : sequence#設(shè)置x軸刻度值,序列形式(比如列表)

      Values to use for the xticks

      yticks : sequence#設(shè)置y軸刻度,序列形式(比如列表)

      Values to use for the yticks

      xlim : 2-tuple/list#設(shè)置坐標(biāo)軸的范圍,列表或元組形式

      ylim : 2-tuple/list

      rot : int, default None#設(shè)置軸標(biāo)簽(軸刻度)的顯示旋轉(zhuǎn)度數(shù)

      Rotation for ticks (xticks for vertical, yticks for horizontal plots)

      fontsize : int, default None#設(shè)置軸刻度的字體大小

      Font size for xticks and yticks

      colormap : str or matplotlib colormap object, default None#設(shè)置圖的區(qū)域顏色

      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 Plotting with Error Bars 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

      下面從http://pandas./pandas-docs/version/0.13.1/visualization.html的實(shí)例分析

      %matplotlib inlineimport numpy as npimport pandas as pdimport matplotlib.pyplot as pltplt.rc('figure', figsize=(5, 3))#設(shè)置圖片大小ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))ts = ts.cumsum()ts.plot()

       plt.figure(); ts.plot(style='k--', label='Series'); plt.legend()#創(chuàng)建個(gè)新圖片,在新圖片上畫ts的折線圖,并添加圖例

      [python] view plain copy
      1. df =pd.DataFrame(np.random.randn(1000, 4), index=ts.index, columns=list('ABCD'))   
      2. df = df.cumsum()  
      3. plt.figure(); df.plot(); plt.legend(loc='best')  

      [python] view plain copy
      1. df.plot(subplots=True, figsize=(6, 6)); plt.legend(loc='best')#對(duì)數(shù)據(jù)框相同索引分列分別作圖  


      [python] view plain copy
      1. plt.figure();  
      2. ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))  
      3. ts = np.exp(ts.cumsum())  
      4. ts.plot(logy=True) #對(duì)y軸進(jìn)行l(wèi)og(y)放縮,圖中y軸刻度依然是y的真實(shí)值,而不是log(y)  

      [python] view plain copy
      1. plt.figure()  
      2. df3 = pd.DataFrame(np.random.randn(1000, 2), columns=['B', 'C']).cumsum()  
      3. df3['A'] = pd.Series(list(range(len(df))))  
      4. df3.plot(x='A', y='B')#x,y分別設(shè)置x軸,y軸的列標(biāo)簽或列的位置  

      [python] view plain copy
      1. plt.figure()  
      2. df.A.plot()  
      3. df.B.plot(secondary_y=True, style='g')#設(shè)置第二個(gè)y軸(右y軸)  

      [python] view plain copy
      1. plt.figure()  
      2. ax = df.plot(secondary_y=['A', 'B'])#設(shè)置2個(gè)列軸,分別對(duì)各個(gè)列軸畫折線圖。ax(axes)可以理解為子圖,也可以理解成對(duì)黑板進(jìn)行切分,每一個(gè)板塊就是一個(gè)axes  
      3. ax.set_ylabel('CD scale')  
      4. ax.right_ax.set_ylabel('AB scale')  
      5. ax.legend(loc=2)#設(shè)置圖例的位置  
      6. plt.legend(loc=1)  



      [source]

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多