pyplot

(Matplotlib.pyplot에서 넘어옴)

1 개요[ | ]

Pyplot, matplotlib.pyplot
파이플롯
짧은 테스트 코드
Python
CPU
1.0s
MEM
49M
1.2s
Copy
import matplotlib.pyplot as p;p.boxplot((1));p.show()
Traceback (most recent call last):
  File "runbox.py", line 1, in <module>
    import matplotlib.pyplot as p;p.boxplot((1));p.show()
  File "/usr/local/lib/python3.8/site-packages/matplotlib/pyplot.py", line 2691, in boxplot
    return gca().boxplot(
  File "/usr/local/lib/python3.8/site-packages/matplotlib/__init__.py", line 1361, in inner
    return func(ax, *map(sanitize_sequence, args), **kwargs)
  File "/usr/local/lib/python3.8/site-packages/matplotlib/axes/_axes.py", line 3745, in boxplot
    bxpstats = cbook.boxplot_stats(x, whis=whis, bootstrap=bootstrap,
  File "/usr/local/lib/python3.8/site-packages/matplotlib/cbook/__init__.py", line 1190, in boxplot_stats
    X = _reshape_2D(X, "X")
  File "/usr/local/lib/python3.8/site-packages/matplotlib/cbook/__init__.py", line 1419, in _reshape_2D
    if len(X) == 0:
TypeError: object of type 'int' has no len()
Command exited with non-zero status 1

2 화면 출력[ | ]

Python
Copy
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.show()
Loading
Python
Copy
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0,10,1000)
y = np.power(x,2)
plt.plot(x,y)
plt.title('main title')
plt.xlabel('x')
plt.ylabel('y')
plt.show()
Loading

3 PDF 파일로 저장[ | ]

Python
Copy
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0,10,1000)
y = np.power(x,2)
plt.plot(x,y)
plt.title('main title')
plt.xlabel('x')
plt.ylabel('y')
plt.savefig('test_plot.pdf')

4 같이 보기[ | ]

5 참고[ | ]