Changeset 6358 for misc/tools/plotcsv/plotcsv.py
- Timestamp:
- Feb 18, 2009, 8:50:16 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
misc/tools/plotcsv/plotcsv.py
r6356 r6358 83 83 84 84 FORM_WIDTH = BOX_WIDTH + 15 85 FORM_HEIGHT = 45 585 FORM_HEIGHT = 450 86 86 87 87 START_YOFFSET = 7 … … 304 304 # @param x_hdr The X axis label string. 305 305 # @param y_hdr The Y axis label string. 306 def plot_files(filenames, x_hdr, y_hdr, title='', legend=False): 306 # @param title The string used to title the graph. 307 # @param legend True if a legend is to be displayed. 308 # @param legend_path True if legend is to contain full file paths. 309 def plot_files(filenames, x_hdr, y_hdr, title='', legend=False, 310 legend_path=False): 307 311 pylab.rc('axes', linewidth=2) 308 312 pylab.xlabel(x_hdr.title()) … … 321 325 add_y = float(range_y) / 5 322 326 pylab.ylim((min_y, max_y+add_y)) 323 pylab.legend(filenames, 'upper left') 327 legend_names = filenames 328 if not legend_path: 329 legend_names = [os.path.basename(x) for x in filenames] 330 pylab.legend(legend_names, 'upper right') 331 # pylab.legend(legend_names, 'upper left') 324 332 325 333 pylab.show() … … 388 396 389 397 self.chkLegend = wx.CheckBox(p, -1, " Show graph legend", 390 pos=(COLLAB_X_OFFSET, Y_OFFSET)) 391 392 Y_OFFSET += GEN_DELTAY 398 pos=(COLLAB_X_OFFSET+20, Y_OFFSET)) 399 self.chkLegendPath = wx.CheckBox(p, -1, " Full file path in legend", 400 pos=(COLLAB_X_OFFSET+180, Y_OFFSET)) 401 Y_OFFSET += GEN_DELTAY + 3 402 393 403 wx.StaticText(p, -1, 'Title', 394 404 pos=(18, Y_OFFSET+LAB_CTRL_OFFSET+2), style=wx.ALIGN_LEFT) … … 407 417 self.Bind(wx.EVT_BUTTON, self.DelCSVFile, self.btnDelCSVFile) 408 418 self.Bind(wx.EVT_BUTTON, self.PlotFiles, self.btnPlot) 419 self.Bind(wx.EVT_CHECKBOX, self.ChangeLegend, self.chkLegend) 409 420 410 421 self.Bind(wx.EVT_CLOSE, self.doStateSave) … … 457 468 self.updateHdrChoices() 458 469 470 def ChangeLegend(self, event): 471 if self.chkLegend.GetValue(): 472 self.chkLegendPath.Enable() 473 else: 474 self.chkLegendPath.Disable() 475 459 476 def doStateSave(self, event): 460 477 """Save state from 'self' variables & controls.""" … … 468 485 self.cfg['GraphTitle'] = self.txtTitle.GetValue() 469 486 self.cfg['GraphLegend'] = self.chkLegend.GetValue() 487 self.cfg['LegendPath'] = self.chkLegendPath.GetValue() 470 488 471 489 self.cfg.save() … … 509 527 if self.cfg['GraphLegend']: 510 528 self.chkLegend.SetValue(True) 511 529 if self.cfg['LegendPath']: 530 self.chkLegendPath.SetValue(True) 531 self.ChangeLegend(None) 532 512 533 def getHeaders(self, filename): 513 534 '''Get header list from a file''' … … 594 615 plot_files(self.CSVFiles, selected_x, selected_y, 595 616 title=self.txtTitle.GetValue(), 596 legend=self.chkLegend.GetValue()) 617 legend=self.chkLegend.GetValue(), 618 legend_path=self.chkLegendPath.GetValue()) 597 619 598 620 def error(self, msg):
Note: See TracChangeset
for help on using the changeset viewer.