@@ -30,9 +30,10 @@ def get_help_string():
3030 helplines .append ('' )
3131 helplines .append ('q - quit' )
3232 helplines .append ('p - save png' )
33- if not os .name == 'nt' :
34- helplines .append ('s - save svg' )
35- helplines .append ('l - log toggle' )
33+ #if not os.name == 'nt':
34+ helplines .append ('s - save svg' )
35+ helplines .append ('l - log toggle (disables plot from zero)' )
36+ helplines .append ('0 - plot 1D-curves from zero (disables log)' )
3637 helplines .append ('t - textinfo toggle' )
3738 helplines .append ('c - cycle colormap' )
3839 helplines .append ('F1/h - help' )
@@ -49,21 +50,31 @@ class ViewModel():
4950 It is a kind of viewmodel, originally a log logstate housekeeping object,
5051 extended by various other logstate variables as well.
5152 '''
52- def __init__ (self , log = False , legend = True , sourcedir = None ):
53+ def __init__ (self , log = False , fromzero = False , legend = True , sourcedir = None ):
5354 self .log = log
55+ self .fromzero = fromzero
5456 self .icolormap = 0
5557 self .legend = legend
5658 self .sourcedir = sourcedir
5759 def flip_log (self ):
5860 self .log = not self .log
61+ if self .log :
62+ self .fromzero = False
5963 return self .log
64+ def flip_fromzero (self ):
65+ self .fromzero = not self .fromzero
66+ if self .fromzero :
67+ self .log = False
68+ return self .fromzero
6069 def inc_colormap (self ):
6170 self .icolormap += 1
6271 def flip_legend (self ):
6372 self .legend = not self .legend
6473 return self .legend
6574 def logstate (self ):
6675 return self .log
76+ def fromzerostate (self ):
77+ return self .fromzero
6778 def legendstate (self ):
6879 return self .legend
6980 def cmapindex (self ):
@@ -267,7 +278,7 @@ def show_help(self):
267278 def set_keyhandler (self , replot_cb , back_cb , key , modifier ):
268279 ''' sets a clickhadler according to input '''
269280
270- def key_handler (ev , replot_cb , back_cb , savefile_cb , flip_log , flip_legend , inc_cmap , expand_sp , debug = False ):
281+ def key_handler (ev , replot_cb , back_cb , savefile_cb , flip_log , flip_fromzero , flip_legend , inc_cmap , expand_sp , debug = False ):
271282 ''' global keypress handler, replot_cb is a function of log '''
272283
273284 if hasattr (QtCore .Qt , "Key" ):
@@ -280,11 +291,14 @@ def key_handler(ev, replot_cb, back_cb, savefile_cb, flip_log, flip_legend, inc_
280291 elif ev .key () == k .Key_L : # l
281292 flip_log ()
282293 replot_cb ()
294+ elif ev .key () == k .Key_0 : # 0
295+ flip_fromzero ()
296+ replot_cb ()
283297 elif ev .key () == k .Key_P : # p
284298 savefile_cb (format = 'png' )
285299 elif ev .key () == 83 : # s
286- if not os .name == 'nt' :
287- savefile_cb (format = 'svg' )
300+ # if not os.name == 'nt':
301+ savefile_cb (format = 'svg' )
288302 elif ev .key () == k .Key_T : # t
289303 print ("Toggle legend visibility" )
290304 flip_legend ()
@@ -313,6 +327,7 @@ def key_handler(ev, replot_cb, back_cb, savefile_cb, flip_log, flip_legend, inc_
313327 savefile_cb = savefile_cb ,
314328 back_cb = back_cb ,
315329 flip_log = self .viewmodel .flip_log ,
330+ flip_fromzero = self .viewmodel .flip_fromzero ,
316331 flip_legend = self .viewmodel .flip_legend ,
317332 inc_cmap = self .viewmodel .inc_colormap ,
318333 expand_sp = expand_sp )
@@ -411,10 +426,11 @@ def click_handler(event, node_list, node_cb, click, mod, debug=False):
411426 event , node_list = node_list , node_cb = node_cb , click = click , mod = modifier ))
412427
413428
414- def get_plot_func_opts (self , log , legend , icolormap , verbose , fontsize , cbmin = None , cbmax = None ):
429+ def get_plot_func_opts (self , fromzero , log , legend , icolormap , verbose , fontsize , cbmin = None , cbmax = None ):
415430 ''' returns a dict for holding the plot options relevant for this plotting frontend '''
416431 d = {}
417432 d ['log' ] = log
433+ d ['fromzero' ] = fromzero
418434 d ['legend' ] = legend
419435 d ['icolormap' ] = icolormap
420436 d ['verbose' ] = verbose
@@ -470,7 +486,7 @@ def get_golden_rowlen(n):
470486 else :
471487 cbmin , cbmax = self .get_sweep_multiplot_colorbar_limits (node )
472488
473- options = self .get_plot_func_opts (
489+ options = self .get_plot_func_opts (self . viewmodel . fromzerostate (),
474490 self .viewmodel .logstate (), self .viewmodel .legendstate (), self .viewmodel .cmapindex (),
475491 verbose , fontsize , cbmin , cbmax )
476492 view_box , plt_itm = self .plot_func (node , i , plt , options )
0 commit comments