- Timestamp:
- Jul 4, 2012 4:56:50 AM (12 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:
- 8a687cfd
- Parents:
- d560a37
- Location:
- plottools/src/danse/common/plottools
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plottools/src/danse/common/plottools/PlotPanel.py
r9bab141 r8f59e95 948 948 self.onContextMenu(event) 949 949 950 def onLegend(self, event): 950 # modified kieranrcampbell ILL june2012 951 def onLegend(self,legOnOff): 951 952 """ 952 953 Toggles whether legend is visible/not visible 953 954 """ 954 955 955 if self.legend_on:956 if not legOnOff: 956 957 for ax in self.axes: 957 958 self.remove_legend(ax) … … 971 972 972 973 self.subplot.figure.canvas.draw_idle() 973 self.legend_on = not self.legend_on974 self.legend_on = legOnOff 974 975 976 977 # to do - remove this function when done 978 975 979 def onChangeLegendLoc(self, event): 976 980 """ … … 997 1001 self.subplot.figure.canvas.draw_idle() 998 1002 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 999 1028 def remove_legend(self, ax=None): 1000 1029 """ … … 1048 1077 #based on this and plot it at user designated coordinates 1049 1078 1050 def onGridOnOff(self, event):1079 def onGridOnOff(self,gridon_off): 1051 1080 """ 1052 1081 Allows ON/OFF Grid 1053 1082 """ 1054 if self.grid_on: 1055 self.grid_on = False 1056 else: 1057 self.grid_on = True 1083 self.grid_on = gridon_off 1084 1058 1085 self.subplot.figure.canvas.draw_idle() 1059 1086 … … 1266 1293 1267 1294 """ 1295 1296 self.xcolor = color 1268 1297 if units != "": 1269 1298 label = label + " (" + units + ")" … … 1284 1313 def yaxis(self, label, units, font=None, color='black', t_font=None): 1285 1314 """yaxis label and units.""" 1315 self.ycolor = color 1316 1286 1317 if units != "": 1287 1318 label = label + " (" + units + ")"
Note: See TracChangeset
for help on using the changeset viewer.