Hi All,
I am trying to 3D surface plot the data from a .csv file. there is already
a reference plot drawn with this data (seems it was done by some windows
app) and I am trying to do the same with linux (in fact on Raspberry Pi)
with matplot library.
I have attached the .csv file for reference.
Original plot (with some microsoft tool) is as below.
and when I plot the same data with matplotlib, the plot is as below.
Seems the plotting is ok, but for the layer of light orange patches - not
sure, what is causing this. My python code is as below. Let me know if you
have any suggestion for me.
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import numpy as np
import csv
X = []
Y = []
Z = []
#Read the selected file
with open ('Plasma.csv', 'r') as csvfile:
plots = csv.reader (csvfile, delimiter=',')
for row in plots:
X.append(float(row[0]))
Y.append(float(row[1]))
Z.append(float(row[2]))
#Getting ready for the dispaly
fig = plt.figure()
ax = fig.gca(projection='3d')
#Set the labels...
ax.set_xlabel('X (mm)')
ax.set_ylabel('Y (mm)')
ax.set_zlabel('CPD (mV)')
#Setting the places properly...
tmp_planes = ax.zaxis._PLANES
ax.zaxis._PLANES = (tmp_planes[2], tmp_planes[3],
tmp_planes[0], tmp_planes[1],
tmp_planes[4],tmp_planes[5])
# Make data.
X, Y = np.meshgrid(X, Y)
#Plot
surf = ax.plot_surface(X, Y, Z, cmap=cm.coolwarm, linewidth=0)
plt.show()
With best regards,
Phani.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20180312/c06ec568/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Plasma_PlotWithMatplotLib.jpg
Type: image/jpeg
Size: 65917 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20180312/c06ec568/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Plasma_Original.jpg
Type: image/jpeg
Size: 153730 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20180312/c06ec568/attachment-0003.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Plasma.csv
Type: application/vnd.ms-excel
Size: 3883 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20180312/c06ec568/attachment-0001.xlb>