Python/matplotlib

[matplotlib] 기본그래프2

닉의네임 2021. 12. 30. 15:06
반응형

축범위 지정하기

코드 1

import matplotlib.pyplot as plt

plt.plot([1, 2, 3, 4], [2, 3, 5, 10])
plt.xlabel('X-Axis')
plt.ylabel('Y-Axis')
plt.xlim([0, 5])      # X축의 범위: [xmin, xmax]
plt.ylim([0, 20])     # Y축의 범위: [ymin, ymax]

plt.show()

 

# X축의 범위: [xmin, xmax]
# Y축의 범위: [ymin, ymax]
plt.xlim([0, 5])      
plt.ylim([0, 15])

 

 

 

 

 

 

 

 

 

# X, Y축의 범위: [xmin, xmax, ymin, ymax]
plt.axis([0, 5, 0, 20])

 

 

 

 

 

 

 

https://wikidocs.net/92083

반응형