Changeset 3344


Ignore:
Timestamp:
Apr 15, 2018 12:23:54 PM (4 years ago)
Author:
toby
Message:

add more publication plot options

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrlGUI.py

    r3342 r3344  
    47074707    ['CWInstDemo', 'FindProfParamCW.htm',  'Determining Starting Profile Parameters from a Standard',
    47084708     '''This shows how to determine approximate profile parameters by fitting individual peaks
    4709         from a standard with data collected on a standard lab instrument.'''],
     4709        with data collected on a standard using a lab diffractometer.'''],
    47104710   
    47114711    ['Parametric Rietveld fitting'],
     
    50455045    # test Tutorial access
    50465046    #======================================================================
    5047     # dlg = OpenTutorial(frm)
    5048     # if dlg.ShowModal() == wx.ID_OK:
    5049     #     print "OK"
    5050     # else:
    5051     #     print "Cancel"
    5052     # dlg.Destroy()
    5053     # sys.exit()
     5047    dlg = OpenTutorial(frm)
     5048    if dlg.ShowModal() == wx.ID_OK:
     5049        print("OK")
     5050    else:
     5051        print("Cancel")
     5052    dlg.Destroy()
     5053    sys.exit()
    50545054    #======================================================================
    50555055    # test ScrolledMultiEditor
  • trunk/GSASIIplot.py

    r3325 r3344  
    234234# options for publication-quality Rietveld plots
    235235plotOpt = {}
    236 plotOpt['labelsize'] = 11
     236plotOpt['labelSize'] = '11'
    237237plotOpt['dpi'] = 600
    238238plotOpt['width'] = 8.
     
    29272927            else:
    29282928                plotOpt['format'] = plotOpt['fmtChoices'][0]
     2929        plotOpt['lineWid'] = '1'
     2930        plotOpt['tickSiz'] = '6'
     2931        plotOpt['tickWid'] = '1'
     2932        plotOpt['markerWid'] = '1'
     2933        plotOpt['markerSiz'] = '8'
     2934        plotOpt['markerSym'] = '+'
    29292935        #if mpl.__version__.split('.')[0] == '1':
    29302936        #    G2G.G2MessageBox(G2frame.plotFrame,
     
    30603066            dlg.EndModal(wx.ID_OK)
    30613067           
    3062     def onTextSize(event):
    3063         '''Respond to a change in text size from the slider
    3064         '''
    3065         if plotOpt['labelsize'] != event.GetInt():
    3066             plotOpt['labelsize'] = event.GetInt()
    3067             RefreshPlot()
    3068            
    30693068    def OnSelectColour(event):
    30703069        '''Respond to a change in color
     
    30843083                style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
    30853084    vbox = wx.BoxSizer(wx.VERTICAL)
    3086     # text size slider
    3087     hbox = wx.BoxSizer(wx.HORIZONTAL)
    3088     hbox.Add((1,1),1,wx.EXPAND,1)
    3089     txt = wx.StaticText(dlg,wx.ID_ANY,'Text size')
    3090     hbox.Add(txt,0,wx.ALL|wx.ALIGN_CENTER_VERTICAL)
    3091     slider = wx.Slider(dlg, wx.ID_ANY, plotOpt['labelsize'],
    3092                        10, 25, size=(250, -1),
    3093                 style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS
    3094             )
    3095     slider.Bind(wx.EVT_SLIDER,onTextSize)
    3096     hbox.Add(slider,0,wx.ALL)
     3085   
     3086    # size choices
     3087    symChoices = ('+','x','.','o','^','v','*','|')
     3088    txtChoices = [str(i) for i in range (8,26)]
     3089    sizChoices = [str(i) for i in range (2,21)]
     3090    lwidChoices = ('0.5','0.7','1','1.5','2','2.5','3','4')
     3091    sizebox = wx.BoxSizer(wx.HORIZONTAL)
     3092    sizebox.Add(wx.StaticText(dlg,wx.ID_ANY,'Text size'),0,wx.ALL)
     3093    w = G2G.G2ChoiceButton(dlg,txtChoices,None,None,plotOpt,'labelSize',RefreshPlot,
     3094                                   size=(50,-1))
     3095    sizebox.Add(w,0,wx.ALL|wx.ALIGN_CENTER)
     3096    sizebox.Add((1,1),1,wx.EXPAND,1)
     3097    sizebox.Add(wx.StaticText(dlg,wx.ID_ANY,' Obs type'),0,wx.ALL)
     3098    w = G2G.G2ChoiceButton(dlg,symChoices,None,None,plotOpt,'markerSym',RefreshPlot,
     3099                                   size=(40,-1))
     3100    sizebox.Add(w,0,wx.ALL|wx.ALIGN_CENTER)
     3101    sizebox.Add(wx.StaticText(dlg,wx.ID_ANY,' size'),0,wx.ALL)
     3102    w = G2G.G2ChoiceButton(dlg,sizChoices,None,None,plotOpt,'markerSiz',RefreshPlot,
     3103                                   size=(50,-1))
     3104    sizebox.Add(w,0,wx.ALL|wx.ALIGN_CENTER)
     3105    sizebox.Add(wx.StaticText(dlg,wx.ID_ANY,' width'),0,wx.ALL)
     3106    w = G2G.G2ChoiceButton(dlg,lwidChoices,None,None,plotOpt,'markerWid',RefreshPlot,
     3107            size=(50,-1))
     3108    sizebox.Add(w,0,wx.ALL|wx.ALIGN_CENTER)
     3109    sizebox.Add((1,1),1,wx.EXPAND,1)
     3110    sizebox.Add(wx.StaticText(dlg,wx.ID_ANY,' Line widths'),0,wx.ALL)
     3111    w = G2G.G2ChoiceButton(dlg,lwidChoices,None,None,plotOpt,'lineWid',RefreshPlot,
     3112            size=(50,-1))
     3113    sizebox.Add(w,0,wx.ALL|wx.ALIGN_CENTER)
     3114    sizebox.Add((1,1),1,wx.EXPAND,1)
     3115    sizebox.Add(wx.StaticText(dlg,wx.ID_ANY,' Tick size'),0,wx.ALL)
     3116    w = G2G.G2ChoiceButton(dlg,sizChoices,None,None,plotOpt,'tickSiz',RefreshPlot,
     3117            size=(50,-1))
     3118    sizebox.Add(w,0,wx.ALL|wx.ALIGN_CENTER)
     3119    sizebox.Add(wx.StaticText(dlg,wx.ID_ANY,' width'),0,wx.ALL)
     3120    w = G2G.G2ChoiceButton(dlg,lwidChoices,None,None,plotOpt,'tickWid',RefreshPlot,
     3121            size=(50,-1))
     3122    sizebox.Add(w,0,wx.ALL|wx.ALIGN_CENTER)
     3123    sizebox.Add((1,1),1,wx.EXPAND,1)
     3124    helpinfo = '''----   Help on creating hard copy   ----
     3125    Select options such as the size of text and colors for plot contents here.
     3126   
     3127    Tricks:
     3128    * Use a color of pure white to remove an element from the plot (light
     3129    gray is plotted)
     3130    * LaTeX-like coding can be used for phase labels such as
     3131    $\\rm FeO_2$ (for a subscript 2) or $\\gamma$-Ti for a Greek "gamma"
     3132   
     3133    Note that the dpi value is ignored for svg and pdf files, which are
     3134    drawn with vector graphics (infinite resolution).
     3135    '''
     3136    hlp = G2G.HelpButton(dlg,helpinfo)
     3137    sizebox.Add(hlp,0,wx.ALL)
     3138    vbox.Add(sizebox,0,wx.ALL|wx.EXPAND)
    30973139   
    30983140    # table of colors and legend options
     
    31203162        plotOpt['colorButtons'][b] = lbl
    31213163        gsizer.Add(b,0,wx.ALL|wx.ALIGN_CENTER)
    3122     helpinfo = '''----   Help on creating hard copy   ----
    3123     Select options such as the size of text and colors for plot contents here.
    3124    
    3125     Tricks:
    3126     * Use a color of pure white to remove an element from the plot (light
    3127     gray is plotted)
    3128     * LaTeX-like coding can be used for phase labels such as
    3129     $\\rm FeO_2$ (for a subscript 2) or $\\gamma$-Ti for a Greek "gamma"
    3130    
    3131     Note that the dpi value is ignored for svg and pdf files, which are
    3132     drawn with vector graphics (infinite resolution).
    3133     '''
    3134     if len(plotOpt['phaseList']) > 3: # lots of phases: move table to separate line
    3135         hlp = G2G.HelpButton(dlg,helpinfo)
    3136         hbox.Add((1,1),1,wx.EXPAND,1)
    3137         hbox.Add(hlp,0,wx.ALL|wx.ALIGN_RIGHT)
    3138         vbox.Add(hbox,0,wx.ALL|wx.EXPAND)
    3139         vbox.Add(gsizer,0,wx.ALL|wx.ALIGN_CENTER)
    3140     else:
    3141         hbox.Add(gsizer,0,wx.ALL)
    3142         hbox.Add((1,1),1,wx.EXPAND,1)
    3143         hlp = G2G.HelpButton(dlg,helpinfo)
    3144         hbox.Add(hlp,0,wx.ALL)
    3145         vbox.Add(hbox,0,wx.ALL|wx.EXPAND)
     3164    hbox = wx.BoxSizer(wx.HORIZONTAL)
     3165    hbox.Add((1,1),1,wx.EXPAND,1)
     3166    hbox.Add(gsizer,0,wx.ALL)
     3167    hbox.Add((1,1),1,wx.EXPAND,1)
     3168    vbox.Add(hbox,0,wx.ALL|wx.EXPAND)
    31463169
    31473170    # hard copy options
     
    32033226    ax0 = figure.add_subplot(gs[0])
    32043227    ax1 = figure.add_subplot(gs[1])
    3205     figure.subplots_adjust(left=plotOpt['labelsize']/100.,bottom=plotOpt['labelsize']/150.,
    3206                            right=.98,top=1.-plotOpt['labelsize']/200.,hspace=0.0)
     3228    figure.subplots_adjust(left=int(plotOpt['labelSize'])/100.,bottom=int(plotOpt['labelSize'])/150.,
     3229                           right=.98,top=1.-int(plotOpt['labelSize'])/200.,hspace=0.0)
    32073230    ax0.tick_params('x',direction='in',labelbottom=False)
    3208     ax0.tick_params(labelsize=plotOpt['labelsize'])
    3209     ax1.tick_params(labelsize=plotOpt['labelsize'])
     3231    ax0.tick_params(labelsize=plotOpt['labelSize'])
     3232    ax1.tick_params(labelsize=plotOpt['labelSize'])
    32103233    if mpl.__version__.split('.')[0] == '1': # deal with older matplotlib, which puts too many ticks
    32113234        ax1.yaxis.set_major_locator(mpl.ticker.MaxNLocator(nbins=2))
    32123235        ax1.yaxis.set_minor_locator(mpl.ticker.MaxNLocator(nbins=4))
    3213     ax1.set_xlabel(Plot.get_xlabel(),fontsize=plotOpt['labelsize'])
    3214     ax0.set_ylabel(Plot.get_ylabel(),fontsize=plotOpt['labelsize'])
    3215     ax1.set_ylabel(r'$\Delta/\sigma$',fontsize=plotOpt['labelsize'])
     3236    ax1.set_xlabel(Plot.get_xlabel(),fontsize=plotOpt['labelSize'])
     3237    ax0.set_ylabel(Plot.get_ylabel(),fontsize=plotOpt['labelSize'])
     3238    ax1.set_ylabel(r'$\Delta/\sigma$',fontsize=plotOpt['labelSize'])
    32163239    ax0.set_xlim(Plot.get_xlim())
    32173240    ax1.set_xlim(Plot.get_xlim())
     
    32253248            ax0.axvline(l.get_data()[0][0],color='0.5',dashes=(1,1))
    32263249        elif lbl[1:] in ('obs','calc','bkg','zero','diff'):
     3250            marker = l.get_marker()
     3251            lineWid = l.get_lw()
     3252            siz = l.get_markersize()
     3253            mew = l.get_mew()
     3254            if lbl[1:] == 'obs':
     3255                siz = plotOpt['markerSiz']
     3256                marker = plotOpt['markerSym']
     3257                mew = plotOpt['markerWid']
     3258            else:
     3259                lineWid = plotOpt['lineWid']
    32273260            c = plotOpt['colors'].get(lbl[1:],l.get_color())
    32283261            if sum(c) == 4.0: continue
     
    32323265                uselbl = lbl
    32333266            art = ax0.plot(l.get_xdata(),l.get_ydata(),color=c,
    3234                      lw=l.get_lw(),label=uselbl,ls=l.get_ls(),
    3235                      marker=l.get_marker(),ms=l.get_ms()
     3267                     lw=lineWid,label=uselbl,ls=l.get_ls(),
     3268                     marker=marker,ms=siz,mew=mew,
    32363269                     )
    32373270            if plotOpt['legend'].get(lbl[1:]):
     
    32403273        elif l in Page.tickDict.values():
    32413274            c = plotOpt['colors'].get(lbl,l.get_color())
     3275            #siz = l.get_markersize()
     3276            siz = plotOpt['tickSiz']
     3277            #mew = l.get_mew()
     3278            mew = plotOpt['tickWid']
    32423279            if sum(c) == 4.0: continue
    32433280            if not plotOpt['legend'].get(lbl):
     
    32473284            art = ax0.plot(l.get_xdata(),l.get_ydata(),color=c,
    32483285                     lw=l.get_lw(),ls=l.get_ls(),label=uselbl,
    3249                      marker=l.get_marker(),ms=l.get_ms(),
     3286                     marker=l.get_marker(),ms=siz,mew=mew,
    32503287                     )
    32513288            if plotOpt['legend'].get(lbl):
     
    32583295                    verticalalignment='bottom',
    32593296                    horizontalalignment=l.get_horizontalalignment(),
    3260                     fontsize=plotOpt['labelsize'])
     3297                    fontsize=plotOpt['labelSize'])
    32613298    rsig = np.sqrt(Pattern[1][2])
    32623299    rsig[rsig>1] = 1
    32633300    ax1.plot(Pattern[1][0],Pattern[1][5]*rsig,color='k')
    32643301    if legLine:
    3265         ax0.legend(legLine,legLbl,loc='best',prop={'size':plotOpt['labelsize']})
     3302        ax0.legend(legLine,legLbl,loc='best',prop={'size':plotOpt['labelSize']})
    32663303   
    32673304################################################################################
  • trunk/help/Tutorials.html

    r3343 r3344  
    2929<LI><A href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/CWInstDemo/FindProfParamCW.htm">Determining Starting Profile Parameters from a Standard</A>
    3030 [link: <A href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/CWInstDemo/data">Exercise files</A>].
     31<UL><LI><I>This shows how to determine approximate profile parameters by fitting individual peaks
     32        with data collected on a standard using a lab diffractometer.</I></UL>
    3133</UL><h4>Parametric Rietveld fitting</H4><UL>
    3234<LI><A href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/SeqRefine/SequentialTutorial.htm">Sequential refinement of multiple datasets</A>
  • trunk/makeTutorial.py

    r3343 r3344  
    2020import os
    2121import GSASIIpath
     22#import GSASIIctrl as G2G
    2223
    2324if __name__ == '__main__':
     
    3435    dirs = [d[:-1] for d in GSASIIpath.svnList(tutURL,False).split('\n') if d and d[-1] == '/']   
    3536    for d in dirs:
    36         if d not in dirList: print(u"makeTutorial: tutorial directory not in GSASIIctrlGUI.tutorialIndex: "+d)
     37        if d not in dirList: print(u"Tutorial directory not in GSASIIctrlGUI.tutorialIndex: "+d)
    3738
    3839    #import sys
     
    7071            else:
    7172                print(' [No exercise files].',file=out)
     73            if len(l) > 3:
     74                print("<UL><LI><I>"+l[3]+"</I></UL>",file=out)
    7275            if suffix: print('</UL>',file=out)
    7376    #        if l[2][0] == ' ':
Note: See TracChangeset for help on using the changeset viewer.