matplotlib 로그 로그 플롯에서 과학적 표기법을 제거하려면 ax.xaxis.set_minor_formatter(mticker.ScalarFormatter())를 사용할 수 있습니다. 성명서.
단계
- 그림 크기를 설정하고 서브플롯 사이 및 주변 여백을 조정합니다.
- numpy를 사용하여 x 및 y 데이터 포인트를 생성합니다.
- scatter()를 사용하여 x 및 y 데이터 포인트 플롯 방법.
- set_xscale()을 사용하여 x 및 y축 sacle 설정 및 set_yscale() 방법.
- 과학 표기법을 제거하려면 형식 눈금 값을 숫자로 사용하세요.
- 그림을 표시하려면 show()를 사용하세요. 방법.
예시
import numpy as np
from matplotlib import pyplot as plt, ticker as mticker
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
x = np.array([1, 7, 6, 4, 0])
y = np.array([6, 2, 3, 5, 1])
plt.scatter(y, x, c=x, cmap="copper")
ax = plt.gca()
ax.set_xscale('log')
ax.set_yscale('log')
ax.xaxis.set_minor_formatter(mticker.ScalarFormatter())
plt.show() 출력
