我的矩阵如下所示:
Country | Agri | Manu | Serv |
AFG | 0.7 | 0.1 | 0.3 |
ALB | 0.2 | 0.5 | 0.4 |
BEL | 0.1 | 0.8 | 0.1 |
我想按国家标记每个数据点(第0栏)。我怎么能这样做?
我的代码:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(10,8))
ax=fig.add_subplot(111,projection='3d')
ax.scatter(orig_df['Agri'],
orig_df['Manu'],
orig_df['Serv'],
marker='o',
color='b',
alpha=0.7,
s = 124)
ax.set_title('Three Sector Economy')
ax.set_xlabel('Agriculture')
ax.set_xlim([0,1])
ax.set_ylabel('Manufacturing')
ax.set_ylim([0,1])
ax.set_zlabel('Services')
ax.set_zlim([0,1])
plt.show()
我的输出: 3D pic