일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- PANDAS
- numpy
- array
- 파이썬
- Java
- PostgreSQL
- dataframe
- Mac
- Python
- Apache
- Tkinter
- math
- PySpark
- Github
- GIT
- google apps script
- gas
- Google Spreadsheet
- list
- SQL
- Redshift
- Kotlin
- hive
- matplotlib
- string
- Google Excel
- django
- c#
- Excel
- Today
- Total
목록Python/Python matplotlib (33)
달나라 노트

matplotlib에서 grid를 이용하면 그래프에 격자선을 넣을 수 있습니다. import matplotlib.pyplot as plt list_x = [1, 2, 3, 4, 5] list_y = [90, 46, 70, 10, 89] plt.plot(list_x, list_y) plt.show() 위 코드처럼 그냥 pyplot을 이용해 그래프를 그리면 그래프만 나타나고 그래프 배경에 격자선이 없습니다. import matplotlib.pyplot as plt list_x = [1, 2, 3, 4, 5] list_y = [90, 46, 70, 10, 89] plt.plot(list_x, list_y) plt.grid(visible=True) plt.show() 위처럼 grid method의 visible..

히스토그램(Histogram)이란 x축을 값, y축은 x축의 값들이 나온 횟수(또는 개수)를 나타낸 그래프입니다. 여기서 x축을 계급, 횟수나 개수를 나타내는 y축을 도수라고 하는데 크게 중요하진 않습니다. matplotlibe의 hist method는 이러한 histogram을 그릴 수 있도록 해줍니다. import matplotlib.pyplot as plt value_list = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10] plt.hist(value_list) plt.xlabel('number') plt.ylabel('count') plt.show() 위 예시..

maplotlib의 scatter method는 점 그래프를 그려줍니다. 쉽게말해 점과 점을 이어주는 선 없이 오로지 점만을 나타내줍니다. import matplotlib.pyplot as plt list_x = [1, 2, 3, 4, 5] list_y = [10, 30, 15, 20, 5] plt.scatter(list_x, list_y, marker='o', s=30, c='lightgreen', edgecolors='black') plt.title('Test graph') plt.xlabel('date') plt.ylabel('amount') plt.show() scatter method는 사용법이 plot method와 거의 동일합니다. (plot method 관련 = https://cosmosp..

matplotlib에서는 clf, cla라는 method가 있습니다. clf method는 clf method가 적용된 그래프의 figure를 지웁니다. figure를 지운다고 하니까 좀 의미가 와닿지 않는데, 좀 더 간단하게 말하면 그래프 / 좌표평면 / title / x label / y label / xlim / ylim 등 모든걸 지운다고 보시면 됩니다. cla method는 좌표평면을 제외한 내용을 지워줍니다. 따라서 cla method를 적용한 그래프에는 좌표평면만 남고 좌표평면 자체를 제외한 모든 것(그래프 / title / x label / y label / xlim / ylim 등)이 지워집니다. import matplotlib.pyplot as plt list_x = [0, 1, 2, ..