- Timestamp:
- Jun 18, 2008 6:08:43 PM (17 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- aa4b8379
- Parents:
- fc2b91a
- Location:
- guitools
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
guitools/PlotPanel.py
rad8bcd6 r4972de2 14 14 from plottables import Theory1D 15 15 #TODO: make the plottables interactive 16 from binder import BindArtist 16 17 17 18 DEBUG = False 18 print "hello"19 19 20 20 from plottables import Graph … … 149 149 150 150 self.axes = [self.subplot] 151 152 # Interactor 153 self.connect = BindArtist(self.subplot.figure) 154 #self.selected_plottable = None 155 151 156 # new data for the fit 152 157 self.fit_result = Theory1D(x=[], y=[], dy=None) … … 560 565 # if trigger == 'xlim': self._connect_to_xlim(callback) 561 566 567 def interactive_points(self,x,y,dx=None,dy=None,name='', color=0,symbol=0,label=None): 568 """Draw markers with error bars""" 569 self.subplot.set_yscale('linear') 570 self.subplot.set_xscale('linear') 571 572 from plottable_interactor import PointInteractor 573 p = PointInteractor(self, self.subplot, zorder=3, id=name) 574 p.points(x, y, dx, dy, color, symbol, label) 575 576 self.subplot.set_yscale(self.yscale) 577 self.subplot.set_xscale(self.xscale) 578 579 def interactive_curve(self,x,y,dy=None,name='',color=0,symbol=0,label=None): 580 """Draw markers with error bars""" 581 self.subplot.set_yscale('linear') 582 self.subplot.set_xscale('linear') 583 584 from plottable_interactor import PointInteractor 585 p = PointInteractor(self, self.subplot, zorder=4, id=name) 586 p.curve(x, y, dy, color, symbol, label) 587 588 self.subplot.set_yscale(self.yscale) 589 self.subplot.set_xscale(self.xscale) 590 591 def plottable_selected(self, id): 592 """ 593 Called to register a plottable as selected 594 """ 595 #TODO: check that it really is in the list of plottables 596 self.graph.selected_plottable = id 597 562 598 def points(self,x,y,dx=None,dy=None,color=0,symbol=0,label=None): 563 599 """Draw markers with error bars""" -
guitools/plottables.py
r052a66bc r4972de2 236 236 return labels 237 237 238 def get_plottable(self, name): 239 """ 240 Return the plottable with the given 241 name if it exists. Otherwise return None 242 """ 243 for item in self.plottables: 244 if item.name==name: 245 return item 246 return None 247 238 248 def returnPlottable(self): 239 249 """ … … 246 256 def render(self,plot): 247 257 """Redraw the graph""" 258 plot.connect.clearall() 259 248 260 plot.clear() 249 261 plot.properties(self.prop) … … 258 270 self.reset() 259 271 self.set(**kw) 272 273 # Name of selected plottable, if any 274 self.selected_plottable = None 260 275 261 276 … … 352 367 short_name = None 353 368 369 # Fancy name 370 name = None 371 354 372 # Data 355 373 x = None … … 360 378 # Parameter to allow a plot to be part of the list without being displayed 361 379 hidden = False 380 381 # Flag to set whether a plottable has an interactor or not 382 interactive = True 362 383 363 384 def __setattr__(self, name, value): … … 801 822 802 823 def render(self,plot,**kw): 803 plot.points(self.view.x,self.view.y,dx=self.view.dx,dy=self.view.dy,**kw) 804 824 """ 825 Renders the plottable on the graph 826 """ 827 if self.interactive==True: 828 plot.interactive_points(self.view.x,self.view.y, 829 dx=self.view.dx,dy=self.view.dy, 830 name=self.name, **kw) 831 else: 832 plot.points(self.view.x,self.view.y,dx=self.view.dx,dy=self.view.dy,**kw) 805 833 806 834 def changed(self): … … 835 863 836 864 def render(self,plot,**kw): 837 plot.curve(self.view.x,self.view.y,dy=self.view.dy,**kw) 865 if self.interactive==True: 866 plot.interactive_curve(self.view.x,self.view.y, 867 dy=self.view.dy, 868 name=self.name,**kw) 869 else: 870 plot.curve(self.view.x,self.view.y,dy=self.view.dy,**kw) 871 838 872 839 873 def changed(self):
Note: See TracChangeset
for help on using the changeset viewer.