본문 바로가기

matplotlib5

Notebook에서 matplotlib 한글 폰트 깨짐 문제 해결 Matplotlib 한글 폰트 깨짐 문제 확인 쥬피터 노트북에서 matplotlib으로 한글 출력 다음과 같이 깨져 보인다. 사용가능 폰트 리스트 확인 import matplotlib.font_manager as fm font_list = [f.name for f in fm.fontManager.ttflist] print(font_list) 📌 Windows, MacOs 의 설치 폰트가 다르므로, 위 폰트 리스트에 있는 폰트를 사용한다. Matplotlib 폰트 적용 import matplotlib.pyplot as plt # plt.rc('font', family='Malgun Gothic') # For windows plt.rc('font', family='AppleGothic') # For MacO.. 2022. 11. 2.
Python 데이터 시각화 - 상관관계(correlation) 분석, Heatmap (with Matplotlib, seaborn ) 데이터 상관관계 시각화 Pandas dataframe 구조의 데이터를 사용하여 데이터 간의 상관관계(correlation)를 확인해보고 이를 Heatmap으로 시각화하여 표현해보자. 샘플데이터는 Plotly에서 제공하는 샘플 데이터를 사용하도록 한다. 상관관계 분석(Correlation Analysis) 상관관계 분석은 두 개이상의 변수 사이에 존재하는 상호 연관성 존재와 그 강도를 측정하는 방법이다. 개발환경 - Pandas 3.9.0 - Jupyter-lab 3.0 - Plotly 4.14.3 - matplotlib 3.2.2 - seaborn 0.11.1 임포트 라이브러리 # Data import numpy as np import pandas as pd # Visualization import ma.. 2021. 3. 30.
x and y can be no greater than 2-D, but have shapes (2,) and (2, 1, 1) plt.scatter(train_input, train_target) plt.plot([15, 50], [15*lr.coef_+lr.intercept_, 50*lr.coef_+lr.intercept_]) plt.scatter(50, 1241.8, marker='^') plt.xlabel('length') plt.ylabel('weight') plt.show() 위 구문에서 다음과 같은 오류 발생 ~\AppData\Local\Programs\Python\Python39\lib\site-packages\matplotlib\axes\_base.py in _plot_args(self, tup, kwargs) 343 f"have shapes {x.shape} and {y.shape}") 344 if x.ndim .. 2021. 3. 2.
Backtrader - ImportError: cannot import name 'warnings' from 'matplotlib.dates' 오류 처리 방법 Backtrader 사용 시 다음과 같은 오류 발생 ImportError: cannot import name 'warnings' from 'matplotlib.dates' matplotlib 상위 버전과 호환에 버그가 있어 다운그레이드 해야 한다. pip uninstall matplotlib pip install matplotlib==3.2.2 # pip 패키지 버전 확인 pip list Fix pull request: https://github.com/mementum/backtrader/pull/418. Fix ImportError from matplotlib.dates by Larry-u · Pull Request #418 · mementum/backtrader matplotlib.dates does.. 2021. 2. 17.