Create Data
import pandas as pd
import numpy as np
import math as m
a=[i for i in range(1,82)]
b=[i*j for i in range(1,10) for j in range(1,10)]
c=[n**2 if n%2 == 0 else n**3 for n in range(1,82)]
df = pd.DataFrame({"a":a, "b":b, "c":c})
2D Plot
import matplotlib.pyplot as plt
plt.title('?Title?')
plt.plot(a,b,marker='o', linestyle='--',color='b',linewidth=1,label='b_plot')
plt.scatter(a,b,color='b',s=5,label='b_scatter')
plt.xlabel('a')
plt.ylabel('b')
plt.annotate('local max', xy=(50, 50), xytext=(50, 50),arrowprops=dict(facecolor='r', shrink=0.05))
plt.grid(True)
plt.legend(loc='upper right')
ax.view_init(60, 35) #보는각도
plt.show()
3D Plot
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
fig = plt.figure()
ax = plt.axes(projection='3d')
plt.title('?Title?')
ax.plot(a,b,c,marker='o', linestyle='--',color='b',linewidth=1,label='b_plot')
ax.scatter(a,b,color='b',s=5,label='b_scatter')
ax.set_xlabel('a')
ax.set_ylabel('a')
ax.set_zlabel('c')
plt.annotate('local max', xy=(50, 50), xytext=(50, 50),arrowprops=dict(facecolor='r', shrink=0.05))
plt.grid(True)
plt.legend(loc='upper right')
ax.view_init(60, 35) #보는각도
plt.show()
'SW > Python' 카테고리의 다른 글
[코인자동화] Upbit/Bitcoin API, 입출금 (0) | 2024.03.17 |
---|---|
[GPS Map] Plot, folium/webbrowser (0) | 2024.03.07 |
[ Pandas] DataFrame tutorial (0) | 2024.01.28 |
[Python] 직진_tsv data read, axis rotation (0) | 2024.01.28 |
[pyinstaller] 실행파일(EXE) 만들기 (0) | 2024.01.18 |