Changeset 64f1e93 in sasview for src/sas/qtgui/Plotter2D.py
- Timestamp:
- Dec 7, 2016 5:47:22 AM (7 years ago)
- Branches:
- 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
- Children:
- 416fa8f
- Parents:
- 55d89f8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Plotter2D.py
r55d89f8 r64f1e93 9 9 import sas.qtgui.PlotUtilities as PlotUtilities 10 10 from sas.qtgui.PlotterBase import PlotterBase 11 from mpl_toolkits.mplot3d import Axes3D 11 12 12 13 class Plotter2D(PlotterBase): … … 40 41 Plot 2D self._data 41 42 """ 42 # create an axis object43 # Toggle the scale 43 44 zmin_2D_temp = self.zmin 44 45 zmax_2D_temp = self.zmax … … 60 61 zmax_2D_temp = numpy.log10(self.zmax) 61 62 62 self.image(data=self.data.data, qx_data=self.qx_data, 63 qy_data=self.qy_data, xmin=self.xmin, 64 xmax=self.xmax, 65 ymin=self.ymin, ymax=self.ymax, 66 cmap=self.cmap, zmin=zmin_2D_temp, 67 zmax=zmax_2D_temp) 63 # Prepare and show the plot 64 self.showPlot(data=self.data.data, 65 qx_data=self.qx_data, 66 qy_data=self.qy_data, 67 xmin=self.xmin, 68 xmax=self.xmax, 69 ymin=self.ymin, ymax=self.ymax, 70 cmap=self.cmap, zmin=zmin_2D_temp, 71 zmax=zmax_2D_temp) 68 72 69 73 def contextMenuQuickPlot(self): … … 96 100 self.plot() 97 101 98 def image(self, data, qx_data, qy_data, xmin, xmax, ymin, ymax,99 zmin, zmax, color=0, symbol=0, markersize=0,100 label='data2D', cmap=DEFAULT_CMAP):102 def showPlot(self, data, qx_data, qy_data, xmin, xmax, ymin, ymax, 103 zmin, zmax, color=0, symbol=0, markersize=0, 104 label='data2D', cmap=DEFAULT_CMAP): 101 105 """ 102 Render the current data106 Render and show the current data 103 107 """ 104 108 self.qx_data = qx_data … … 152 156 else: 153 157 # clear the previous 2D from memory 154 # mpl is not clf, so we do155 158 self.figure.clear() 156 159 … … 161 164 X, Y = numpy.meshgrid(X, Y) 162 165 163 try: 164 # mpl >= 1.0.0 165 ax = self.figure.gca(projection='3d') 166 cbax = self.figure.add_axes([0.84, 0.1, 0.02, 0.8]) 167 if len(X) > 60: 168 ax.disable_mouse_rotation() 169 except: 170 # mpl < 1.0.0 171 try: 172 from mpl_toolkits.mplot3d import Axes3D 173 except: 174 logging.error("PlotPanel could not import Axes3D") 175 self.figure.clear() 176 ax = Axes3D(self.figure) 177 if len(X) > 60: 178 ax.cla() 179 cbax = None 166 ax = Axes3D(self.figure) 167 cbax = self.figure.add_axes([0.84, 0.1, 0.02, 0.8]) 168 # Disable rotation for large sets. 169 # TODO: Define "large" for a dataset 170 SET_TOO_LARGE = 500 171 if len(X) > SET_TOO_LARGE: 172 ax.disable_mouse_rotation() 173 180 174 self.figure.canvas.resizing = False 181 175 im = ax.plot_surface(X, Y, output, rstride=1, cstride=1, cmap=cmap, … … 190 184 cb.update_bruteforce(im) 191 185 cb.set_label('$' + self.scale + '$') 186 192 187 if self.dimension != 3: 193 188 self.figure.canvas.draw_idle()
Note: See TracChangeset
for help on using the changeset viewer.