복잡한 데이터 표현하기¶
6-1. 객체지향 API로 그래프 꾸미기¶
- pyplot 방식과 객체지향 API 방식¶
In [4]:
import matplotlib.pyplot as plt
plt.rcParams['figure.dpi'] = 100
In [6]:
plt.plot([1,4,9,16])
plt.title('simple line graph')
plt.show()
In [8]:
fig, ax = plt.subplots()
ax.plot([1,4,9,16])
ax.set_title('simple line graph')
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/4206167288.py:4: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
In [10]:
plt.rcParams['font.family']
Out[10]:
['sans-serif']
In [12]:
plt.rcParams['font.family'] = 'NanumGothic'
In [14]:
plt.rc('font', family = 'NanumBarunGothic')
In [16]:
print(plt.rcParams['font.family'], plt.rcParams['font.size'])
['NanumBarunGothic'] 10.0
In [18]:
from matplotlib.font_manager import findSystemFonts
findSystemFonts()
Out[18]:
['/System/Library/Fonts/Supplemental/NotoSansBrahmi-Regular.ttf', '/System/Library/Fonts/Supplemental/Zapfino.ttf', '/System/Library/Fonts/Supplemental/NewPeninimMT.ttc', '/System/Library/Fonts/Supplemental/Muna.ttc', '/System/Library/Fonts/Supplemental/Arial Italic.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 달의궤도.ttf', '/System/Library/Fonts/ADTNumeric.ttc', '/System/Library/Fonts/Supplemental/NotoSansSyriac-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSerifAhom-Regular.ttf', '/Users/choiseungjae/Library/Fonts/NanumBarunGothicUltraLight.ttf', '/System/Library/Fonts/Supplemental/STIXIntUpDBol.otf', '/System/Library/Fonts/Geneva.ttf', '/Users/choiseungjae/Library/Fonts/BMHANNAAir_otf.otf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 장미체.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 갈맷글.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 꽃내음.ttf', '/Users/choiseungjae/Library/Fonts/NanumMyeongjoEco.ttf', '/System/Library/Fonts/Supplemental/Malayalam Sangam MN.ttc', '/System/Library/Fonts/Supplemental/NotoSansHanunoo-Regular.ttf', '/System/Library/Fonts/Supplemental/KufiStandardGK.ttc', '/System/Library/Fonts/SFNS.ttf', '/System/Library/Fonts/Supplemental/Gurmukhi Sangam MN.ttc', '/Users/choiseungjae/Library/Fonts/NanumSquare_acR.ttf', '/System/Library/Fonts/Supplemental/NotoSansMultani-Regular.ttf', '/System/Library/Fonts/Supplemental/Farisi.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 와일드.ttf', '/System/Library/Fonts/Supplemental/Andale Mono.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 고려글꼴.ttf', '/System/Library/Fonts/Supplemental/NotoSansRejang-Regular.ttf', '/System/Library/Fonts/Supplemental/Arial Bold Italic.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 여름글씨.ttf', '/System/Library/Fonts/Supplemental/Arial Rounded Bold.ttf', '/System/Library/Fonts/Supplemental/Arial Narrow Italic.ttf', '/System/Library/Fonts/Hiragino Sans GB.ttc', '/System/Library/Fonts/HelveticaNeue.ttc', '/System/Library/Fonts/Supplemental/Wingdings.ttf', '/System/Library/Fonts/Supplemental/NotoSansBassaVah-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 혁이체.ttf', '/System/Library/Fonts/Supplemental/NotoSansChakma-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 다진체.ttf', '/System/Library/Fonts/Supplemental/Times New Roman.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 아빠글씨.ttf', '/System/Library/Fonts/Supplemental/Silom.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 칼국수.ttf', '/System/Library/Fonts/Supplemental/SignPainter.ttc', '/System/Library/Fonts/Supplemental/Kailasa.ttc', '/System/Library/Fonts/Supplemental/Verdana Bold.ttf', '/System/Library/Fonts/Supplemental/NotoSansLinearB-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansTirhuta-Regular.ttf', '/System/Library/Fonts/SFCompactItalic.ttf', '/Users/choiseungjae/Library/Fonts/BMHANNAProOTF.otf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 점꼴체.ttf', '/System/Library/Fonts/Supplemental/Arial Bold.ttf', '/System/Library/Fonts/Supplemental/NotoSansMandaic-Regular.ttf', '/System/Library/Fonts/Supplemental/STIXNonUni.otf', '/Users/choiseungjae/Library/Fonts/NanumSquare_acEB.ttf', '/System/Library/Fonts/Supplemental/Arial.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 하나되어 손글씨.ttf', '/System/Library/Fonts/Supplemental/NotoSansSiddham-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 코코체.ttf', '/System/Library/Fonts/LastResort.otf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 다채사랑.ttf', '/Users/choiseungjae/Library/Fonts/NanumSquareNeo-eHv.ttf', '/Users/choiseungjae/Library/Fonts/BMEULJIRO.otf', '/System/Library/Fonts/ヒラギノ角ゴシック W8.ttc', '/System/Library/Fonts/Supplemental/NotoSansNabataean-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansWarangCiti-Regular.ttf', '/System/Library/Fonts/Supplemental/Ayuthaya.ttf', '/System/Library/Fonts/Supplemental/NotoSansMongolian-Regular.ttf', '/System/Library/Fonts/Supplemental/Didot.ttc', '/System/Library/Fonts/Supplemental/NotoSansOldItalic-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansOldPermic-Regular.ttf', '/System/Library/Fonts/Supplemental/Devanagari Sangam MN.ttc', '/System/Library/Fonts/SFGeorgianRounded.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 맛있는체.ttf', '/Users/choiseungjae/Library/Fonts/BMEuljirooraeoraeOTF.otf', '/System/Library/Fonts/Supplemental/Brush Script.ttf', '/System/Library/Fonts/Supplemental/Beirut.ttc', '/System/Library/Fonts/Supplemental/NotoSansLycian-Regular.ttf', '/Users/choiseungjae/Library/Fonts/NanumGothicEco.ttf', '/System/Library/Fonts/Supplemental/NotoSansMahajani-Regular.ttf', '/Users/choiseungjae/Library/Fonts/NanumGothicCoding.ttf', '/System/Library/Fonts/Supplemental/Nadeem.ttc', '/System/Library/Fonts/Supplemental/NotoSansMiao-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansBuhid-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 사랑해 아들.ttf', '/Users/choiseungjae/Library/Fonts/NanumGothicEcoExtraBold.ttf', '/System/Library/Fonts/ヒラギノ角ゴシック W9.ttc', '/System/Library/Fonts/Supplemental/Trebuchet MS Italic.ttf', '/System/Library/Fonts/Supplemental/Lao MN.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 아기사랑체.ttf', '/System/Library/Fonts/SFGeorgian.ttf', '/System/Library/Fonts/SFCompact.ttf', '/Users/choiseungjae/Library/Fonts/NanumBarunGothicLight.ttf', '/System/Library/Fonts/Supplemental/Verdana Bold Italic.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 효남 늘 화이팅.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 성실체.ttf', '/System/Library/Fonts/Supplemental/Bodoni 72.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 야채장수 백금례.ttf', '/System/Library/Fonts/Supplemental/NotoSansKaithi-Regular.ttf', '/System/Library/Fonts/Supplemental/Baskerville.ttc', '/System/Library/Fonts/Supplemental/PTSerif.ttc', '/System/Library/Fonts/Supplemental/NotoSansMendeKikakui-Regular.ttf', '/System/Library/Fonts/ヒラギノ明朝 ProN.ttc', '/System/Library/Fonts/ヒラギノ角ゴシック W6.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 대한민국 열사체.ttf', '/System/Library/Fonts/Supplemental/NotoSansSamaritan-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 느릿느릿체.ttf', '/System/Library/Fonts/Supplemental/Kefa.ttc', '/System/Library/Fonts/Supplemental/PTSans.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 철필글씨.ttf', '/System/Library/Fonts/Supplemental/Oriya Sangam MN.ttc', '/System/Library/Fonts/Supplemental/Hoefler Text Ornaments.ttf', '/System/Library/Fonts/Supplemental/NotoSansHanifiRohingya-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansSaurashtra-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 김유이체.ttf', '/System/Library/Fonts/Supplemental/Bodoni Ornaments.ttf', '/System/Library/Fonts/Supplemental/Khmer Sangam MN.ttf', '/System/Library/Fonts/Supplemental/Arial Black.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 따뜻한 작별.ttf', '/System/Library/Fonts/Supplemental/Arial Narrow Bold.ttf', '/Users/choiseungjae/Library/Fonts/BMKIRANGHAERANG-OTF.otf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 중학생.ttf', '/System/Library/Fonts/Apple Braille Pinpoint 6 Dot.ttf', '/System/Library/Fonts/Supplemental/Comic Sans MS.ttf', '/System/Library/Fonts/Supplemental/Chalkboard.ttc', '/System/Library/Fonts/Supplemental/Tamil Sangam MN.ttc', '/System/Library/Fonts/MarkerFelt.ttc', '/System/Library/Fonts/KohinoorBangla.ttc', '/System/Library/Fonts/Supplemental/NotoSansCypriot-Regular.ttf', '/System/Library/Fonts/Supplemental/Sana.ttc', '/System/Library/Fonts/Supplemental/GujaratiMT.ttc', '/System/Library/Fonts/Supplemental/NotoSansBamum-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansPauCinHau-Regular.ttf', '/System/Library/Fonts/Supplemental/STIXVar.otf', '/System/Library/Fonts/Supplemental/NotoSansTaiTham-Regular.ttf', '/System/Library/Fonts/Symbol.ttf', '/System/Library/Fonts/Supplemental/NotoSansKhudawadi-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 시우 귀여워.ttf', '/System/Library/Fonts/Supplemental/DecoTypeNaskh.ttc', '/System/Library/Fonts/Supplemental/NotoSansDuployan-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 세화체.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 따악단단.ttf', '/System/Library/Fonts/Supplemental/Damascus.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 비상체.ttf', '/System/Library/Fonts/Supplemental/Songti.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 희망누리.ttf', '/System/Library/Fonts/Supplemental/Tamil MN.ttc', '/System/Library/Fonts/Supplemental/STIXIntUpSmReg.otf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 열일체.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 다시 시작해.ttf', '/System/Library/Fonts/Supplemental/NotoSansTagalog-Regular.ttf', '/System/Library/Fonts/Supplemental/Diwan Kufi.ttc', '/Users/choiseungjae/Library/Fonts/NanumSquareRoundOTFL.otf', '/System/Library/Fonts/Supplemental/NotoSansKhojki-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 끄트머리체.ttf', '/System/Library/Fonts/Supplemental/Courier New.ttf', '/System/Library/Fonts/Supplemental/NotoSansPhagsPa-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 옥비체.ttf', '/System/Library/Fonts/Supplemental/STIXIntUpReg.otf', '/System/Library/Fonts/Supplemental/STIXGeneral.otf', '/System/Library/Fonts/Supplemental/NotoSansPahawhHmong-Regular.ttf', '/System/Library/Fonts/Supplemental/STIXTwoText-Italic.ttf', '/System/Library/Fonts/Supplemental/NotoSansMarchen-Regular.ttf', '/System/Library/Fonts/Monaco.ttf', '/System/Library/Fonts/Supplemental/Thonburi.ttc', '/System/Library/Fonts/Courier.ttc', '/System/Library/Fonts/Supplemental/NotoSansMasaramGondi-Regular.otf', '/System/Library/Fonts/Supplemental/DevanagariMT.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 아름드리 꽃나무.ttf', '/System/Library/Fonts/Apple Braille Outline 8 Dot.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 백의의 천사.ttf', '/System/Library/Fonts/Apple Braille Pinpoint 8 Dot.ttf', '/System/Library/Fonts/Supplemental/Waseem.ttc', '/System/Library/Fonts/GeezaPro.ttc', '/System/Library/Fonts/Supplemental/Myanmar Sangam MN.ttc', '/System/Library/Fonts/Supplemental/Luminari.ttf', '/System/Library/Fonts/STHeiti Light.ttc', '/System/Library/Fonts/Supplemental/NotoSansCaucasianAlbanian-Regular.ttf', '/System/Library/Fonts/Supplemental/Cochin.ttc', '/Users/choiseungjae/Library/Fonts/NanumBarunpenR.ttf', '/System/Library/Fonts/Supplemental/Mshtakan.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 상해찬미체.ttf', '/System/Library/Fonts/SFCamera.ttf', '/System/Library/Fonts/Supplemental/SnellRoundhand.ttc', '/Users/choiseungjae/Library/Fonts/NanumSquareRoundOTFB.otf', '/System/Library/Fonts/Supplemental/Mishafi Gold.ttf', '/System/Library/Fonts/Supplemental/NotoSansJavanese-Regular.otf', '/System/Library/Fonts/Supplemental/Impact.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 진주 박경아체.ttf', '/System/Library/Fonts/Supplemental/NotoSansLepcha-Regular.ttf', '/System/Library/Fonts/Supplemental/STIXIntSmBol.otf', '/System/Library/Fonts/SFHebrew.ttf', '/System/Library/Fonts/Supplemental/AlBayan.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 초딩희망.ttf', '/System/Library/Fonts/NotoSansArmenian.ttc', '/Users/choiseungjae/Library/Fonts/NanumMyeongjoEcoBold.ttf', '/System/Library/Fonts/Supplemental/NotoSerifNyiakengPuachueHmong-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansCarian-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansElbasan-Regular.ttf', '/Users/choiseungjae/Library/Fonts/NanumMyeongjoEcoExtraBold.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 규리의 일기.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 수줍은 대학생.ttf', '/System/Library/Fonts/Supplemental/STIXGeneralBolIta.otf', '/System/Library/Fonts/AquaKana.ttc', '/System/Library/Fonts/SFNSItalic.ttf', '/Users/choiseungjae/Library/Fonts/NanumBarunpenB.ttf', '/System/Library/Fonts/Supplemental/NotoSansHatran-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 기쁨밝음.ttf', '/Users/choiseungjae/Library/Fonts/NanumBarunGothic-YetHangul.ttf', '/System/Library/Fonts/Apple Symbols.ttf', '/System/Library/Fonts/Supplemental/NotoSansImperialAramaic-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansInscriptionalParthian-Regular.ttf', '/System/Library/Fonts/Supplemental/Corsiva.ttc', '/System/Library/Fonts/Supplemental/Bangla MN.ttc', '/System/Library/Fonts/Supplemental/Gurmukhi.ttf', '/System/Library/Fonts/Supplemental/STIXSizTwoSymReg.otf', '/Users/choiseungjae/Library/Fonts/NanumSquare_acB.ttf', '/Users/choiseungjae/Library/Fonts/NanumSquareNeo-dEb.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 무진장체.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 외할머니글씨 (1).ttf', '/System/Library/Fonts/Supplemental/Arial Narrow Bold Italic.ttf', '/System/Library/Fonts/Supplemental/Gurmukhi MN.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 아인맘 손글씨.ttf', '/System/Library/Fonts/Supplemental/STIXIntUpSmBol.otf', '/System/Library/Fonts/Supplemental/PTSerifCaption.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 정은체.ttf', '/System/Library/Fonts/Supplemental/NotoSansSundanese-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansMeeteiMayek-Regular.ttf', '/System/Library/Fonts/ヒラギノ角ゴシック W4.ttc', '/System/Library/Fonts/Helvetica.ttc', '/System/Library/Fonts/Supplemental/Webdings.ttf', '/System/Library/Fonts/ArialHB.ttc', '/System/Library/Fonts/Supplemental/Gujarati Sangam MN.ttc', '/System/Library/Fonts/Supplemental/NotoSansCuneiform-Regular.ttf', '/System/Library/Fonts/Supplemental/STIXIntSmReg.otf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 행복한 도비.ttf', '/System/Library/Fonts/Supplemental/NotoSansPhoenician-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansMro-Regular.ttf', '/System/Library/Fonts/Supplemental/Athelas.ttc', '/System/Library/Fonts/Supplemental/Mishafi.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 소미체.ttf', '/System/Library/Fonts/Supplemental/NotoSansUgaritic-Regular.ttf', '/System/Library/Fonts/Supplemental/ITFDevanagari.ttc', '/System/Library/Fonts/Supplemental/NotoSansOsmanya-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansWancho-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansOldSouthArabian-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 다행체.ttf', '/System/Library/Fonts/Supplemental/NotoSansAdlam-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 세아체.ttf', '/System/Library/Fonts/Supplemental/NotoSerifYezidi-Regular.otf', '/System/Library/Fonts/Supplemental/Arial Unicode.ttf', '/System/Library/Fonts/Supplemental/Trattatello.ttf', '/Users/choiseungjae/Library/Fonts/NanumBarunGothic.ttf', '/System/Library/Fonts/NotoNastaliq.ttc', '/System/Library/Fonts/Supplemental/Sinhala Sangam MN.ttc', '/System/Library/Fonts/Supplemental/NotoSansSylotiNagri-Regular.ttf', '/System/Library/Fonts/Supplemental/Courier New Bold Italic.ttf', '/System/Library/Fonts/Supplemental/Al Tarikh.ttc', '/System/Library/Fonts/Supplemental/Times New Roman Bold.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 흰꼬리수리.ttf', '/Users/choiseungjae/Library/Fonts/NanumSquareL.ttf', '/System/Library/Fonts/Supplemental/NotoSansOldTurkic-Regular.ttf', '/System/Library/Fonts/Supplemental/Telugu Sangam MN.ttc', '/System/Library/Fonts/Supplemental/Arial Narrow.ttf', '/System/Library/Fonts/Supplemental/NotoSansLinearA-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 신혼부부.ttf', '/System/Library/Fonts/Avenir.ttc', '/System/Library/Fonts/Supplemental/PlantagenetCherokee.ttf', '/System/Library/Fonts/Supplemental/Comic Sans MS Bold.ttf', '/System/Library/Fonts/Supplemental/Malayalam MN.ttc', '/System/Library/Fonts/Supplemental/Hoefler Text.ttc', '/System/Library/Fonts/Supplemental/STIXNonUniBol.otf', '/System/Library/Fonts/Supplemental/Verdana.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 미니 손글씨.ttf', '/System/Library/Fonts/Supplemental/Lao Sangam MN.ttf', '/Users/choiseungjae/Library/Fonts/NanumGothicEcoBold.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 아빠의 연애편지.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 안쌍체.ttf', '/System/Library/Fonts/Supplemental/NISC18030.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 금은보화.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 버드나무.ttf', '/System/Library/Fonts/Supplemental/Georgia Bold.ttf', '/System/Library/Fonts/Supplemental/Trebuchet MS.ttf', '/System/Library/Fonts/Supplemental/BigCaslon.ttf', '/System/Library/Fonts/Supplemental/NotoSansOldHungarian-Regular.ttf', '/System/Library/Fonts/Supplemental/STIXIntDBol.otf', '/System/Library/Fonts/Supplemental/STIXNonUniIta.otf', '/System/Library/Fonts/Apple Color Emoji.ttc', '/System/Library/Fonts/Supplemental/Kannada Sangam MN.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 부장님 눈치체.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 의미있는 한글.ttf', '/System/Library/Fonts/Supplemental/AppleGothic.ttf', '/System/Library/Fonts/Supplemental/Rockwell.ttc', '/System/Library/Fonts/Supplemental/NotoSansNewTaiLue-Regular.ttf', '/Users/choiseungjae/Library/Fonts/NanumMyeongjo-YetHangul.ttf', '/System/Library/Fonts/Supplemental/Times New Roman Bold Italic.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 잘하고 있어.ttf', '/Users/choiseungjae/Library/Fonts/NanumSquareNeo-cBd.ttf', '/System/Library/Fonts/Supplemental/STIXSizTwoSymBol.otf', '/System/Library/Fonts/Supplemental/NotoSansYi-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 나의 아내 손글씨.ttf', '/System/Library/Fonts/Supplemental/Courier New Italic.ttf', '/System/Library/Fonts/Supplemental/NotoSansKayahLi-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansGunjalaGondi-Regular.otf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 예당체.ttf', '/System/Library/Fonts/Supplemental/NotoSansAvestan-Regular.ttf', '/System/Library/Fonts/Noteworthy.ttc', '/System/Library/Fonts/NewYork.ttf', '/System/Library/Fonts/Supplemental/Savoye LET.ttc', '/System/Library/Fonts/Supplemental/NotoSansCoptic-Regular.ttf', '/System/Library/Fonts/NotoSansKannada.ttc', '/System/Library/Fonts/Supplemental/Galvji.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 한윤체.ttf', '/System/Library/Fonts/LucidaGrande.ttc', '/System/Library/Fonts/ヒラギノ角ゴシック W7.ttc', '/System/Library/Fonts/Supplemental/Myanmar MN.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 반짝반짝 별.ttf', '/System/Library/Fonts/Supplemental/STIXIntDReg.otf', '/System/Library/Fonts/Supplemental/Kannada MN.ttc', '/System/Library/Fonts/ヒラギノ角ゴシック W3.ttc', '/System/Library/Fonts/AppleSDGothicNeo.ttc', '/Users/choiseungjae/Library/Fonts/NanumSquare_acL.ttf', '/System/Library/Fonts/ThonburiUI.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 범솜체.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 대광유리.ttf', '/System/Library/Fonts/Supplemental/Phosphate.ttc', '/System/Library/Fonts/Supplemental/Academy Engraved LET Fonts.ttf', '/System/Library/Fonts/Supplemental/Iowan Old Style.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 강인한 위로.ttf', '/System/Library/Fonts/Supplemental/STIXIntUpBol.otf', '/System/Library/Fonts/Supplemental/STIXNonUniBolIta.otf', '/Users/choiseungjae/Library/Fonts/NanumSquareRoundOTFEB.otf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 아줌마 자유.ttf', '/System/Library/Fonts/SFArmenian.ttf', '/System/Library/Fonts/Supplemental/Krungthep.ttf', '/System/Library/Fonts/Supplemental/NotoSansGothic-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 엄마사랑.ttf', '/System/Library/Fonts/Supplemental/STIXSizFiveSymReg.otf', '/System/Library/Fonts/KohinoorGujarati.ttc', '/System/Library/Fonts/ヒラギノ丸ゴ ProN W4.ttc', '/System/Library/Fonts/ヒラギノ角ゴシック W2.ttc', '/System/Library/Fonts/Supplemental/STIXSizFourSymBol.otf', '/System/Library/Fonts/Supplemental/NotoSansLydian-Regular.ttf', '/System/Library/Fonts/Supplemental/STIXSizThreeSymReg.otf', '/System/Library/Fonts/Supplemental/Chalkduster.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 하람체.ttf', '/System/Library/Fonts/Supplemental/PTMono.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 북극성.ttf', '/System/Library/Fonts/Supplemental/Georgia Bold Italic.ttf', '/System/Library/Fonts/Supplemental/Tahoma Bold.ttf', '/System/Library/Fonts/Supplemental/InaiMathi-MN.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 마고체.ttf', '/System/Library/Fonts/Supplemental/NotoSansLisu-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 노력하는 동희.ttf', '/System/Library/Fonts/Supplemental/Marion.ttc', '/System/Library/Fonts/Supplemental/NotoSansOsage-Regular.ttf', '/System/Library/Fonts/Supplemental/Futura.ttc', '/System/Library/Fonts/Supplemental/Oriya MN.ttc', '/Users/choiseungjae/Library/Fonts/BMEuljiro10yearslaterOTF.otf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 몽돌.ttf', '/System/Library/Fonts/Supplemental/Khmer MN.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 곰신체.ttf', '/System/Library/Fonts/Supplemental/NotoSansModi-Regular.ttf', '/System/Library/Fonts/KohinoorTelugu.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 딸에게 엄마가.ttf', '/System/Library/Fonts/ZapfDingbats.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 암스테르담.ttf', '/System/Library/Fonts/Supplemental/NotoSansCham-Regular.ttf', '/System/Library/Fonts/SFCompactRounded.ttf', '/Users/choiseungjae/Library/Fonts/BMYEONSUNG_otf.otf', '/System/Library/Fonts/Supplemental/Papyrus.ttc', '/System/Library/Fonts/Apple Braille.ttf', '/System/Library/Fonts/Supplemental/NotoSansPalmyrene-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansBatak-Regular.ttf', '/Users/choiseungjae/Library/Fonts/NanumSquareB.ttf', '/System/Library/Fonts/Supplemental/Herculanum.ttf', '/System/Library/Fonts/Supplemental/Verdana Italic.ttf', '/Users/choiseungjae/Library/Fonts/BMJUA_otf.otf', '/System/Library/Fonts/ヒラギノ角ゴシック W5.ttc', '/System/Library/Fonts/Supplemental/NotoSansTifinagh-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 하나손글씨.ttf', '/System/Library/Fonts/NotoSansOriya.ttc', '/System/Library/Fonts/SFArabicRounded.ttf', '/System/Library/Fonts/Supplemental/Courier New Bold.ttf', '/System/Library/Fonts/Supplemental/Bradley Hand Bold.ttf', '/System/Library/Fonts/Supplemental/Bodoni 72 Smallcaps Book.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 유니 띵땅띵땅.ttf', '/System/Library/Fonts/Supplemental/Copperplate.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 우리딸 손글씨.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 가람연꽃.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 연지체.ttf', '/System/Library/Fonts/Supplemental/ChalkboardSE.ttc', '/System/Library/Fonts/Supplemental/STIXGeneralItalic.otf', '/System/Library/Fonts/Supplemental/DIN Alternate Bold.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 열아홉의 반짝임.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 손편지체.ttf', '/Users/choiseungjae/Library/Fonts/NanumSquareRoundOTFR.otf', '/System/Library/Fonts/Supplemental/GillSans.ttc', '/System/Library/Fonts/Supplemental/NotoSansBuginese-Regular.ttf', '/System/Library/Fonts/Supplemental/Charter.ttc', '/System/Library/Fonts/NewYorkItalic.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 엉겅퀴체.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 야근하는 김주임.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 나는 이겨낸다.ttf', '/System/Library/Fonts/Supplemental/Raanana.ttc', '/System/Library/Fonts/Supplemental/NotoSansSharada-Regular.ttf', '/System/Library/Fonts/Supplemental/EuphemiaCAS.ttc', '/System/Library/Fonts/Menlo.ttc', '/System/Library/Fonts/Supplemental/AmericanTypewriter.ttc', '/System/Library/Fonts/Supplemental/NotoSansPsalterPahlavi-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 자부심지우.ttf', '/System/Library/Fonts/Supplemental/Georgia.ttf', '/System/Library/Fonts/Avenir Next.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 세계적인 한글.ttf', '/System/Library/Fonts/Supplemental/Trebuchet MS Bold Italic.ttf', '/System/Library/Fonts/Supplemental/NotoSansTakri-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansTagbanwa-Regular.ttf', '/System/Library/Fonts/Supplemental/Al Nile.ttc', '/System/Library/Fonts/Supplemental/NotoSansInscriptionalPahlavi-Regular.ttf', '/System/Library/Fonts/Supplemental/Sinhala MN.ttc', '/System/Library/Fonts/SFArmenianRounded.ttf', '/System/Library/Fonts/SFNSMono.ttf', '/Users/choiseungjae/Library/Fonts/NanumSquareNeo-bRg.ttf', '/System/Library/Fonts/Supplemental/SuperClarendon.ttc', '/System/Library/Fonts/PingFang.ttc', '/System/Library/Fonts/Supplemental/Times New Roman Italic.ttf', '/System/Library/Fonts/Supplemental/Shree714.ttc', '/System/Library/Fonts/Supplemental/STIXVarBol.otf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 바른정신.ttf', '/System/Library/Fonts/Supplemental/Skia.ttf', '/System/Library/Fonts/MuktaMahee.ttc', '/System/Library/Fonts/Supplemental/NotoSansManichaean-Regular.ttf', '/System/Library/Fonts/NotoSerifMyanmar.ttc', '/System/Library/Fonts/ヒラギノ角ゴシック W0.ttc', '/System/Library/Fonts/Supplemental/DIN Condensed Bold.ttf', '/Users/choiseungjae/Library/Fonts/NanumBarunGothicBold.ttf', '/System/Library/Fonts/Supplemental/Bodoni 72 OS.ttc', '/System/Library/Fonts/Supplemental/STIXTwoText.ttf', '/System/Library/Fonts/SFArabic.ttf', '/System/Library/Fonts/Supplemental/NotoSansSoraSompeng-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansOlChiki-Regular.ttf', '/Users/choiseungjae/Library/Fonts/NanumGothicCoding-Bold.ttf', '/System/Library/Fonts/Supplemental/NotoSansTaiLe-Regular.ttf', '/System/Library/Fonts/Optima.ttc', '/System/Library/Fonts/Supplemental/NotoSansKharoshthi-Regular.ttf', '/System/Library/Fonts/Supplemental/STIXGeneralBol.otf', '/System/Library/Fonts/SFNSRounded.ttf', '/Users/choiseungjae/Library/Fonts/NanumSquareNeo-aLt.ttf', '/System/Library/Fonts/Supplemental/Wingdings 2.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 배은혜체.ttf', '/System/Library/Fonts/Supplemental/STIXSizThreeSymBol.otf', '/System/Library/Fonts/Supplemental/AppleMyungjo.ttf', '/System/Library/Fonts/Supplemental/STIXSizOneSymReg.otf', '/System/Library/Fonts/Palatino.ttc', '/System/Library/Fonts/Supplemental/NotoSansEgyptianHieroglyphs-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSerifBalinese-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansOldNorthArabian-Regular.ttf', '/System/Library/Fonts/Supplemental/Telugu MN.ttc', '/System/Library/Fonts/Supplemental/Bangla Sangam MN.ttc', '/System/Library/Fonts/Supplemental/NotoSansMeroitic-Regular.ttf', '/System/Library/Fonts/Supplemental/Wingdings 3.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 또박또박.ttf', '/System/Library/Fonts/Supplemental/Sathu.ttf', '/System/Library/Fonts/Supplemental/Trebuchet MS Bold.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 빵구니맘 손글씨.ttf', '/System/Library/Fonts/Supplemental/NotoSansNKo-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansLimbu-Regular.ttf', '/System/Library/Fonts/Supplemental/NotoSansThaana-Regular.ttf', '/System/Library/Fonts/Supplemental/Tahoma.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 바른히피.ttf', '/System/Library/Fonts/NotoSansMyanmar.ttc', '/System/Library/Fonts/ヒラギノ角ゴシック W1.ttc', '/System/Library/Fonts/Supplemental/NotoSansOldPersian-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 예쁜 민경체.ttf', '/System/Library/Fonts/Apple Braille Outline 6 Dot.ttf', '/System/Library/Fonts/Supplemental/STIXSizOneSymBol.otf', '/System/Library/Fonts/Kohinoor.ttc', '/System/Library/Fonts/Times.ttc', '/Users/choiseungjae/Library/Fonts/BMHANNA_11yrs_otf.otf', '/System/Library/Fonts/Supplemental/NotoSansCanadianAboriginal-Regular.otf', '/Users/choiseungjae/Library/Fonts/NanumSquareR.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 혜준체.ttf', '/System/Library/Fonts/STHeiti Medium.ttc', '/System/Library/Fonts/SFNSMonoItalic.ttf', '/Users/choiseungjae/Library/Fonts/BMDOHYEON_otf.otf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 할아버지의나눔.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 고딕 아니고 고딩.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 소방관의 기도.ttf', '/System/Library/Fonts/Supplemental/STIXSizFourSymReg.otf', '/System/Library/Fonts/Keyboard.ttf', '/System/Library/Fonts/Supplemental/Apple Chancery.ttf', '/Users/choiseungjae/Library/Fonts/NanumSquareEB.ttf', '/System/Library/Fonts/Supplemental/NotoSansGlagolitic-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 왼손잡이도 예뻐 (1).ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 무궁화.ttf', '/System/Library/Fonts/Supplemental/Georgia Italic.ttf', '/System/Library/Fonts/Supplemental/Kokonor.ttf', '/System/Library/Fonts/Supplemental/STIXIntUpDReg.otf', '/System/Library/Fonts/SFHebrewRounded.ttf', '/System/Library/Fonts/Supplemental/Farah.ttc', '/System/Library/Fonts/Supplemental/NotoSansTaiViet-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 힘내라는 말보단.ttf', '/Library/Fonts/Arial Unicode.ttf', '/System/Library/Fonts/Avenir Next Condensed.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 강부장님체.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 동화또박.ttf', '/System/Library/Fonts/Supplemental/NotoSansBhaiksuki-Regular.ttf', '/System/Library/Fonts/Supplemental/Microsoft Sans Serif.ttf', '/System/Library/Fonts/Supplemental/STIXTwoMath.otf', '/System/Library/Fonts/Supplemental/NotoSansNewa-Regular.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 나무정원.ttf', '/System/Library/Fonts/Supplemental/Diwan Thuluth.ttf', '/System/Library/Fonts/Supplemental/Baghdad.ttc', '/System/Library/Fonts/Supplemental/Seravek.ttc', '/Users/choiseungjae/Library/Fonts/나눔손글씨 둥근인연.ttf', '/System/Library/Fonts/Supplemental/NotoSansVai-Regular.ttf', '/System/Library/Fonts/Supplemental/PartyLET-plain.ttf', '/Users/choiseungjae/Library/Fonts/나눔손글씨 미래나무.ttf', '/System/Library/Fonts/Supplemental/SukhumvitSet.ttc']
In [20]:
plt.plot([1,4,9,16])
plt.title('간단한 선 그래프')
plt.show()
- 출판사별 발행 도서 개수 산점도 그리기¶
In [23]:
import pandas as pd
ns_book7 = pd.read_csv('ns_book7.csv', low_memory=False)
ns_book7.head()
Out[23]:
번호 | 도서명 | 저자 | 출판사 | 발행년도 | ISBN | 세트 ISBN | 부가기호 | 권 | 주제분류번호 | 도서권수 | 대출건수 | 등록일자 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 인공지능과 흙 | 김동훈 지음 | 민음사 | 2021 | 9788937444319 | NaN | NaN | NaN | NaN | 1 | 0 | 2021-03-19 |
1 | 2 | 가짜 행복 권하는 사회 | 김태형 지음 | 갈매나무 | 2021 | 9791190123969 | NaN | NaN | NaN | NaN | 1 | 0 | 2021-03-19 |
2 | 3 | 나도 한 문장 잘 쓰면 바랄 게 없겠네 | 김선영 지음 | 블랙피쉬 | 2021 | 9788968332982 | NaN | NaN | NaN | NaN | 1 | 0 | 2021-03-19 |
3 | 4 | 예루살렘 해변 | 이도 게펜 지음, 임재희 옮김 | 문학세계사 | 2021 | 9788970759906 | NaN | NaN | NaN | NaN | 1 | 0 | 2021-03-19 |
4 | 5 | 김성곤의 중국한시기행 : 장강·황하 편 | 김성곤 지음 | 김영사 | 2021 | 9788934990833 | NaN | NaN | NaN | NaN | 1 | 0 | 2021-03-19 |
In [29]:
top30_pubs = ns_book7['출판사'].value_counts()[:30]
top30_pubs
Out[29]:
출판사 문학동네 4410 민음사 3349 김영사 3246 웅진씽크빅 3227 시공사 2685 창비 2469 문학과지성사 2064 위즈덤하우스 1981 학지사 1877 한울 1553 한국학술정보 1496 열린책들 1491 살림출판사 1479 한길사 1460 博英社 1458 커뮤니케이션북스 1445 지식을만드는지식 1390 자음과모음 1364 비룡소 1331 랜덤하우스코리아 1314 넥서스 1310 황금가지 1101 길벗 1094 시그마프레스 1063 현암사 1054 다산북스 1046 집문당 1038 책세상 1037 한국문화사 1028 북이십일 21세기북스 1026 Name: count, dtype: int64
In [37]:
top30_pubs_idx = ns_book7['출판사'].isin(top30_pubs.index)
top30_pubs_idx
Out[37]:
0 True 1 False 2 False 3 False 4 True ... 376765 False 376766 False 376767 True 376768 False 376769 False Name: 출판사, Length: 376770, dtype: bool
In [39]:
top30_pubs_idx.sum()
Out[39]:
51886
In [41]:
ns_book8 = ns_book7[top30_pubs_idx].sample(1000, random_state=42)
ns_book8.head()
Out[41]:
번호 | 도서명 | 저자 | 출판사 | 발행년도 | ISBN | 세트 ISBN | 부가기호 | 권 | 주제분류번호 | 도서권수 | 대출건수 | 등록일자 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
141760 | 155786 | 제갈량 문집 | 제갈량 지음 ;조영래 옮김 | 지식을만드는지식 | 2012 | 9788966805785 | NaN | 0 | 10 | 808 | 1 | 2 | 2013-04-10 |
249855 | 268595 | 존 레넌을 찾아서 | 토니 파슨스 지음;이은정 옮김 | 시공사 | 2007 | 9788952750419 | NaN | 0 | NaN | 843 | 1 | 18 | 2007-12-14 |
129347 | 142802 | 요리사 & 쇼핑호스트 :생활과학 계열·예체능 계열 | 와이즈멘토 글 ;김성희 그림 | 김영사 | 2013 | 9788934959854 | 9788934959717 | 7 | 14 | 321.55 | 1 | 3 | 2013-12-09 |
349194 | 371975 | 임정섭의 글쓰기 훈련소 | 임정섭 지음 | 다산북스 | 2017 | 9791130614472 | NaN | NaN | NaN | NaN | 1 | 0 | 1970-01-01 |
46734 | 51748 | 초한지 :이문열의 史記 이야기 | 지은이: 이문열 | 민음사 | 2017 | 9788937481659 | 9788937481581 | 0 | 7 | 813.6 | 1 | 9 | 2018-07-02 |
In [43]:
fig, ax = plt.subplots(figsize=(10, 8))
ax.scatter(ns_book8['발행년도'], ns_book8['출판사'])
ax.set_title('출판사별 발행 도서')
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/3159405437.py:4: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
In [45]:
fig, ax = plt.subplots(figsize=(10, 8))
ax.scatter(ns_book8['발행년도'], ns_book8['출판사'], s=ns_book8['대출건수'])
ax.set_title('출판사별 발행 도서')
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/3683514688.py:4: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
In [61]:
fig, ax = plt.subplots(figsize=(10,8))
sc = ax.scatter(ns_book8['발행년도'], ns_book8['출판사'], linewidths=0.5, edgecolors='k', alpha=0.3, s=ns_book8['대출건수']*2, c=ns_book8['대출건수'])
ax.set_title('출판사별 발행 도서')
fig.colorbar(sc)
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/2333956413.py:5: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
In [63]:
fig, ax = plt.subplots(figsize=(10, 8))
sc = ax.scatter(ns_book8['발행년도'], ns_book8['출판사'], linewidths=0.5, edgecolors='k', alpha=0.3, s=ns_book8['대출건수']**1.3, c=ns_book8['대출건수'], cmap='jet')
ax.set_title('출판사별 발행 도서')
fig.colorbar(sc)
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/2722788391.py:5: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
6-2. 맷플롯립의 고급 기능 배우기¶
- 실습 준비하기¶
In [67]:
import matplotlib.pyplot as plt
plt.rc('font', family='NanumBarunGothic')
plt.rcParams['figure.dpi'] = 100
In [69]:
import pandas as pd
ns_book7 = pd.read_csv('ns_book7.csv', low_memory=False)
ns_book7.head()
Out[69]:
번호 | 도서명 | 저자 | 출판사 | 발행년도 | ISBN | 세트 ISBN | 부가기호 | 권 | 주제분류번호 | 도서권수 | 대출건수 | 등록일자 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 인공지능과 흙 | 김동훈 지음 | 민음사 | 2021 | 9788937444319 | NaN | NaN | NaN | NaN | 1 | 0 | 2021-03-19 |
1 | 2 | 가짜 행복 권하는 사회 | 김태형 지음 | 갈매나무 | 2021 | 9791190123969 | NaN | NaN | NaN | NaN | 1 | 0 | 2021-03-19 |
2 | 3 | 나도 한 문장 잘 쓰면 바랄 게 없겠네 | 김선영 지음 | 블랙피쉬 | 2021 | 9788968332982 | NaN | NaN | NaN | NaN | 1 | 0 | 2021-03-19 |
3 | 4 | 예루살렘 해변 | 이도 게펜 지음, 임재희 옮김 | 문학세계사 | 2021 | 9788970759906 | NaN | NaN | NaN | NaN | 1 | 0 | 2021-03-19 |
4 | 5 | 김성곤의 중국한시기행 : 장강·황하 편 | 김성곤 지음 | 김영사 | 2021 | 9788934990833 | NaN | NaN | NaN | NaN | 1 | 0 | 2021-03-19 |
- 하나의 피겨에 여러 개의 선 그래프 그리기¶
In [80]:
top30_pubs = ns_book7['출판사'].value_counts()[:30]
top30_pubs_idx = ns_book7['출판사'].isin(top30_pubs.index)
In [82]:
ns_book9 = ns_book7[top30_pubs_idx][['출판사', '발행년도', '대출건수']]
In [86]:
ns_book9 = ns_book9.groupby(by=['출판사', '발행년도']).sum()
ns_book9
Out[86]:
대출건수 | ||
---|---|---|
출판사 | 발행년도 | |
博英社 | 1947 | 0 |
1975 | 0 | |
1977 | 0 | |
1986 | 1 | |
1987 | 1 | |
... | ... | ... |
황금가지 | 2018 | 200 |
2019 | 133 | |
2020 | 98 | |
2021 | 1 | |
2030 | 2 |
886 rows × 1 columns
In [90]:
ns_book9 = ns_book9.reset_index()
ns_book9[ns_book9['출판사'] == '황금가지'].head()
Out[90]:
index | 출판사 | 발행년도 | 대출건수 | |
---|---|---|---|---|
858 | 858 | 황금가지 | 1995 | 0 |
859 | 859 | 황금가지 | 1996 | 67 |
860 | 860 | 황금가지 | 1997 | 116 |
861 | 861 | 황금가지 | 1998 | 526 |
862 | 862 | 황금가지 | 1999 | 505 |
In [92]:
line1 = ns_book9[ns_book9['출판사'] == '황금가지']
line2 = ns_book9[ns_book9['출판사'] == '비룡소']
In [94]:
fig, ax = plt.subplots(figsize=(8,6))
ax.plot(line1['발행년도'], line1['대출건수'])
ax.plot(line2['발행년도'], line2['대출건수'])
ax.set_title('연도별 대출건수')
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/1066847881.py:5: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
In [96]:
fig, ax = plt.subplots(figsize=(8,6))
ax.plot(line1['발행년도'], line1['대출건수'], label='황금가지')
ax.plot(line2['발행년도'], line2['대출건수'], label='비룡소')
ax.set_title('연도별 대출건수')
ax.legend()
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/706184714.py:6: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
In [98]:
fig, ax = plt.subplots(figsize=(8,6))
for pub in top30_pubs.index[:5]:
line = ns_book9[ns_book9['출판사'] == pub]
ax.plot(line['발행년도'], line['대출건수'], label=pub)
ax.set_title('연도별 대출건수')
ax.legend()
ax.set_xlim(1985, 2025)
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/2828489315.py:8: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
In [102]:
ns_book10 = ns_book9.pivot_table(index='출판사', columns='발행년도')
ns_book10.head()
Out[102]:
index | ... | 대출건수 | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
발행년도 | 1947 | 1974 | 1975 | 1976 | 1977 | 1978 | 1979 | 1980 | 1981 | 1982 | ... | 2013 | 2014 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2030 |
출판사 | |||||||||||||||||||||
博英社 | 0.0 | NaN | 1.0 | NaN | 2.0 | NaN | NaN | NaN | NaN | NaN | ... | NaN | 118.0 | 57.0 | 47.0 | 2.0 | 8.0 | NaN | 1.0 | NaN | NaN |
길벗 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 1162.0 | 1619.0 | 1410.0 | 1597.0 | 1626.0 | 1004.0 | 773.0 | 292.0 | 12.0 | NaN |
김영사 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | 64.0 | 65.0 | 66.0 | ... | 1905.0 | 1881.0 | 2726.0 | 2647.0 | 1094.0 | 1602.0 | 533.0 | 332.0 | 30.0 | NaN |
넥서스 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 1828.0 | 1429.0 | 765.0 | 1146.0 | 932.0 | 565.0 | 90.0 | 15.0 | 0.0 | NaN |
다산북스 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 1100.0 | 1361.0 | 1321.0 | 1137.0 | 1249.0 | 773.0 | 530.0 | 127.0 | 13.0 | NaN |
5 rows × 100 columns
In [108]:
ns_book10.columns[:10]
Out[108]:
MultiIndex([('index', 1947), ('index', 1974), ('index', 1975), ('index', 1976), ('index', 1977), ('index', 1978), ('index', 1979), ('index', 1980), ('index', 1981), ('index', 1982)], names=[None, '발행년도'])
In [120]:
top10_pubs = top30_pubs.index[:10]
year_cols = ns_book10.columns.get_level_values(1)
In [122]:
fig, ax =plt.subplots(figsize=(8,6))
ax.stackplot(year_cols, ns_book10.loc[top10_pubs].fillna(0), labels=top10_pubs)
ax.set_title('연도별 대출건수')
ax.legend(loc='upper left')
ax.set_xlim(1985, 2025)
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/527371967.py:6: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
- 하나의 피겨에 여러 개의 막대 그래프 그리기¶
In [129]:
fig, ax = plt.subplots(figsize=(8,6))
ax.bar(line1['발행년도'], line1['대출건수'], label='황금가지')
ax.bar(line2['발행년도'], line2['대출건수'], label='비룡소')
ax.set_title('연도별 대출건수')
ax.legend()
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/3258894927.py:6: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
In [131]:
fig, ax = plt.subplots(figsize=(8,6))
ax.bar(line1['발행년도']-0.2, line1['대출건수'], width=0.4, label='황금가지')
ax.bar(line2['발행년도']+0.2, line2['대출건수'], width=0.4, label='비룡소')
ax.set_title('연도별 대출건수')
ax.legend()
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/378096975.py:6: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
In [133]:
height1 = [5, 4, 7, 9, 8]
height2 = [3, 2, 4, 1, 2]
plt.bar(range(5), height1, width=0.5)
plt.bar(range(5), height2, bottom = height1, width=0.5)
plt.show()
In [147]:
height3 = [a + b for a, b in zip(height1, height2)]
plt.bar(range(5), height3, width=0.5)
plt.bar(range(5), height1, width=0.5)
plt.show()
In [151]:
ns_book10.loc[top10_pubs[:5], ('대출건수',2013):('대출건수',2020)]
Out[151]:
대출건수 | ||||||||
---|---|---|---|---|---|---|---|---|
발행년도 | 2013 | 2014 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 |
출판사 | ||||||||
문학동네 | 6919.0 | 4904.0 | 4201.0 | 5301.0 | 4529.0 | 2306.0 | 1340.0 | 645.0 |
민음사 | 2219.0 | 4805.0 | 1907.0 | 1571.0 | 2782.0 | 1559.0 | 998.0 | 552.0 |
김영사 | 1905.0 | 1881.0 | 2726.0 | 2647.0 | 1094.0 | 1602.0 | 533.0 | 332.0 |
웅진씽크빅 | 3293.0 | 2072.0 | 1529.0 | 1029.0 | 1032.0 | 762.0 | 159.0 | 26.0 |
시공사 | 2433.0 | 1512.0 | 1745.0 | 1787.0 | 1287.0 | 566.0 | 322.0 | 221.0 |
In [153]:
ns_book10.loc[top10_pubs[:5], ('대출건수',2013):('대출건수',2020)].cumsum()
Out[153]:
대출건수 | ||||||||
---|---|---|---|---|---|---|---|---|
발행년도 | 2013 | 2014 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 |
출판사 | ||||||||
문학동네 | 6919.0 | 4904.0 | 4201.0 | 5301.0 | 4529.0 | 2306.0 | 1340.0 | 645.0 |
민음사 | 9138.0 | 9709.0 | 6108.0 | 6872.0 | 7311.0 | 3865.0 | 2338.0 | 1197.0 |
김영사 | 11043.0 | 11590.0 | 8834.0 | 9519.0 | 8405.0 | 5467.0 | 2871.0 | 1529.0 |
웅진씽크빅 | 14336.0 | 13662.0 | 10363.0 | 10548.0 | 9437.0 | 6229.0 | 3030.0 | 1555.0 |
시공사 | 16769.0 | 15174.0 | 12108.0 | 12335.0 | 10724.0 | 6795.0 | 3352.0 | 1776.0 |
In [157]:
ns_book12 = ns_book10.loc[top10_pubs].cumsum()
ns_book12
Out[157]:
index | ... | 대출건수 | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
발행년도 | 1947 | 1974 | 1975 | 1976 | 1977 | 1978 | 1979 | 1980 | 1981 | 1982 | ... | 2013 | 2014 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2030 |
출판사 | |||||||||||||||||||||
문학동네 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 6919.0 | 4904.0 | 4201.0 | 5301.0 | 4529.0 | 2306.0 | 1340.0 | 645.0 | 18.0 | NaN |
민음사 | NaN | 246.0 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 9138.0 | 9709.0 | 6108.0 | 6872.0 | 7311.0 | 3865.0 | 2338.0 | 1197.0 | 25.0 | NaN |
김영사 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | 64.0 | 65.0 | 66.0 | ... | 11043.0 | 11590.0 | 8834.0 | 9519.0 | 8405.0 | 5467.0 | 2871.0 | 1529.0 | 55.0 | NaN |
웅진씽크빅 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 14336.0 | 13662.0 | 10363.0 | 10548.0 | 9437.0 | 6229.0 | 3030.0 | 1555.0 | NaN | NaN |
시공사 | NaN | NaN | NaN | NaN | NaN | NaN | 352.0 | NaN | NaN | NaN | ... | 16769.0 | 15174.0 | 12108.0 | 12335.0 | 10724.0 | 6795.0 | 3352.0 | 1776.0 | 60.0 | NaN |
창비 | NaN | NaN | NaN | 566.0 | 567.0 | 568.0 | NaN | NaN | NaN | 635.0 | ... | 18356.0 | 17046.0 | 13519.0 | 14515.0 | 12459.0 | 7947.0 | 4120.0 | 2313.0 | 72.0 | NaN |
문학과지성사 | NaN | NaN | NaN | NaN | 739.0 | NaN | 525.0 | NaN | 239.0 | NaN | ... | 19641.0 | 18092.0 | 14393.0 | 15670.0 | 13046.0 | 8418.0 | 4450.0 | 2464.0 | 77.0 | NaN |
위즈덤하우스 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 21702.0 | 20617.0 | 16777.0 | 17631.0 | 14542.0 | 9312.0 | 5123.0 | 2829.0 | 100.0 | NaN |
학지사 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 22574.0 | 21550.0 | 17303.0 | 18271.0 | 15015.0 | 9463.0 | 5182.0 | 2844.0 | NaN | NaN |
한울 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 23220.0 | 21622.0 | 17411.0 | 18276.0 | 15030.0 | 9484.0 | NaN | NaN | NaN | NaN |
10 rows × 100 columns
In [159]:
fig, ax = plt.subplots(figsize=(8,6))
for i in reversed(range(len(ns_book12))):
bar = ns_book12.iloc[i]
label = ns_book12.index[i]
ax.bar(year_cols, bar, label=label)
ax.set_title('연도별 대출건수')
ax.legend(loc='upper left')
ax.set_xlim(1985, 2025)
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/3256538605.py:9: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
- 원 그래프 그리기¶
In [164]:
data = top30_pubs[:10]
labels = top30_pubs.index[:10]
In [166]:
fig, ax = plt.subplots(figsize=(8,6))
ax.pie(data, labels=labels)
ax.set_title('출판사 도서 비율')
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/1089339988.py:4: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
In [170]:
plt.pie([10,9], labels=['A제품', 'B제품'], startangle=90)
plt.title('제품의 매출 비율')
plt.show()
In [176]:
fig, ax = plt.subplots(figsize=(8,6))
ax.pie(data, labels=labels, startangle=90, autopct='%.1f%%', explode=[0.1]+[0]*9)
ax.set_title('출판사 도서 비율')
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/3313552084.py:4: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
- 여러 종류의 그래프가 있는 서브플롯 그리기¶
In [181]:
fig, axes = plt.subplots(2, 2, figsize=(20, 16))
# 산점도
ns_book8 = ns_book7[top30_pubs_idx].sample(1000, random_state=42)
sc = axes[0,0].scatter(ns_book8['발행년도'], ns_book8['출판사'], linewidths=0.5, edgecolors='k', alpha=0.3, s=ns_book8['대출건수'], c=ns_book8['대출건수'], cmap='jet')
axes[0,0].set_title('출판사별 발행 도서')
fig.colorbar(sc, ax=axes[0,0])
# 스택 영역 그래프
axes[0,1].stackplot(year_cols, ns_book10.loc[top10_pubs].fillna(0), labels=top10_pubs)
axes[0,1].set_title('연도별 대출건수')
axes[0,1].legend(loc='upper left')
axes[0,1].set_xlim(1985, 2025)
# 스택 막대 그래프
for i in reversed(range(len(ns_book12))):
bar = ns_book12.iloc[i]
label = ns_book12.index[i]
axes[1,0].bar(year_cols, bar, label=label)
axes[1,0].set_title('연도별 대출건수')
axes[1,0].legend(loc='upper left')
axes[1,0].set_xlim(1985, 2025)
# 원 그래프
axes[1,1].pie(data, labels=labels, startangle=90, autopct='%.1f%%', explode=[0.1]+[0]*9)
axes[1,1].set_title('출판사 도서 비율')
fig.savefig('all_in_one.png')
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/3455517177.py:29: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
- 판다스로 여러 개의 그래프 그리기¶
In [185]:
ns_book11 = ns_book9.pivot_table(index='발행년도', columns='출판사', values='대출건수')
ns_book11.loc[2000:2005]
Out[185]:
출판사 | 博英社 | 길벗 | 김영사 | 넥서스 | 다산북스 | 랜덤하우스코리아 | 문학과지성사 | 문학동네 | 민음사 | 북이십일 21세기북스 | ... | 창비 | 책세상 | 커뮤니케이션북스 | 학지사 | 한국문화사 | 한국학술정보 | 한길사 | 한울 | 현암사 | 황금가지 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
발행년도 | |||||||||||||||||||||
2000 | 237.0 | 7.0 | 854.0 | 194.0 | NaN | 3.0 | 316.0 | 806.0 | 836.0 | NaN | ... | 57.0 | 369.0 | 37.0 | 988.0 | 84.0 | 36.0 | 536.0 | 287.0 | 274.0 | 1152.0 |
2001 | 267.0 | 202.0 | 2269.0 | 228.0 | NaN | 17.0 | 449.0 | 1373.0 | 1363.0 | NaN | ... | 70.0 | 355.0 | 184.0 | 582.0 | 110.0 | 3.0 | 1626.0 | 305.0 | 481.0 | 722.0 |
2002 | 458.0 | 472.0 | 2525.0 | 1154.0 | NaN | 20.0 | 686.0 | 1442.0 | 1388.0 | NaN | ... | 0.0 | 794.0 | 80.0 | 625.0 | 134.0 | 47.0 | 777.0 | 450.0 | 398.0 | 1493.0 |
2003 | 444.0 | 795.0 | 3130.0 | 3069.0 | NaN | 489.0 | 1262.0 | 2750.0 | 1453.0 | NaN | ... | 191.0 | 289.0 | 110.0 | 1006.0 | 215.0 | 95.0 | 1114.0 | 636.0 | 471.0 | 2001.0 |
2004 | 630.0 | 976.0 | 4804.0 | 2355.0 | 212.0 | 618.0 | 952.0 | 3012.0 | 1864.0 | 42.0 | ... | 2268.0 | 637.0 | 476.0 | 1270.0 | 392.0 | 91.0 | 1318.0 | 502.0 | 661.0 | 2744.0 |
2005 | 788.0 | 2162.0 | 7684.0 | 1162.0 | 509.0 | 941.0 | 1827.0 | 3952.0 | 2546.0 | NaN | ... | 2256.0 | 1103.0 | 820.0 | 1179.0 | 243.0 | 123.0 | 1461.0 | 767.0 | 835.0 | 2593.0 |
6 rows × 30 columns
In [187]:
import numpy as np
ns_book11 = ns_book7[top30_pubs_idx].pivot_table(index='발행년도', columns='출판사', values='대출건수', aggfunc=np.sum)
ns_book11.loc[2000:2005]
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/3469416428.py:3: FutureWarning: The provided callable <function sum at 0x108bf8a40> is currently using DataFrameGroupBy.sum. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string "sum" instead. ns_book11 = ns_book7[top30_pubs_idx].pivot_table(index='발행년도', columns='출판사', values='대출건수', aggfunc=np.sum)
Out[187]:
출판사 | 博英社 | 길벗 | 김영사 | 넥서스 | 다산북스 | 랜덤하우스코리아 | 문학과지성사 | 문학동네 | 민음사 | 북이십일 21세기북스 | ... | 창비 | 책세상 | 커뮤니케이션북스 | 학지사 | 한국문화사 | 한국학술정보 | 한길사 | 한울 | 현암사 | 황금가지 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
발행년도 | |||||||||||||||||||||
2000 | 237.0 | 7.0 | 854.0 | 194.0 | NaN | 3.0 | 316.0 | 806.0 | 836.0 | NaN | ... | 57.0 | 369.0 | 37.0 | 988.0 | 84.0 | 36.0 | 536.0 | 287.0 | 274.0 | 1152.0 |
2001 | 267.0 | 202.0 | 2269.0 | 228.0 | NaN | 17.0 | 449.0 | 1373.0 | 1363.0 | NaN | ... | 70.0 | 355.0 | 184.0 | 582.0 | 110.0 | 3.0 | 1626.0 | 305.0 | 481.0 | 722.0 |
2002 | 458.0 | 472.0 | 2525.0 | 1154.0 | NaN | 20.0 | 686.0 | 1442.0 | 1388.0 | NaN | ... | 0.0 | 794.0 | 80.0 | 625.0 | 134.0 | 47.0 | 777.0 | 450.0 | 398.0 | 1493.0 |
2003 | 444.0 | 795.0 | 3130.0 | 3069.0 | NaN | 489.0 | 1262.0 | 2750.0 | 1453.0 | NaN | ... | 191.0 | 289.0 | 110.0 | 1006.0 | 215.0 | 95.0 | 1114.0 | 636.0 | 471.0 | 2001.0 |
2004 | 630.0 | 976.0 | 4804.0 | 2355.0 | 212.0 | 618.0 | 952.0 | 3012.0 | 1864.0 | 42.0 | ... | 2268.0 | 637.0 | 476.0 | 1270.0 | 392.0 | 91.0 | 1318.0 | 502.0 | 661.0 | 2744.0 |
2005 | 788.0 | 2162.0 | 7684.0 | 1162.0 | 509.0 | 941.0 | 1827.0 | 3952.0 | 2546.0 | NaN | ... | 2256.0 | 1103.0 | 820.0 | 1179.0 | 243.0 | 123.0 | 1461.0 | 767.0 | 835.0 | 2593.0 |
6 rows × 30 columns
In [199]:
fig, ax = plt.subplots(figsize=(8,6))
ns_book11[top10_pubs].plot.area(ax=ax, title='연도별 대출건수', xlim=(1985, 2025))
ax.legend(loc='upper left')
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/1856043134.py:4: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
In [201]:
fig, ax = plt.subplots(figsize=(8,6))
ns_book11.loc[1985:2025, top10_pubs].plot.bar(
ax=ax, title='연도별 대출건수', stacked=True, width=0.8)
ax.legend(loc='upper left')
fig.show()
/var/folders/3w/0y55k0y53pg1dvg3p_cqn81m0000gn/T/ipykernel_46646/3196723817.py:5: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown fig.show()
'[혼공] 데이터분석' 카테고리의 다른 글
[혼공파] 5주차_혼공분석 (1) | 2025.03.05 |
---|---|
[혼공파] 4주차_혼공분석 (0) | 2025.02.09 |
[혼공파] 3주차_혼공분석 (0) | 2025.01.26 |
[혼공파] 2주차_혼공분석 (2) | 2025.01.19 |