Commit 685741a2 authored by Simeon Doetsch's avatar Simeon Doetsch Committed by Simeon Doetsch

Added projection from spherical to cartesian coordinates for plotting

parent 7fa2c5a1
......@@ -189,9 +189,19 @@ class PlutoData(object):
self.fig, self.ax = plt.subplots(figsize=figsize)
ax = self.ax
im = ax.pcolormesh(self.x1, self.x2, var.T, vmin=vmin, vmax=vmax, cmap=cmap)
ax.set_xlabel(self._latex(self.coord_names[0]))
ax.set_ylabel(self._latex(self.coord_names[1]))
if self.coordinate_system == 'spherical':
R, THETA = np.meshgrid(self.r, self.theta)
X = R * np.sin(THETA)
Y = R * np.cos(THETA)
ax.set_xlabel(self._latex('$x$'))
ax.set_ylabel(self._latex('$y$'))
else:
X, Y = self.x1, self.x2
ax.set_xlabel(self._latex(self.coord_names[0]))
ax.set_ylabel(self._latex(self.coord_names[1]))
im = ax.pcolormesh(X, Y, var.T, vmin=vmin, vmax=vmax, cmap=cmap)
ax.set_aspect(1)
if cbar:
formatter = ScalarFormatter()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment