본문 바로가기
프로그램

[파이썬] 문제 : matplotlib의 축제목과 그래프 사이의 간격 조정

by 오디세이99 2023. 11. 21.
728x90
반응형
import matplotlib.pyplot as plt
import numpy as np

# 그래프 생성
fig = plt.figure()
axes1 = fig.add_axes([0, 0, 1, 1])
x = np.arange(0, 20)
axes1.plot(x, x**4)
axes1.set_title('축제목 간격 조정')

# x축과 y축 레이블 간격 설정
axes1.set_xlabel('X-Axis', labelpad=0)        # x축 제목 간격 좁게
axes1.set_ylabel('Y-Axis', labelpad=20)       # y축 제목 간격 넓게

# 그래프 한계치 설정
axes1.set_xlim(0, 10)
axes1.set_ylim(0, 10000)

plt.show()

728x90
반응형

댓글