Commit 84320006 authored by OP's avatar OP
Browse files

cosmetic change - show color map names

parent 601e439b
......@@ -136,14 +136,14 @@ def viewtfmap(folder,num,mvmin=0.,mvmax=0.,save=False, raplot=False,timeplot=F
cbar.norm.vmax=smax.val
start = time.time()
cbar.draw_all()
elp = time.time()
print str(elp-start) + " seconds"
#elp = time.time()
#print str(elp-start) + " seconds"
im.set_norm(cbar.norm)
elp = time.time()
print str(elp-start) + " seconds"
#elp = time.time()
#print str(elp-start) + " seconds"
cbar.patch.figure.canvas.draw()
elp = time.time()
print "end->"+str(elp-start) + " seconds"
#elp = time.time()
#print "end->"+str(elp-start) + " seconds"
#cen.set_val( (smax.val + smin.val)/2.)
#rng.set_val( (smax.val - smin.val) )
......@@ -157,6 +157,13 @@ def viewtfmap(folder,num,mvmin=0.,mvmax=0.,save=False, raplot=False,timeplot=F
# ind = cm_cycle.index(cbar.get_cmap().name)
# cycle = sorted([i for i in dir(plt.cm) if hasattr(getattr(plt.cm,i),'N')])
axnext = fig.add_axes([0.6, 0.04, 0.05, 0.05])
bnext = Button(axnext,cm_cycle[cm_index+1] )
axprev = fig.add_axes([0.7, 0.04, 0.05, 0.05])
bprev = Button(axprev,cm_cycle[cm_index-1] )
axcur = fig.add_axes([0.65, 0.04, 0.05, 0.05], )
bcur = Button(axcur,cm_cycle[cm_index])
def cm_next(val):
cm_cycle = sorted([i for i in dir(plt.cm) if hasattr(getattr(plt.cm,i),'N')])
cm_index = cm_cycle.index(cbar.get_cmap().name)
......@@ -166,7 +173,7 @@ def viewtfmap(folder,num,mvmin=0.,mvmax=0.,save=False, raplot=False,timeplot=F
cm_index=0
change_cm(cm_index)
print cm_index
#print cm_index
def cm_prev(val):
cm_cycle = sorted([i for i in dir(plt.cm) if hasattr(getattr(plt.cm,i),'N')])
......@@ -177,25 +184,27 @@ def viewtfmap(folder,num,mvmin=0.,mvmax=0.,save=False, raplot=False,timeplot=F
cm_index=len(cm_cycle)
change_cm(cm_index)
print cm_index
#print cm_index
def change_cm(index):
print "test "+str(index)
cm_cycle = sorted([i for i in dir(plt.cm) if hasattr(getattr(plt.cm,i),'N')])
cmap = cm_cycle[index]
print cmap
#print cmap
cbar.set_cmap(cmap)
cbar.draw_all()
im.set_cmap(cmap)
cbar.patch.figure.canvas.draw()
axnext = fig.add_axes([0.6, 0.04, 0.05, 0.05])
bnext = Button(axnext, 'Next cm')
axprev = fig.add_axes([0.7, 0.04, 0.05, 0.05])
bprev = Button(axprev, 'Prev. cm')
# srng.on_changed(update_rng)
# scen.on_changed(update_rng)
bcur.label.set_text(cmap)
indprev=index-1
if indprev<0 :
indprev=len(cm_cycle)
indnext=index+1
if indnext>=len(cm_cycle):
indnext=0
bnext.label.set_text(cm_cycle[indnext])
bprev.label.set_text(cm_cycle[indprev])
bnext.on_clicked(cm_next)
bprev.on_clicked(cm_prev)
......
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