Changeset 4857 for trunk/GSASIIplot.py
- Timestamp:
- Mar 19, 2021 12:56:44 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIplot.py
r4850 r4857 5705 5705 ##### PlotBarGraph ################################################################################ 5706 5706 def PlotBarGraph(G2frame,Xarray,Xname='',Yname='Number',Title='',PlotName=None,ifBinned=False,maxBins=None): 5707 'Needs a description' 5707 ''' does a vertical bar graph 5708 ''' 5708 5709 5709 5710 def OnPageChanged(event): … … 5746 5747 Page.canvas.draw() 5747 5748 5749 ##### PlotNamedFloatBarGraph ################################################################################ 5750 def PlotNamedFloatHBarGraph(G2frame,Xvals,Ynames,Xlabel='Value',Ylabel='',Title='',PlotName=None): 5751 ''' does a horizintal bar graph 5752 ''' 5753 5754 def OnPageChanged(event): 5755 PlotText = G2frame.G2plotNB.nb.GetPageText(G2frame.G2plotNB.nb.GetSelection()) 5756 if PlotText == PlotName: 5757 PlotNamedFloatHBarGraph(G2frame,Xvals,Ynames,Xlabel,Ylabel,Title,PlotText) 5758 5759 def OnMotion(event): 5760 if event.ydata is None: 5761 return 5762 ypos = int(event.ydata+.5) 5763 if ypos and ypos < len(Ynames): #avoid out of frame mouse position 5764 SetCursor(Page) 5765 try: 5766 G2frame.G2plotNB.status.SetStatusText('X =%s %s = %9.3g'%(Ynames[ypos],Xlabel,Xvals[ypos]),1) 5767 except TypeError: 5768 G2frame.G2plotNB.status.SetStatusText('Select %s first'%PlotName,1) 5769 5770 if PlotName is None or not len(Ynames): 5771 return 5772 new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab(PlotName,'mpl') 5773 if new: 5774 G2frame.G2plotNB.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED,OnPageChanged) 5775 Page.canvas.mpl_connect('motion_notify_event', OnMotion) 5776 Yvals = np.arange(len(Ynames)) 5777 colors = ['blue' if x >= 0. else 'red' for x in Xvals] 5778 Page.Choice = None 5779 Plot.set_title(Title) 5780 Plot.set_xlabel(Xlabel,fontsize=14) 5781 Plot.set_ylabel(Ylabel,fontsize=14) 5782 Plot.barh(Yvals,Xvals,height=0.8,align='center',color=colors,edgecolor='black',tick_label=Ynames) 5783 Page.canvas.draw() 5784 5748 5785 ##### PlotSASDSizeDist ################################################################################ 5749 5786 def PlotSASDSizeDist(G2frame): … … 6775 6812 imgAx = Img.axes 6776 6813 ytics = imgAx.get_yticks() 6814 imgAx.set_yticks(ytics[:-1]) 6777 6815 ylabs = [Page.varyList[int(i)] for i in ytics[:-1]] 6778 6816 imgAx.set_yticklabels(ylabs)
Note: See TracChangeset
for help on using the changeset viewer.