python으로 그래프 그리는 비슷비슷한 것을 자꾸 검색하는 것 같아서 정리해본다.
import plotly.express as px
x=[1,2,3]
y=[2,10,3]
fig = px.bar(x=x, y=y)
fig.show()
import plotly.express as px
import numpy as np
x=np.arange(-10, 10, 0.1)
y=[10*i**3-0.9*i**2+200*i-50 for i in x]
fig = px.line(x=x, y=y)
fig.show()
import matplotlib.pyplot as plt
import numpy as np
x = [np.random.randint(1, 128) / np.random.randint(1, 128) for _ in range(1000)]
y = [np.random.randint(1, 128) / np.random.randint(1, 128) for _ in range(1000)]
plt.scatter(x, y)
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
x = [np.random.randint(1, 128) / np.random.randint(1, 128) for _ in range(1000)]
y = [np.random.randint(1, 128) / np.random.randint(1, 128) for _ in range(1000)]
z = [np.random.randint(1, 128) / np.random.randint(1, 128) for _ in range(1000)]
fig = plt.figure(figsize=(10, 10))
ax = fig.gca(projection='3d')
ax.scatter(x,y,z, marker='o', s=15, c='darkgreen')
plt.show()