Ignore:
Timestamp:
Jan 17, 2012 1:07:33 PM (12 years ago)
Author:
Jae Cho <jhjcho@…>
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:
4e65505
Parents:
f706e09c
Message:

Added quickplot on data in datapanel

Location:
plottools/src/danse/common/plottools
Files:
2 edited

Legend:

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

    rf80236f r7434020  
    2121from binder import BindArtist 
    2222from matplotlib.font_manager import FontProperties 
     23 
     24from mpl_toolkits.mplot3d import Axes3D 
     25#from matplotlib import cm 
     26#from matplotlib.ticker import LinearLocator, FixedLocator, FormatStrFormatter 
    2327 
    2428DEBUG = False 
     
    119123        wx.Panel.__init__(self, parent, id=id, **kwargs) 
    120124        self.parent = parent 
     125        self.dimension = 1 
    121126        self.gotLegend = 0  #to begin, legend is not picked.  
    122127        self.legend_pos_loc = None 
     
    14271432         
    14281433        """ 
    1429         #Re-adjust colorbar 
    1430         self.figure.subplots_adjust(left=0.2, right=.8, bottom=.2)         
    14311434        self.data = data 
    14321435        self.qx_data = qx_data 
     
    14701473            zmin_temp = self.zmin_2D 
    14711474        self.cmap = cmap 
    1472         im = self.subplot.imshow(output, interpolation='nearest',  
    1473                                  origin='lower', 
    1474                                  vmin=zmin_temp, vmax=self.zmax_2D, 
    1475                                  cmap=self.cmap,  
    1476                                  extent=(self.xmin_2D, self.xmax_2D, 
    1477                                             self.ymin_2D, self.ymax_2D)) 
    1478          
    1479         #Add color bar and its label 
    1480         #TODO: make the size and location interactive to the image plot. 
    1481         cbax = self.subplot.figure.add_axes([0.84,0.2,0.02,0.7]) 
    1482         cb = self.subplot.figure.colorbar(im, cax=cbax) 
     1475        if self.dimension != 3: 
     1476            #Re-adjust colorbar 
     1477            self.subplot.figure.subplots_adjust(left=0.2, right=.8, bottom=.2) 
     1478             
     1479            im = self.subplot.imshow(output, interpolation='nearest',  
     1480                                     origin='lower', 
     1481                                     vmin=zmin_temp, vmax=self.zmax_2D, 
     1482                                     cmap=self.cmap,  
     1483                                     extent=(self.xmin_2D, self.xmax_2D, 
     1484                                                self.ymin_2D, self.ymax_2D)) 
     1485            cbax = self.subplot.figure.add_axes([0.84,0.2,0.02,0.7]) 
     1486        else: 
     1487            # clear the previous 2D from memory 
     1488            self.subplot.figure.clf() 
     1489            self.subplot.figure.subplots_adjust(left=0.1, right=.8, bottom=.1)   
     1490            try: 
     1491                # mpl >= 1.0.0 
     1492                ax = self.subplot.figure.gca(projection='3d') 
     1493                #ax.disable_mouse_rotation() 
     1494                cbax = self.subplot.figure.add_axes([0.84,0.1,0.02,0.8]) 
     1495            except: 
     1496                # mpl < 1.0.0 
     1497                ax =  Axes3D(self.subplot.figure) 
     1498                cbax = None 
     1499 
     1500            X = self.x_bins[0:-1] 
     1501            Y = self.y_bins[0:-1] 
     1502            X, Y = numpy.meshgrid(X, Y) 
     1503     
     1504            im = ax.plot_surface(X, Y, output, rstride=1, cstride=1, cmap=cmap, 
     1505                                   linewidth=0, antialiased=False) 
     1506            #ax.set_zlim3d(zmin_temp, self.zmax_2D) 
     1507            #ax.set_frame_on(False) 
     1508            self.subplot.set_axis_off()     
     1509             
     1510        if cbax == None: 
     1511            cb =self.subplot.figure.colorbar(im, shrink=0.6, aspect=20) 
     1512        else: 
     1513            cb =self.subplot.figure.colorbar(im, cax=cbax) 
    14831514        cb.update_bruteforce(im) 
    14841515        cb.set_label(self.scale) 
    1485         self.subplot.figure.canvas.draw_idle() 
     1516         
     1517        #if self.dimension != 3: 
     1518        self.figure.canvas.draw_idle() 
    14861519     
    14871520    def _build_matrix(self): 
  • plottools/src/danse/common/plottools/canvas.py

    r0e553fd r7434020  
    250250         
    251251        """ 
    252         if sys.platform == 'linux2': 
     252        if sys.platform == 'linux2' or self.panel.dimension == 3: 
    253253            evt.Skip() 
    254254        else: 
Note: See TracChangeset for help on using the changeset viewer.