Changeset 4857 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Mar 19, 2021 12:56:44 PM (3 years ago)
Author:
vondreele
Message:

Add new button to Covariance page - Show last shift/esd bar plot
Add PlotNamedFloatBarGraph? to G2plot to do it.
Fix a missing default on get in ReportProblems? in G2strMain

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r4850 r4857  
    57055705##### PlotBarGraph ################################################################################
    57065706def PlotBarGraph(G2frame,Xarray,Xname='',Yname='Number',Title='',PlotName=None,ifBinned=False,maxBins=None):
    5707     'Needs a description'
     5707    ''' does a vertical bar graph
     5708    '''
    57085709   
    57095710    def OnPageChanged(event):
     
    57465747    Page.canvas.draw()
    57475748
     5749##### PlotNamedFloatBarGraph ################################################################################
     5750def 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   
    57485785##### PlotSASDSizeDist ################################################################################
    57495786def PlotSASDSizeDist(G2frame):
     
    67756812        imgAx = Img.axes
    67766813        ytics = imgAx.get_yticks()
     6814        imgAx.set_yticks(ytics[:-1])
    67776815        ylabs = [Page.varyList[int(i)] for i in ytics[:-1]]
    67786816        imgAx.set_yticklabels(ylabs)
Note: See TracChangeset for help on using the changeset viewer.