##// END OF EJS Templates
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
Juan C. Valdez -
r858:8e7e7dc24b8f
parent child
Show More
@@ -86,7 +86,7 class SpectraPlot(Figure):
86 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
86 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
87 server=None, folder=None, username=None, password=None,
87 server=None, folder=None, username=None, password=None,
88 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False,
88 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False,
89 xaxis="frequency"):
89 xaxis="frequency", colormap='jet'):
90
90
91 """
91 """
92
92
@@ -187,7 +187,7 class SpectraPlot(Figure):
187 axes = self.axesList[i*self.__nsubplots]
187 axes = self.axesList[i*self.__nsubplots]
188 axes.pcolor(x, y, zdB[index,:,:],
188 axes.pcolor(x, y, zdB[index,:,:],
189 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
189 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
190 xlabel=xlabel, ylabel=ylabel, title=title,
190 xlabel=xlabel, ylabel=ylabel, title=title, colormap=colormap,
191 ticksize=9, cblabel='')
191 ticksize=9, cblabel='')
192
192
193 if self.__showprofile:
193 if self.__showprofile:
@@ -514,7 +514,7 class RTIPlot(Figure):
514
514
515 def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True',
515 def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True',
516 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
516 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
517 timerange=None,
517 timerange=None, colormap='jet',
518 save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True,
518 save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True,
519 server=None, folder=None, username=None, password=None,
519 server=None, folder=None, username=None, password=None,
520 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
520 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
@@ -620,7 +620,7 class RTIPlot(Figure):
620 axes.pcolorbuffer(x, y, zdB,
620 axes.pcolorbuffer(x, y, zdB,
621 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
621 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
622 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
622 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
623 ticksize=9, cblabel='', cbsize="1%")
623 ticksize=9, cblabel='', cbsize="1%", colormap=colormap)
624
624
625 if self.__showprofile:
625 if self.__showprofile:
626 axes = self.axesList[i*self.__nsubplots +1]
626 axes = self.axesList[i*self.__nsubplots +1]
@@ -18,6 +18,11 from matplotlib.ticker import FuncFormatter, LinearLocator
18 #Actualizacion de las funciones del driver
18 #Actualizacion de las funciones del driver
19 ###########################################
19 ###########################################
20
20
21 jet_values = matplotlib.pyplot.get_cmap("jet", 100)(numpy.arange(100))[10:90]
22 blu_values = matplotlib.pyplot.get_cmap("seismic_r", 20)(numpy.arange(20))[10:15]
23 ncmap = matplotlib.colors.LinearSegmentedColormap.from_list("jro", numpy.vstack((blu_values, jet_values)))
24 matplotlib.pyplot.register_cmap(cmap=ncmap)
25
21 def createFigure(id, wintitle, width, height, facecolor="w", show=True, dpi = 80):
26 def createFigure(id, wintitle, width, height, facecolor="w", show=True, dpi = 80):
22
27
23 matplotlib.pyplot.ioff()
28 matplotlib.pyplot.ioff()
@@ -195,7 +200,10 def createPcolor(ax, x, y, z, xmin, xmax, ymin, ymax, zmin, zmax,
195
200
196 printLabels(ax, xlabel, ylabel, title)
201 printLabels(ax, xlabel, ylabel, title)
197
202
198 imesh = ax.pcolormesh(x,y,z.T, vmin=zmin, vmax=zmax, cmap=matplotlib.pyplot.get_cmap(colormap))
203 z = numpy.ma.masked_invalid(z)
204 cmap=matplotlib.pyplot.get_cmap(colormap)
205 cmap.set_bad('white',1.)
206 imesh = ax.pcolormesh(x,y,z.T, vmin=zmin, vmax=zmax, cmap=cmap)
199 cb = matplotlib.pyplot.colorbar(imesh, cax=ax_cb)
207 cb = matplotlib.pyplot.colorbar(imesh, cax=ax_cb)
200 cb.set_label(cblabel)
208 cb.set_label(cblabel)
201
209
@@ -251,7 +259,13 def addpcolorbuffer(ax, x, y, z, zmin, zmax, xlabel='', ylabel='', title='', col
251
259
252 ax.collections.remove(ax.collections[0])
260 ax.collections.remove(ax.collections[0])
253
261
254 ax.pcolormesh(x,y,z.T,vmin=zmin,vmax=zmax, cmap=matplotlib.pyplot.get_cmap(colormap))
262 z = numpy.ma.masked_invalid(z)
263
264 cmap=matplotlib.pyplot.get_cmap(colormap)
265 cmap.set_bad('white',1.)
266
267
268 ax.pcolormesh(x,y,z.T,vmin=zmin,vmax=zmax, cmap=cmap)
255
269
256 def createPmultiline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', legendlabels=None,
270 def createPmultiline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', legendlabels=None,
257 ticksize=9, xtick_visible=True, ytick_visible=True,
271 ticksize=9, xtick_visible=True, ytick_visible=True,
@@ -450,4 +464,3 def draw(fig):
450 def pause(interval=0.000001):
464 def pause(interval=0.000001):
451
465
452 matplotlib.pyplot.pause(interval)
466 matplotlib.pyplot.pause(interval)
453 No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now