본문 바로가기

파이썬. 데이터분석/Matplotlib27

Matplotlib : 다중막대그래프 엑셀은 그냥 해주던데 matplotlib은 박스 각각 위치까지 지정해줘야 돼서 손이많이간다.seaborn으로도 안된다 https://jimmy-ai.tistory.com/40 [Matplotlib] 파이썬 다중 막대 그래프 그리기 예제 이번 글에서는 파이썬에서 다중 막대 그래프를 겹치지 않게 그리는 예제 코드를 살펴보도록 하겠습니다. 파이썬 plt 다중 막대 그래프 예제 코드 먼저, 다음과 같은 간단한 연도별 상점별 판매 jimmy-ai.tistory.com 2022. 10. 6.
matplotlib : 막대그래프 두께width 조절 https://www.python-graph-gallery.com/5-control-width-and-space-in-barplots Control width and space in barplots using matplotlib | The Python Graph Gallery Controlling the width of bars and space between bars in a barplot using matplotlib www.python-graph-gallery.com # library import matplotlib.pyplot as plt # create dataset height = [3, 12, 5, 18, 45] bars = ('A', 'B', 'C', 'D', 'E') # Choose th.. 2022. 10. 4.
subplot 예시 사이트 모음 파이썬 데이터분석의 가장 큰 강점이 subplot이라고 생각한다. 한 눈에 여러 그래프를 동시에 보여줘서 시각적인 효과가 좋다. 그러나 좋은만큼 코드짜기도 너무 어려워보인다. 며칠전에 강남 교보문고가서 파이썬 책은 다봤는데 subplot을 자세히 설명해주는 책은 정말 하나도 없어서 아쉬웠다..matplotlib의 꽃이라고 생각한다. 조만간 실무에서 활용하면서 부딪쳐볼것 같아서 미리 정리. https://codetorial.net/matplotlib/subplot.html Matplotlib 여러 개의 그래프 그리기 - Codetorial 예제2 import numpy as np import matplotlib.pyplot as plt x1 = np.linspace(0.0, 5.0) x2 = np.lins.. 2022. 10. 4.
가장 심플한 막대그래프 df.plot : 판다스 plot https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.plot.html pandas.DataFrame.plot — pandas 1.4.3 documentation Name to use for the xlabel on x-axis. Default uses index name as xlabel, or the x-column name for planar plots. Changed in version 1.2.0: Now applicable to planar plots (scatter, hexbin). pandas.pydata.org plot은 matplotlib import없이도 사용가능하지만, 도화지 자체가 matplotlib이다(Axes-level) .. 2022. 7. 22.
matplotlib : ax.tick_params stateless https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.tick_params.html matplotlib.axes.Axes.tick_params — Matplotlib 3.5.2 documentation Change the appearance of ticks, tick labels, and gridlines. Tick properties that are not explicitly set using the keyword arguments remain unchanged unless reset is True. Parameters axis{'x', 'y', 'both'}, default: 'both'The axis to which the.. 2022. 7. 21.
matplotlib : 전역설정(global) rcParams 정리 matplotlib 공식사이트 rcParam에 정리되어있다 https://matplotlib.org/stable/tutorials/introductory/customizing.html Customizing Matplotlib with style sheets and rcParams — Matplotlib 3.5.2 documentation Tips for customizing the properties and default styles of Matplotlib. Setting rcParams at runtime takes precedence over style sheets, style sheets take precedence over matplotlibrc files. The matplotlibrc fil.. 2022. 7. 21.
matplotlib bar : stateless방식 골떄리는게 plot의 매개변수는 rotation이라고하면 안되고 rot라고 해야되는데, set_ylabel 매개변수는 rotation이라고해야되고 rot라고하면 안된다. 복잡하다 참.. plt.figure(figsize=(15,7)) plt.style.use('ggplot') ax = df2.plot(kind='bar', rot=0, figsize=(16,8), ylim=[0, 3500] , title='quantity by prd type, size', stacked=True) ax.set_ylabel('sales_quantity') for c in ax.containers: labels = [v.get_height() if v.get_height() > 0 else '' for v in c] ax.b.. 2022. 7. 17.
★Matplotlib 매개변수 총정리 - stateless(ax.) ax.set_title('막대그래프', color='white', loc='left') ax.legend(bbox_to_anchor=(1.15, 1), fontsize=15) ax.set_ylabel('sales_quantity', rotation=45) xticks, yticks 1) #x축 tick기준 ax.set_xticks([10, 20, 30, 40]) #x축 tick명칭변경 및 폰트크기 설정 ax.set_xticklabels(['갑', '을', '병','정'], fontsize=15) #fontsize 조절만 하는게 안됨. 리스트로 된 범위(ex:[1, 2, 3])를 적어야만 작동이 됨 2) _, ylabels = plt.yticks() _, xlabels = plt.xticks() ax.se.. 2022. 7. 17.