@@ -411,13 +411,14 @@ def get_data(self, msg):
411
411
412
412
413
413
class BagTopicPlotter :
414
- def __init__ (self , bags , topics , plot_arrays = True , plot_headers = True , plot_format = 'png' , plot_style = '.-' , bag_time = False ):
414
+ def __init__ (self , bags , topics , plot_arrays = True , plot_headers = True , plot_format = 'png' , plot_style = '.-' , bag_time = False , out_suffix = '' ):
415
415
self ._bags = bags
416
416
self ._plot_arrays = plot_arrays
417
417
self ._plot_headers = plot_headers
418
418
self ._plot_format = plot_format
419
419
self ._plot_style = plot_style
420
420
self ._bag_time = bag_time
421
+ self ._out_suffix = out_suffix
421
422
422
423
self ._bag_topic_helpers = {}
423
424
for bag in self ._bags :
@@ -512,7 +513,7 @@ def __init__(self, bags, topics, plot_arrays=True, plot_headers=True, plot_forma
512
513
513
514
plt .legend (plottable_topics , loc = 0 )
514
515
515
- plt .savefig (bag .replace ('.bag' , '' ) + '.' + self ._plot_format )
516
+ plt .savefig (bag .replace ('.bag' , '' ) + self . _out_suffix + '.' + self ._plot_format )
516
517
517
518
plt .close (fig )
518
519
except OverflowError as e :
@@ -617,11 +618,12 @@ def get_plot_fields(self, topic_name):
617
618
parser .add_argument ('--plot_format' , help = 'output plot format' , default = 'png' )
618
619
parser .add_argument ('--plot_style' , help = 'output plot style' , default = '.-' )
619
620
parser .add_argument ('--bag_time' , help = 'use bag time instead of msg header time' , action = 'store_true' )
621
+ parser .add_argument ('--out_suffix' , help = 'output suffix' , default = '' )
620
622
621
623
args = parser .parse_args ()
622
624
623
625
try :
624
- BagTopicPlotter (args .bags , args .topics , not args .noarr , not args .nohdr , args .plot_format , args .plot_style , args .bag_time )
626
+ BagTopicPlotter (args .bags , args .topics , not args .noarr , not args .nohdr , args .plot_format , args .plot_style , args .bag_time , args . out_suffix )
625
627
except Exception , e :
626
628
import traceback
627
629
traceback .print_exc ()
0 commit comments