0

What I got:
enter image description here

Expected result:
enter image description here

In the chamber measurement, Theta varies from -180:180 and phi varies from 0:180. I have to plot theta from 0:180 and phi from 0:360. How can I plot that in python without altering the dataset file but just in code?

import matplotlib.pyplot as plt
import numpy as np
from matplotlib import cm
from mpl_toolkits import mplot3d
import pandas as pd
from matplotlib import rcParams

df= pd.read_csv('Data.csv')
df.head()

Z=df.pivot(index="Phi", columns="Theta", values="E_total").T.values
X_unique = np.sort(df.Theta.unique())
Y_unique = np.sort(df.Phi.unique())

X, Y = np.meshgrid(X_unique, Y_unique)
fig = plt.figure()
ax = fig.add_subplot(111)
cpf = ax.contourf(X,Y,Z,20, cmap=cm.jet)
plt.colorbar(cpf)
ax.set_xlabel('Phi')
ax.set_ylabel('Theta')

enter image description here

Mr. T
  • 11,960
  • 10
  • 32
  • 54
Maverick
  • 1
  • 2
  • You have to share how your data csv or your dataframe looks like. Just a small subset of it would be enough. – yakutsa Jan 21 '22 at 15:27
  • I added the data pic below – Maverick Jan 26 '22 at 15:20
  • Please don't add data/code/error messages as images. Post the text directly here on SO. Alternatively, post a link to the CSV file. See also [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – Mr. T Jan 26 '22 at 15:56

0 Answers0