Changeset 6356
- Timestamp:
- Feb 17, 2009, 4:03:35 PM (16 years ago)
- Location:
- misc/tools/plotcsv
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
misc/tools/plotcsv/installer/plotcsv.nsi
r6348 r6356 1 1 !define PRODUCT_NAME "plotcsv" 2 !define PRODUCT_VERSION "0. 1"2 !define PRODUCT_VERSION "0.2" 3 3 !define ICON_FILE "plotcsv.ico" 4 4 -
misc/tools/plotcsv/plotcsv.py
r6352 r6356 13 13 import time 14 14 import getopt 15 import pylab16 15 try: 17 16 import cpickle 18 17 except: 19 18 import pickle 19 20 try: 21 import pylab 22 except ImportError: 23 import tkinter_error 24 msg = ('Sorry, you have to install matplotlib.\n' 25 'Get it from either:\n' 26 r' N:\georisk\downloads\matplotlib, or' '\n' 27 ' [http://matplotlib.sourceforge.net/].\n\n' 28 'You will also need to have numpy installed:\n' 29 r' N:\georisk\downloads\numpy') 30 tkinter_error.tkinter_error(msg) 31 print msg 32 sys.exit(1) 20 33 21 34 try: … … 40 53 # program name and version 41 54 APP_NAME = 'plotcsv' 42 APP_VERSION = '0. 1'55 APP_VERSION = '0.2' 43 56 44 57 # name of the configuration filename … … 59 72 BOX_CSV_HEIGHT = 265 60 73 BOX_PLOT_WIDTH = 400 61 BOX_PLOT_HEIGHT = 9074 BOX_PLOT_HEIGHT = 140 62 75 63 76 TXT_CSVFILE_WIDTH = 390 … … 70 83 71 84 FORM_WIDTH = BOX_WIDTH + 15 72 FORM_HEIGHT = 4 0585 FORM_HEIGHT = 455 73 86 74 87 START_YOFFSET = 7 … … 291 304 # @param x_hdr The X axis label string. 292 305 # @param y_hdr The Y axis label string. 293 def plot_files(filenames, x_hdr, y_hdr ):306 def plot_files(filenames, x_hdr, y_hdr, title='', legend=False): 294 307 pylab.rc('axes', linewidth=2) 295 308 pylab.xlabel(x_hdr.title()) … … 301 314 pylab.plot(x_data, y_data) 302 315 303 (min_y, max_y) = pylab.ylim() 304 range_y = max_y - min_y 305 add_y = float(range_y) / 5 306 pylab.ylim((min_y, max_y+add_y)) 307 pylab.legend(filenames, 'upper left') 316 if title: 317 pylab.title(title) 318 if legend: 319 (min_y, max_y) = pylab.ylim() 320 range_y = max_y - min_y 321 add_y = float(range_y) / 5 322 pylab.ylim((min_y, max_y+add_y)) 323 pylab.legend(filenames, 'upper left') 308 324 309 325 pylab.show() … … 369 385 self.cbYColHdr = wx.Choice(p, -1, pos=(x+65, Y_OFFSET), size=(80, -1)) 370 386 self.YColHdr = [] 371 387 Y_OFFSET += GEN_DELTAY*2 388 389 self.chkLegend = wx.CheckBox(p, -1, " Show graph legend", 390 pos=(COLLAB_X_OFFSET, Y_OFFSET)) 391 392 Y_OFFSET += GEN_DELTAY 393 wx.StaticText(p, -1, 'Title', 394 pos=(18, Y_OFFSET+LAB_CTRL_OFFSET+2), style=wx.ALIGN_LEFT) 395 self.txtTitle = wx.TextCtrl(p, -1, "", size=(350, -1), 396 pos=(COLLAB_X_OFFSET+20, 397 Y_OFFSET+LAB_CTRL_OFFSET), 398 style=wx.ALIGN_LEFT) 399 372 400 Y_OFFSET += BUTTON_HEIGHT + MARGIN 373 401 x = FORM_WIDTH/2 - BUTTON_WIDTH/2 … … 438 466 self.cfg['YColHdrSelection'] = self.cbYColHdr.GetSelection() 439 467 self.cfg['file_dir'] = self.file_dir 468 self.cfg['GraphTitle'] = self.txtTitle.GetValue() 469 self.cfg['GraphLegend'] = self.chkLegend.GetValue() 440 470 441 471 self.cfg.save() … … 473 503 if self.YColHdrSelection >= 0: 474 504 self.cbYColHdr.SetSelection(self.YColHdrSelection) 505 title = self.cfg['GraphTitle'] 506 if title is None: 507 title = '' 508 self.txtTitle.SetValue(title) 509 if self.cfg['GraphLegend']: 510 self.chkLegend.SetValue(True) 475 511 476 512 def getHeaders(self, filename): … … 556 592 557 593 if selected_x and selected_y: 558 plot_files(self.CSVFiles, selected_x, selected_y) 594 plot_files(self.CSVFiles, selected_x, selected_y, 595 title=self.txtTitle.GetValue(), 596 legend=self.chkLegend.GetValue()) 559 597 560 598 def error(self, msg):
Note: See TracChangeset
for help on using the changeset viewer.