Changeset 2acedc8 in sasview for plottools/src
- Timestamp:
- Feb 13, 2013 7:38:25 PM (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:
- b11e127
- Parents:
- d24dc45
- Location:
- plottools/src/danse/common/plottools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
plottools/src/danse/common/plottools/PlotPanel.py
rf5cce4a r2acedc8 971 971 self.line_collections_list = handles2 972 972 self.legend = self.subplot.legend(handles2, labels2, 973 974 973 prop=FontProperties(size=10), numpoints=1, 974 handletextsep=.05, loc=self.legendLoc) 975 975 if self.legend != None: 976 976 self.legend.set_picker(self.legend_picker) 977 977 self.legend.set_axes(self.subplot) 978 self.legend.set_zorder(20) 978 979 979 980 self.subplot.figure.canvas.draw_idle() 980 981 982 983 # to do - remove this function when done984 981 985 982 def onChangeLegendLoc(self, event): … … 990 987 id = event.GetId() 991 988 label = menu.GetLabel(id) 992 989 self.ChangeLegendLoc(label) 990 991 def ChangeLegendLoc(self, label): 992 """ 993 Changes legend loc based on user input 994 """ 993 995 self.legendLoc = label 994 996 self.legend_pos_loc = None … … 1003 1005 handletextsep=.05, loc=self.legendLoc) 1004 1006 if self.legend != None: 1005 self.legend.set_picker(self.legend_picker) 1006 self.legend.set_axes(self.subplot) 1007 self.legend.set_picker(self.legend_picker) 1008 self.legend.set_axes(self.subplot) 1009 self.legend.set_zorder(20) 1007 1010 self.subplot.figure.canvas.draw_idle() 1008 1009 1010 def ChangeLegendLoc(self, label):1011 """1012 Changes legend loc based on user input1013 """1014 1015 self.legendLoc = label1016 self.legend_pos_loc = None1017 # sort them by labels1018 handles, labels = self.subplot.get_legend_handles_labels()1019 hl = sorted(zip(handles, labels),1020 key=operator.itemgetter(1))1021 handles2, labels2 = zip(*hl)1022 self.line_collections_list = handles21023 self.legend = self.subplot.legend(handles2, labels2,1024 prop=FontProperties(size=10), numpoints=1,1025 handletextsep=.05, loc=self.legendLoc)1026 if self.legend != None:1027 self.legend.set_picker(self.legend_picker)1028 self.legend.set_axes(self.subplot)1029 self.subplot.figure.canvas.draw_idle()1030 1031 1032 1033 1011 1034 1012 def remove_legend(self, ax=None): … … 1283 1261 self.legend.set_picker(self.legend_picker) 1284 1262 self.legend.set_axes(self.subplot) 1263 self.legend.set_zorder(20) 1285 1264 1286 1265 except: … … 1288 1267 numpoints=1, handletextsep=.05, 1289 1268 loc=self.legendLoc) 1290 1269 1291 1270 def xaxis(self, label, units, font=None, color='black', t_font=None): 1292 1271 """xaxis label and units. … … 1348 1327 1349 1328 def interactive_points(self, x, y, dx=None, dy=None, name='', color=0, 1350 symbol=0, markersize=5, id=None, label=None,1351 hide_error=False):1329 symbol=0, markersize=5, zorder=1, id=None, 1330 label=None, hide_error=False): 1352 1331 """Draw markers with error bars""" 1353 1332 self.subplot.set_yscale('linear') … … 1356 1335 id = name 1357 1336 from plottable_interactor import PointInteractor 1358 p = PointInteractor(self, self.subplot, zorder= 3, id=id)1337 p = PointInteractor(self, self.subplot, zorder=zorder, id=id) 1359 1338 if p.markersize != None: 1360 1339 markersize = p.markersize 1361 p.points(x, y, dx=dx, dy=dy, color=color, symbol=symbol, markersize=markersize, label=label,1362 hide_error=hide_error)1340 p.points(x, y, dx=dx, dy=dy, color=color, symbol=symbol, zorder=zorder, 1341 markersize=markersize, label=label, hide_error=hide_error) 1363 1342 1364 1343 self.subplot.set_yscale(self.yscale, nonposy='clip') … … 1366 1345 1367 1346 def interactive_curve(self, x, y, dy=None, name='', color=0, 1368 symbol=0, id=None, label=None):1347 symbol=0, zorder=1, id=None, label=None): 1369 1348 """Draw markers with error bars""" 1370 1349 self.subplot.set_yscale('linear') … … 1373 1352 id = name 1374 1353 from plottable_interactor import PointInteractor 1375 p = PointInteractor(self, self.subplot, zorder=4, id=id) 1376 p.curve(x, y, dy=dy, color=color, symbol=symbol, label=label) 1354 p = PointInteractor(self, self.subplot, zorder=zorder, id=id) 1355 p.curve(x, y, dy=dy, color=color, symbol=symbol, zorder=zorder, 1356 label=label) 1377 1357 1378 1358 self.subplot.set_yscale(self.yscale, nonposy='clip') -
plottools/src/danse/common/plottools/plottable_interactor.py
r6c4130a r2acedc8 35 35 return self.symbollist[s % len(self.symbollist)] 36 36 37 def points(self, x, y, dx=None, dy=None, color=0, symbol=0, markersize=5,38 label=None, hide_error=False):37 def points(self, x, y, dx=None, dy=None, color=0, symbol=0, zorder=1, 38 markersize=5, label=None, hide_error=False): 39 39 """ 40 40 """ … … 63 63 if dy != None and type(dy) == type(()): 64 64 dy = nx.vstack((y-dy[0], dy[1]-y)).transpose() 65 zorder = self.zorder65 66 66 if dx == None and dy == None: 67 67 #zorder = 1 … … 79 79 markersize=markersize, 80 80 linestyle='', label=label, 81 zorder= zorder)[0]81 zorder=1)[0] 82 82 else: 83 83 #zorder = 2 … … 94 94 xlolims=False, xuplims=False, 95 95 label=label, 96 zorder=zorder)[0] 97 98 self.connect_markers([self.marker]) 99 self.update() 100 101 def curve(self, x, y, dy=None, color=0, symbol=0, label=None, width=2.0): 96 zorder=1)[0] 97 98 self.connect_markers([self.marker]) 99 self.update() 100 101 def curve(self, x, y, dy=None, color=0, symbol=0, zorder=10, 102 label=None, width=2.0): 102 103 """ 103 104 """ … … 107 108 self.marker = self.axes.plot(x, y, color=self.color, lw=width, 108 109 marker='', linestyle=self._symbol(symbol), 109 label=label, zorder=self.zorder)[0] 110 111 self.connect_markers([self.marker]) 112 self.update() 113 114 115 def vline(self, x, y, dy=None, color=0, symbol=0, label=None, width=2.0): 110 label=label, zorder=zorder)[0] 111 112 self.connect_markers([self.marker]) 113 self.update() 114 115 116 def vline(self, x, y, dy=None, color=0, symbol=0, zorder=1, 117 label=None, width=2.0): 116 118 """ 117 119 """ … … 126 128 color=self.color, 127 129 linestyle='-', label=label, 128 lw=width, zorder=self.zorder) 129 self.connect_markers([self.marker]) 130 self.update() 131 132 def step(self, x, y, dy=None, color=0, symbol=0, label=None, width=2.0): 130 lw=width, zorder=zorder) 131 self.connect_markers([self.marker]) 132 self.update() 133 134 def step(self, x, y, dy=None, color=0, symbol=0, zorder=1, 135 label=None, width=2.0): 133 136 """ 134 137 """ … … 142 145 marker='', 143 146 linestyle='-', label=label, 144 lw=width, zorder= self.zorder)[0]147 lw=width, zorder=zorder)[0] 145 148 self.connect_markers([self.marker]) 146 149 self.update() -
plottools/src/danse/common/plottools/plottables.py
r10bfeb3 r2acedc8 1052 1052 self.markersize = 5 1053 1053 self.id = None 1054 self.zorder = 1 1054 1055 self.hide_error = False 1055 1056 … … 1065 1066 plot.interactive_points(self.view.x, self.view.y, 1066 1067 dx=self.view.dx, dy=self.view.dy, 1067 name=self.name, **kw)1068 name=self.name, zorder=self.zorder, **kw) 1068 1069 else: 1069 1070 kw['id'] = self.id … … 1073 1074 kw['markersize'] = self.markersize 1074 1075 plot.points(self.view.x, self.view.y, dx=self.view.dx, 1075 dy=self.view.dy, marker=self.symbollist[self.symbol], **kw) 1076 dy=self.view.dy, zorder=self.zorder, 1077 marker=self.symbollist[self.symbol], **kw) 1076 1078 1077 1079 def changed(self): … … 1118 1120 self.symbol = 0 1119 1121 self.id = None 1122 self.zorder = 10 1120 1123 1121 1124 def render(self, plot, **kw): … … 1126 1129 plot.interactive_curve(self.view.x, self.view.y, 1127 1130 dy=self.view.dy, 1128 name=self.name, **kw)1131 name=self.name, zorder=self.zorder, **kw) 1129 1132 else: 1130 1133 kw['id'] = self.id 1131 plot.curve(self.view.x, self.view.y, dy=self.view.dy, **kw) 1134 plot.curve(self.view.x, self.view.y, dy=self.view.dy, 1135 zorder=self.zorder, **kw) 1132 1136 1133 1137 def changed(self):
Note: See TracChangeset
for help on using the changeset viewer.