@@ -30,9 +30,9 @@ 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+ helplines . append ( 's - save svg' )
34+ helplines .append ('l - log toggle (disables plot from zero) ' )
35+ helplines .append ('0 - plot 1D-curves from zero (disables log) ' )
3636 helplines .append ('t - textinfo toggle' )
3737 helplines .append ('c - cycle colormap' )
3838 helplines .append ('F1/h - help' )
@@ -49,21 +49,31 @@ class ViewModel():
4949 It is a kind of viewmodel, originally a log logstate housekeeping object,
5050 extended by various other logstate variables as well.
5151 '''
52- def __init__ (self , log = False , legend = True , sourcedir = None ):
52+ def __init__ (self , log = False , fromzero = False , legend = True , sourcedir = None ):
5353 self .log = log
54+ self .fromzero = fromzero
5455 self .icolormap = 0
5556 self .legend = legend
5657 self .sourcedir = sourcedir
5758 def flip_log (self ):
5859 self .log = not self .log
60+ if self .log :
61+ self .fromzero = False
5962 return self .log
63+ def flip_fromzero (self ):
64+ self .fromzero = not self .fromzero
65+ if self .fromzero :
66+ self .log = False
67+ return self .fromzero
6068 def inc_colormap (self ):
6169 self .icolormap += 1
6270 def flip_legend (self ):
6371 self .legend = not self .legend
6472 return self .legend
6573 def logstate (self ):
6674 return self .log
75+ def fromzerostate (self ):
76+ return self .fromzero
6777 def legendstate (self ):
6878 return self .legend
6979 def cmapindex (self ):
@@ -267,7 +277,7 @@ def show_help(self):
267277 def set_keyhandler (self , replot_cb , back_cb , key , modifier ):
268278 ''' sets a clickhadler according to input '''
269279
270- def key_handler (ev , replot_cb , back_cb , savefile_cb , flip_log , flip_legend , inc_cmap , expand_sp , debug = False ):
280+ def key_handler (ev , replot_cb , back_cb , savefile_cb , flip_log , flip_fromzero , flip_legend , inc_cmap , expand_sp , debug = False ):
271281 ''' global keypress handler, replot_cb is a function of log '''
272282
273283 if hasattr (QtCore .Qt , "Key" ):
@@ -280,11 +290,13 @@ def key_handler(ev, replot_cb, back_cb, savefile_cb, flip_log, flip_legend, inc_
280290 elif ev .key () == k .Key_L : # l
281291 flip_log ()
282292 replot_cb ()
293+ elif ev .key () == k .Key_0 : # 0
294+ flip_fromzero ()
295+ replot_cb ()
283296 elif ev .key () == k .Key_P : # p
284297 savefile_cb (format = 'png' )
285- elif ev .key () == 83 : # s
286- if not os .name == 'nt' :
287- savefile_cb (format = 'svg' )
298+ elif ev .key () == 83 : # s
299+ savefile_cb (format = 'svg' )
288300 elif ev .key () == k .Key_T : # t
289301 print ("Toggle legend visibility" )
290302 flip_legend ()
@@ -313,6 +325,7 @@ def key_handler(ev, replot_cb, back_cb, savefile_cb, flip_log, flip_legend, inc_
313325 savefile_cb = savefile_cb ,
314326 back_cb = back_cb ,
315327 flip_log = self .viewmodel .flip_log ,
328+ flip_fromzero = self .viewmodel .flip_fromzero ,
316329 flip_legend = self .viewmodel .flip_legend ,
317330 inc_cmap = self .viewmodel .inc_colormap ,
318331 expand_sp = expand_sp )
@@ -411,10 +424,11 @@ def click_handler(event, node_list, node_cb, click, mod, debug=False):
411424 event , node_list = node_list , node_cb = node_cb , click = click , mod = modifier ))
412425
413426
414- def get_plot_func_opts (self , log , legend , icolormap , verbose , fontsize , cbmin = None , cbmax = None ):
427+ def get_plot_func_opts (self , fromzero , log , legend , icolormap , verbose , fontsize , cbmin = None , cbmax = None ):
415428 ''' returns a dict for holding the plot options relevant for this plotting frontend '''
416429 d = {}
417430 d ['log' ] = log
431+ d ['fromzero' ] = fromzero
418432 d ['legend' ] = legend
419433 d ['icolormap' ] = icolormap
420434 d ['verbose' ] = verbose
@@ -470,7 +484,7 @@ def get_golden_rowlen(n):
470484 else :
471485 cbmin , cbmax = self .get_sweep_multiplot_colorbar_limits (node )
472486
473- options = self .get_plot_func_opts (
487+ options = self .get_plot_func_opts (self . viewmodel . fromzerostate (),
474488 self .viewmodel .logstate (), self .viewmodel .legendstate (), self .viewmodel .cmapindex (),
475489 verbose , fontsize , cbmin , cbmax )
476490 view_box , plt_itm = self .plot_func (node , i , plt , options )
0 commit comments