从pyplot导出标记数据点

时间:2018-11-07 08:22:49

标签: python matplotlib marker

如何通过pyplot从3Dplot导出标记点数据点?

这是我的源代码:

from mpl_toolkits.mplot3d import Axes3D as ax
import numpy as np
import matplotlib.pyplot as plt
import math

def read(n):

    from xlrd import open_workbook

    book = open_workbook(n)
    sheet = book.sheet_by_index(0) #If your data is on sheet 1

    column1 = []
    column2 = []
    column3 = []


    for row in range(0,601): #start from 1, to leave out row 0
        column1.append(sheet.cell_value(row,0))#extract from first col
        column2.append(sheet.cell_value(row,1))
        column3.append(sheet.cell_value(row,2))
    xdata = []
    ydata = []
    zdata = []

    xdata=column1.copy()
    ydata=column2.copy()
    zdata=column3.copy()
    return xdata,ydata,zdata

n='test.xlsx'
xdata=np.array(read(n)[0])
ydata=np.array(read(n)[1])
zdata=np.array(read(n)[2])

fig = plt.figure()
ax = plt.axes(projection='3d')
ax.plot3D(xdata, ydata, zdata,marker='o',color='green',markevery=0.05)
#ax.scatter3D(xdata, ydata, zdata,marker='o',color='green',markevery=0.05)

for x, y in zip(xdata, yList):
        plt.text(x, y+0.3, str(y), ha='center', va='bottom', fontsize=10.5)

plt.grid()
plt.show()

我只能绘制点,但不能将其导出。

我需要一个标记点​​来创建新路径。

感谢您的帮助!

[https://reurl.cc/L0EXx]

0 个答案:

没有答案