Commit d3cb761a authored by Daniel Toyra's avatar Daniel Toyra
Browse files

Changed from pylab to pyplot for plotting absorption map

parent 92812439
...@@ -1604,7 +1604,8 @@ class mergedmap: ...@@ -1604,7 +1604,8 @@ class mergedmap:
def plot(self, mode="absorption", show=True, clabel=None, xlim=None, ylim=None, wavelength=1064e-9, isBlock=False): def plot(self, mode="absorption", show=True, clabel=None, xlim=None, ylim=None, wavelength=1064e-9, isBlock=False):
import pylab import matplotlib
import matplotlib.pyplot as plt
if xlim is not None: if xlim is not None:
_x = np.logical_and(self.x<=max(xlim)/100.0, self.x>=min(xlim)/100.0) _x = np.logical_and(self.x<=max(xlim)/100.0, self.x>=min(xlim)/100.0)
...@@ -1639,15 +1640,15 @@ class mergedmap: ...@@ -1639,15 +1640,15 @@ class mergedmap:
xrange = 100*self.x xrange = 100*self.x
yrange = 100*self.y yrange = 100*self.y
fig = pylab.figure() fig = plt.figure()
axes = pylab.pcolormesh(xrange, yrange, data, vmin=zmin, vmax=zmax) axes = plt.pcolormesh(xrange, yrange, data, vmin=zmin, vmax=zmax)
pylab.xlabel('x [cm]') plt.xlabel('x [cm]')
pylab.ylabel('y [cm]') plt.ylabel('y [cm]')
if xlim is not None: pylab.xlim(xlim) if xlim is not None: plt.xlim(xlim)
if ylim is not None: pylab.ylim(ylim) if ylim is not None: plt.ylim(ylim)
pylab.title('Merged map {0}, mode {1}'.format(self.name, mode)) plt.title('Merged map {0}, mode {1}'.format(self.name, mode))
cbar = fig.colorbar(axes) cbar = fig.colorbar(axes)
cbar.set_clim(zmin, zmax) cbar.set_clim(zmin, zmax)
...@@ -1656,7 +1657,7 @@ class mergedmap: ...@@ -1656,7 +1657,7 @@ class mergedmap:
cbar.set_label(clabel) cbar.set_label(clabel)
if show: if show:
pylab.show(block=isBlock) plt.show(block=isBlock)
return fig return fig
......
Supports Markdown
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