pandas.DataFrame.plot()그림 함수 상세 설명

우선 홈 페이지 의 DataFrame.plot()함수 보기

DataFrame.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,
        xerr=None,secondary_y=False, sort_columns=False, **kwds)
매개 변 수 는 다음 과 같 습 니 다.

Parameters:
x : label or position, default None#             

y : label or position, default None

kind : str
‘line' : line plot (default)#   
‘bar' : vertical bar plot#   
‘barh' : horizontal bar plot#     
‘hist' : histogram#   
‘box' : boxplot#   
‘kde' : Kernel Density Estimation plot#Kernel       ,        Kernel      
‘density' : same as ‘kde'
‘area' : area plot#     
‘pie' : pie plot#  
‘scatter' : scatter plot#        columns     
‘hexbin' : hexbin plot#     

ax : matplotlib axes object, default None#**  (axes,          )          matplotlib subplot  。      ,     matplotlib subplot**  ,         figure axes    (  :title,label,     )    figure axes,         。

subplots : boolean, default False#          
Make separate subplots for each column

sharex : boolean, default True if ax is None else False#     ,   x   ,  
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   ,  
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#      x 
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'#     ,    subplot  (   True)
Place legend on axis subplots

style : list or dict#            
matplotlib line style per column

logx : boolean, default False#  x        
Use log scaling on x axis
logy : boolean, default False
Use log scaling on y axis

loglog : boolean, default False#    x,y        
Use log scaling on both x and y axes

xticks : sequence#  x    ,    (    )
Values to use for the xticks

yticks : sequence#  y   ,    (    )
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 #    ,   DataFrame           matplotlib   。
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 #           ,        

secondary_y : boolean or sequence, default False ##     y ( y )
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
1.그림 그리 기

import pandas as pd 

from pandas import DataFrame,Series

df = pd.DataFrame(np.random.randn(4,4),index = list('ABCD'),columns=list('OPKL'))

df
Out[4]: 
     O     P     K     L
A -1.736654 0.327206 -1.000506 1.235681
B 1.216879 0.506565 0.889197 -1.478165
C 0.091957 -2.677410 -0.973761 0.123733
D -1.114622 -0.600751 -0.159181 1.041668
 
산 점도 scatter 는 Y 의 columns 인자 두 개 를 입력 해 야 합 니 다:
 
x,y 인자 입력
 
 
여러 개의 키 그림 을 동시에 그리 면 subplot=True 를 설정 할 수 있 습 니 다.
 
2.주의사항:
-그림 을 그 릴 때 는 그림 을 먼저 정의 하 는 캔버스 에 주의해 야 한다:fig=plt.figure()
-그리고 서브 맵 ax 를 정의 하고 x=fig.add 를 사용 합 니 다.subplot(줄,열,위치 표시)
-상기 절차 가 완료 되면 ax.plot()함수 나 df.plot(ax=ax)를 사용 할 수 있 습 니 다.
-Jupternotebook 에 서 는%로 정의 해 야 합 니 다.%matplotlib notebook;스 크 립 트 컴 파일 러 에 있 으 면 사용 하지 않 지만 한번에 절차 에 따라 코드 를 다 써 야 합 니 다.
-끝 날 때 plt.show()기록 에 주의

pandas.Data Frame.plot()그림 함수 에 대한 자세 한 설명 은 여기까지 입 니 다.더 많은 pandas.Data Frame.plot()그림 내용 은 저희 의 이전 글 을 검색 하거나 아래 의 관련 글 을 계속 찾 아 보 세 요.앞으로 도 많은 응원 부 탁 드 리 겠 습 니 다!

좋은 웹페이지 즐겨찾기