Changeset 8f59e95 in sasview for plottools/src/danse/common


Ignore:
Timestamp:
Jul 4, 2012 4:56:50 AM (12 years ago)
Author:
Kieran Campbell <kieranrcampbell@…>
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:
8a687cfd
Parents:
d560a37
Message:

New dialog added for modifying graph appearance (axes & legend)

Location:
plottools/src/danse/common/plottools
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • plottools/src/danse/common/plottools/PlotPanel.py

    r9bab141 r8f59e95  
    948948        self.onContextMenu(event) 
    949949         
    950     def onLegend(self, event): 
     950# modified kieranrcampbell ILL june2012 
     951    def onLegend(self,legOnOff): 
    951952        """ 
    952953        Toggles whether legend is visible/not visible 
    953954        """ 
    954955         
    955         if self.legend_on: 
     956        if not legOnOff: 
    956957            for ax in self.axes: 
    957958                self.remove_legend(ax) 
     
    971972         
    972973        self.subplot.figure.canvas.draw_idle() 
    973         self.legend_on = not self.legend_on 
     974        self.legend_on = legOnOff 
    974975     
     976 
     977    # to do - remove this function when done 
     978 
    975979    def onChangeLegendLoc(self, event): 
    976980        """ 
     
    9971001        self.subplot.figure.canvas.draw_idle() 
    9981002         
     1003 
     1004    def ChangeLegendLoc(self, label): 
     1005        """ 
     1006        Changes legend loc based on user input 
     1007        """ 
     1008         
     1009        self.legendLoc = label 
     1010        self.legend_pos_loc = None 
     1011        # sort them by labels 
     1012        handles, labels = self.subplot.get_legend_handles_labels() 
     1013        hl = sorted(zip(handles, labels), 
     1014                    key=operator.itemgetter(1)) 
     1015        handles2, labels2 = zip(*hl) 
     1016        self.line_collections_list = handles2 
     1017        self.legend = self.subplot.legend(handles2, labels2, 
     1018                            prop=FontProperties(size=10), numpoints=1, 
     1019                            handletextsep=.05, loc=self.legendLoc) 
     1020        if self.legend != None: 
     1021                self.legend.set_picker(self.legend_picker) 
     1022                self.legend.set_axes(self.subplot) 
     1023        self.subplot.figure.canvas.draw_idle() 
     1024         
     1025 
     1026 
     1027 
    9991028    def remove_legend(self, ax=None): 
    10001029        """ 
     
    10481077        #based on this and plot it at user designated coordinates 
    10491078 
    1050     def onGridOnOff(self, event): 
     1079    def onGridOnOff(self,gridon_off): 
    10511080        """ 
    10521081        Allows ON/OFF Grid 
    10531082        """ 
    1054         if self.grid_on: 
    1055             self.grid_on = False 
    1056         else: 
    1057             self.grid_on = True 
     1083        self.grid_on = gridon_off 
     1084 
    10581085        self.subplot.figure.canvas.draw_idle() 
    10591086         
     
    12661293         
    12671294        """ 
     1295 
     1296        self.xcolor = color 
    12681297        if units != "": 
    12691298            label = label + " (" + units + ")" 
     
    12841313    def yaxis(self, label, units, font=None, color='black', t_font=None): 
    12851314        """yaxis label and units.""" 
     1315        self.ycolor = color 
     1316 
    12861317        if units != "": 
    12871318            label = label + " (" + units + ")" 
Note: See TracChangeset for help on using the changeset viewer.