- Timestamp:
- Jan 19, 2021 11:34:26 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIplot.py
r4770 r4781 126 126 import wx.glcanvas 127 127 import matplotlib as mpl 128 import matplotlib.pyplot as plt129 128 if not mpl.get_backend(): #could be assigned by spyder debugger 130 129 mpl.use('wxAgg') … … 1227 1226 Draw() 1228 1227 1229 1230 1228 ################################################################################ 1231 1229 ##### Plot3DSngl … … 1709 1707 # if firstCall: Draw('main') # draw twice the first time that graphics are displayed 1710 1708 1711 1712 1709 ################################################################################ 1713 1710 ##### PlotPatterns … … 7122 7119 artist = Circle(spot[:2],radius=spot[2]/2,fc='none',ec='r', 7123 7120 picker=True) 7124 #GSASIIpath.IPyBreak()7125 7121 Page.figure.gca().add_artist(artist) 7126 7122 artist.itemNumber = len(Masks['Points'])-1 … … 9573 9569 Z = np.where(Zslice<=Rmax,Zslice,Rmax) 9574 9570 ZU = np.flipud(Z) 9575 plt.rcParams['figure.facecolor'] = (1.,1.,1.,.5)9576 oldSize = plt.rcParams['figure.figsize']9577 plt.rcParams['figure.figsize'] = [6.0,6.0]9578 plt.cla()9571 figure = mpl.figure.Figure(figsize=(6,6),facecolor=(1.,1.,1.,.5)) 9572 canvas = hcCanvas(figure) 9573 figure.clf() 9574 ax0 = figure.add_subplot(111) 9579 9575 if drawingData.get('showSlice') in [1,]: 9580 contourSet = plt.contour(Z,colors='k',linewidths=1)9576 contourSet = ax0.contour(Z,colors='k',linewidths=1) 9581 9577 if drawingData.get('showSlice') in [2,3]: 9582 9578 acolor = mpl.cm.get_cmap(drawingData.get('contourColor','Paired')) 9583 plt.imshow(ZU,aspect='equal',cmap=acolor,alpha=0.7,interpolation='bilinear')9579 ax0.imshow(ZU,aspect='equal',cmap=acolor,alpha=0.7,interpolation='bilinear') 9584 9580 if drawingData.get('showSlice') in [3,]: 9585 contourSet = plt.contour(ZU,colors='k',linewidths=1) 9586 plt.axis("off") 9587 plt.subplots_adjust(bottom=0.,top=1.,left=0.,right=1.,wspace=0.,hspace=0.) 9588 canvas = plt.get_current_fig_manager().canvas 9581 contourSet = ax0.contour(ZU,colors='k',linewidths=1) 9582 ax0.axis("off") 9583 figure.subplots_adjust(bottom=0.,top=1.,left=0.,right=1.,wspace=0.,hspace=0.) 9589 9584 agg = canvas.switch_backends(hcCanvas) 9590 9585 agg.draw() 9591 9586 img, (width, height) = agg.print_to_buffer() 9592 9587 Zimg = np.frombuffer(img, np.uint8).reshape((height, width, 4)) 9593 plt.rcParams['figure.facecolor'] = (1.,1.,1.,1.)9594 plt.rcParams['figure.figsize'] = oldSize9595 # agg = canvas.switch_backends(Canvas)9596 9588 RenderViewPlane(msize*eplane,Zimg,width,height) 9597 9589 try:
Note: See TracChangeset
for help on using the changeset viewer.