0

I'm trying to create a diagram inspired by this one with Python.

Here is the code:

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

V = np.linspace(0.01, 1000, 500)
T = np.linspace(0.01, 1000, 500)

#n = 1.    #one mole graph
R = 0.0821

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

V, T = np.meshgrid(V,T)
P = R*T/V

ax.plot_wireframe(V, T, P, rstride=50, cstride=50)

ax.set_xlabel('Volume')
ax.set_ylabel('Temperature')
ax.set_zlabel('Pressure')

plt.show()

The plot I got is this. I'm don't know what I'm doing wrong.

1 Answers1

0

Honestly I'm not sure about the math behind what you want to do, but it seems to me that your values of P tend to infinity towards 0 so the graph don't "scale" well. For example, if you take values for, say, the range 1 to 5 the plot look like this plot

which seems to resembles more the image you are taking as reference.

Hirabayashi Taro
  • 933
  • 9
  • 17