반응형
matplotlib 1e2 등 과학적 표기법 scientific notation을 숫자로 바꾸기
과학적 기수법, 과학적 표기법(scientific notation) 은 십진법으로 표시하기에는 너무 크거나 너무 작은 숫자를 표현하는 표기법이다.
하지만 우리가 원하는 표기가 아닐 수 있다.
그냥 raw number 숫자 그 자체를 표현하고 싶을 때 matplotlib에 코드 한 줄을 추가하면 된다.
해결방안 : xticklabel_format(style='plain', axis='y')
plt.ticklabel_format(style='plain', axis='y')
plt.ticklabel_format(style='plain', axis='y')
위 코드만 추가해서 실행하면 된다.
참고로 만약 과학적 표기법이 나타나는 곳이 y axis가 아니라 x axis일 경우 axis='x'라고 바꿔주면 된다.
참고 :
https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.ticklabel_format.html
matplotlib.axes.Axes.ticklabel_format — Matplotlib 3.7.0 documentation
Scientific notation is used only for numbers outside the range 10m to 10n (and only if the formatter is configured to use scientific notation at all). Use (0, 0) to include all numbers. Use (m, m) where m != 0 to fix the order of magnitude to 10m. The form
matplotlib.org
반응형
'파이썬' 카테고리의 다른 글
[matplotlib] local 로컬에서 custom font, 원하는 ttf 파일 사용하기 (0) | 2023.06.15 |
---|---|
pdf to image 빠르게하기 with PyMuPDF (directory 폴더 없으면 만들기까지) (0) | 2023.06.02 |
[matplotlib] seaborn facetgrid에서 순서 바꾸기 (0) | 2023.04.24 |
파이썬 readlines 결과에서 \n 제거하기 / read().splitlines() 사용하기 (0) | 2023.04.06 |
[Colab] 코랩에서 matplotlib 한글 폰트 깨짐 수정 apt-get install -y fonts-nanum (0) | 2023.02.15 |
[matplotlib] pandas Bar plot에서 하나만 다른 색 칠하기 (0) | 2023.02.15 |
python function 속 super().__함수이름() 뜻 (0) | 2023.01.27 |
R 로 csv 읽기 (0) | 2022.12.18 |