'Python plot 3 colouns data file
I have this problem.. from a code I'm getting this output: [https://pastebin.com/WK6K97jv][1]
I would like to plot in 3d surface using matplotlib surface .. how can I do this ? I have tried using just plot(X,Y, Z) but I would like to use the surface .. wireframe and so on .. I'm starting writing code to modify the file in order to use mesh grid .. but I have no idea how to do it ..
x=np.genfromtxt('./jpdf1/jpdf1.000533048.dat',usecols=(0,))
y=np.genfromtxt('./jpdf1/jpdf1.000533048.dat',usecols=(1,))
z=np.genfromtxt('./jpdf1/jpdf1.000533048.dat',usecols=(1,))
with open ....
for i in range(len(X)):
if X[i-1] != X[i]:
write
EDIT this is my effort code (the axis are cartesian) and the grid as well are constant-size square:
import numpy as np
import matplotlib.pyplot as plt
x=np.genfromtxt('./jpdf1/jpdf1.000533048.dat',usecols=(0,))
y=np.genfromtxt('./jpdf1/jpdf1.000533048.dat',usecols=(1,))
z=np.genfromtxt('./jpdf1/jpdf1.000533048.dat',usecols=(2,))
X,Y = [], []
#with open(file_jpdf1.dat) as f:
for i in range(len(x)):
if x[i-1] != x[i]:
X.append(x[i])
for i in range(len(y)):
if y[i-1] != y[i]:
Y.append(y[i])
for i in range(len(X)):
print (X[i],' ' , Y[I])
this work .. but what about the Z ?
just this for the first variable ... [1]: https://pastebin.com/WK6K97jv
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
