##// END OF EJS Templates
change ylabel pad in polar plot
Juan C. Valdez -
r873:77efa7e0b236
parent child
Show More
@@ -18,6 +18,8 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 # create jro colormap
22
21 jet_values = matplotlib.pyplot.get_cmap("jet", 100)(numpy.arange(100))[10:90]
23 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]
24 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)))
25 ncmap = matplotlib.colors.LinearSegmentedColormap.from_list("jro", numpy.vstack((blu_values, jet_values)))
@@ -31,7 +33,6 def createFigure(id, wintitle, width, height, facecolor="w", show=True, dpi = 80
31 fig.canvas.manager.set_window_title(wintitle)
33 fig.canvas.manager.set_window_title(wintitle)
32 # fig.canvas.manager.resize(width, height)
34 # fig.canvas.manager.resize(width, height)
33 matplotlib.pyplot.ion()
35 matplotlib.pyplot.ion()
34
35
36
36 if show:
37 if show:
37 matplotlib.pyplot.show()
38 matplotlib.pyplot.show()
@@ -87,7 +88,6 def createAxes(fig, nrow, ncol, xpos, ypos, colspan, rowspan, polar=False):
87 rowspan=rowspan,
88 rowspan=rowspan,
88 polar=polar)
89 polar=polar)
89
90
90 axes.grid(True)
91 matplotlib.pyplot.ion()
91 matplotlib.pyplot.ion()
92 return axes
92 return axes
93
93
@@ -204,7 +204,7 def createPcolor(ax, x, y, z, xmin, xmax, ymin, ymax, zmin, zmax,
204
204
205 z = numpy.ma.masked_invalid(z)
205 z = numpy.ma.masked_invalid(z)
206 cmap=matplotlib.pyplot.get_cmap(colormap)
206 cmap=matplotlib.pyplot.get_cmap(colormap)
207 cmap.set_bad('white',1.)
207 cmap.set_bad('white', 1.)
208 imesh = ax.pcolormesh(x,y,z.T, vmin=zmin, vmax=zmax, cmap=cmap)
208 imesh = ax.pcolormesh(x,y,z.T, vmin=zmin, vmax=zmax, cmap=cmap)
209 cb = matplotlib.pyplot.colorbar(imesh, cax=ax_cb)
209 cb = matplotlib.pyplot.colorbar(imesh, cax=ax_cb)
210 cb.set_label(cblabel)
210 cb.set_label(cblabel)
@@ -238,7 +238,7 def createPcolor(ax, x, y, z, xmin, xmax, ymin, ymax, zmin, zmax,
238 func = lambda x, pos: ('%s') %(datetime.datetime.utcfromtimestamp(x).strftime("%H:%M:%S"))
238 func = lambda x, pos: ('%s') %(datetime.datetime.utcfromtimestamp(x).strftime("%H:%M:%S"))
239 ax.xaxis.set_major_formatter(FuncFormatter(func))
239 ax.xaxis.set_major_formatter(FuncFormatter(func))
240 ax.xaxis.set_major_locator(LinearLocator(7))
240 ax.xaxis.set_major_locator(LinearLocator(7))
241 ax.grid(True)
241
242 matplotlib.pyplot.ion()
242 matplotlib.pyplot.ion()
243 return imesh
243 return imesh
244
244
@@ -248,13 +248,12 def pcolor(imesh, z, xlabel='', ylabel='', title=''):
248 ax = imesh.get_axes()
248 ax = imesh.get_axes()
249 printLabels(ax, xlabel, ylabel, title)
249 printLabels(ax, xlabel, ylabel, title)
250 imesh.set_array(z.ravel())
250 imesh.set_array(z.ravel())
251 ax.grid(True)
252
251
253 def addpcolor(ax, x, y, z, zmin, zmax, xlabel='', ylabel='', title='', colormap='jet'):
252 def addpcolor(ax, x, y, z, zmin, zmax, xlabel='', ylabel='', title='', colormap='jet'):
254
253
255 printLabels(ax, xlabel, ylabel, title)
254 printLabels(ax, xlabel, ylabel, title)
255
256 ax.pcolormesh(x,y,z.T,vmin=zmin,vmax=zmax, cmap=matplotlib.pyplot.get_cmap(colormap))
256 ax.pcolormesh(x,y,z.T,vmin=zmin,vmax=zmax, cmap=matplotlib.pyplot.get_cmap(colormap))
257 ax.grid(True)
258
257
259 def addpcolorbuffer(ax, x, y, z, zmin, zmax, xlabel='', ylabel='', title='', colormap='jet'):
258 def addpcolorbuffer(ax, x, y, z, zmin, zmax, xlabel='', ylabel='', title='', colormap='jet'):
260
259
@@ -265,10 +264,10 def addpcolorbuffer(ax, x, y, z, zmin, zmax, xlabel='', ylabel='', title='', col
265 z = numpy.ma.masked_invalid(z)
264 z = numpy.ma.masked_invalid(z)
266
265
267 cmap=matplotlib.pyplot.get_cmap(colormap)
266 cmap=matplotlib.pyplot.get_cmap(colormap)
268 cmap.set_bad('white',1.)
267 cmap.set_bad('white', 1.)
269
268
269
270 ax.pcolormesh(x,y,z.T,vmin=zmin,vmax=zmax, cmap=cmap)
270 ax.pcolormesh(x,y,z.T,vmin=zmin,vmax=zmax, cmap=cmap)
271 ax.grid(True)
272
271
273 def createPmultiline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', legendlabels=None,
272 def createPmultiline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', legendlabels=None,
274 ticksize=9, xtick_visible=True, ytick_visible=True,
273 ticksize=9, xtick_visible=True, ytick_visible=True,
@@ -426,7 +425,7 def createPolar(ax, x, y,
426 # ax.text(0, -110, ylabel, rotation='vertical', va ='center', ha = 'center' ,size='11')
425 # ax.text(0, -110, ylabel, rotation='vertical', va ='center', ha = 'center' ,size='11')
427 # ax.text(0, 50, ylabel, rotation='vertical', va ='center', ha = 'left' ,size='11')
426 # ax.text(0, 50, ylabel, rotation='vertical', va ='center', ha = 'left' ,size='11')
428 # ax.text(100, 100, 'example', ha='left', va='center', rotation='vertical')
427 # ax.text(100, 100, 'example', ha='left', va='center', rotation='vertical')
429 ax.yaxis.labelpad = 230
428 ax.yaxis.labelpad = 250
430 printLabels(ax, xlabel, ylabel, title)
429 printLabels(ax, xlabel, ylabel, title)
431 iplot = ax.lines[-1]
430 iplot = ax.lines[-1]
432
431
General Comments 0
You need to be logged in to leave comments. Login now