Changeset 4786 for trunk


Ignore:
Timestamp:
Jan 28, 2021 1:05:18 PM (2 years ago)
Author:
vondreele
Message:

use set_box_aspect to make 3D plot scales correct. one in four places. A test routine (RenderLabel2) is being tried to improve atom labelling speed (doesn't work).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r4782 r4786  
    977977            Page.Choice += ('w: select |DFsq|/sig','1: select |DFsq|>sig','3: select |DFsq|>3sig',)
    978978    try:
    979         Plot.set_aspect(aspect='equal')
    980     except:  #broken in mpl 3.1.1; worked in mpl 3.0.3
     979        Plot.set_box_aspect((1,1,1))
     980#                Plot.set_aspect('equal')
     981    except: #broken in mpl 3.1.1; worked in mpl 3.0.3
    981982        pass
    982983   
     
    53305331            Plot.set_ylabel(labelY)
    53315332            Plot.set_zlabel(labelZ)
    5332             Plot.set_aspect('equal')
     5333            try:
     5334                Plot.set_box_aspect((1,1,1))
     5335#                Plot.set_aspect('equal')
     5336            except: #broken in mpl 3.1.1; worked in mpl 3.0.3
     5337                pass
    53335338        # except:
    53345339        #     print('Plot3dXYZ failure')
     
    60176022            Plot.set_zlim3d(XYZlim)
    60186023            try:
    6019                 Plot.set_aspect('equal')
     6024                Plot.set_box_aspect((1,1,1))
     6025#                Plot.set_aspect('equal')
    60206026            except: #broken in mpl 3.1.1; worked in mpl 3.0.3
    60216027                pass
     
    62926298                Plot.set_zlim3d(XYZlim)
    62936299                try:
    6294                     Plot.set_aspect('equal')
     6300                    Plot.set_box_aspect((1,1,1))
     6301    #                Plot.set_aspect('equal')
    62956302                except: #broken in mpl 3.1.1; worked in mpl 3.0.3
    6296                     pass                       
     6303                    pass
    62976304                Plot.set_title('%d %d %d Pole distribution for %s'%(h,k,l,pName))
    62986305                Plot.set_xlabel(r'X, MRD')
     
    91669173        GL.glPopMatrix()
    91679174       
     9175    def RenderLabel2(x,y,z,label,r,color,matRot,offset=wx.RealPoint(0.,0.)):
     9176        '''
     9177        color wx.Colour object - doesn't work
     9178        '''                     
     9179        figure = mpl.figure.Figure(figsize=(1.,1.),facecolor=(0.,0.,0.,0.))
     9180        figure.clf()
     9181        canvas = hcCanvas(figure)
     9182        ax0 = figure.add_subplot(111)
     9183        ax0.text(0.,0.,label)
     9184        ax0.axis("off")
     9185        figure.subplots_adjust(bottom=0.,top=1.,left=0.,right=1.,wspace=0.,hspace=0.)
     9186        agg = canvas.switch_backends(hcCanvas)
     9187        agg.draw()
     9188        img, (width, height) = agg.print_to_buffer()
     9189        Timg = np.frombuffer(img, np.uint8).reshape((height, width, 4))
     9190        RenderViewPlane(1.0*eplane,Timg,width,height)
     9191       
     9192       
    91689193    def RenderMap(rho,rhoXYZ,indx,Rok):
    91699194        GL.glShadeModel(GL.GL_FLAT)
Note: See TracChangeset for help on using the changeset viewer.