Skip to content

Commit 4c95522

Browse files
committed
make legend font size =10 (looks better & doesn't cover as much)
for instrument parms plot: change alp & bet labels to Greek. make tick font=14
1 parent de849b1 commit 4c95522

File tree

1 file changed

+66
-65
lines changed

1 file changed

+66
-65
lines changed

GSASII/GSASIIplot.py

Lines changed: 66 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class G2PlotMpl(_tabPlotWin):
213213
'Creates a Matplotlib 2-D plot in the GSAS-II graphics window'
214214
def __init__(self,parent,id=-1,dpi=None,publish=None,**kwargs):
215215
_tabPlotWin.__init__(self,parent,id=id,**kwargs)
216-
mpl.rcParams['legend.fontsize'] = 12
216+
mpl.rcParams['legend.fontsize'] = 10
217217
mpl.rcParams['axes.grid'] = False
218218
#TODO: set dpi here via config var: this changes the size of the labeling font 72-100 is normal
219219
self.figure = mplfig.Figure(dpi=dpi,figsize=(5,6))
@@ -1177,8 +1177,8 @@ def OnPick(event):
11771177
# print 'plot time: %.3f'%(time.time()-time0)
11781178
HKL = np.array(HKL)
11791179
HKLF = np.array(HKLF)
1180-
Plot.set_xlabel(xlabel[izone]+str(Data['Layer']),fontsize=12)
1181-
Plot.set_ylabel(ylabel[izone],fontsize=12)
1180+
Plot.set_xlabel(xlabel[izone]+str(Data['Layer']),fontsize=14)
1181+
Plot.set_ylabel(ylabel[izone],fontsize=14)
11821182
if sumFo and sumDF:
11831183
G2frame.G2plotNB.status.SetStatusText(xlabel[izone].split(',')[1]+str(Data['Layer'])+ \
11841184
' layer R = %6.2f%s'%(100.*sumDF/sumFo,'%'),1)
@@ -2228,7 +2228,7 @@ def OnRelease(event):
22282228
ContourZ.append(Y)
22292229
ContourX = X
22302230
Nseq += 1
2231-
Plot.set_ylabel('Data sequence',fontsize=12)
2231+
Plot.set_ylabel('Data sequence',fontsize=14)
22322232
else:
22332233
ifCalc = False
22342234
X = xye[0]+Page.Offset[0]*.005*N
@@ -2514,9 +2514,9 @@ def OnMotion(event):
25142514
def Draw():
25152515
global xylim
25162516
Plot.clear()
2517-
Plot.set_title(Title,fontsize=16)
2518-
Plot.set_xlabel(r''+labelX,fontsize=16)
2519-
Plot.set_ylabel(r''+labelY,fontsize=16)
2517+
Plot.set_title(Title,fontsize=14)
2518+
Plot.set_xlabel(r''+labelX,fontsize=14)
2519+
Plot.set_ylabel(r''+labelY,fontsize=14)
25202520
Plot.tick_params(labelsize=14)
25212521
colors = ['xkcd:blue','xkcd:red','xkcd:green','xkcd:cyan','xkcd:magenta','xkcd:black',
25222522
'xkcd:pink','xkcd:brown','xkcd:teal','xkcd:orange','xkcd:grey','xkcd:violet',]
@@ -3239,7 +3239,7 @@ def OnKeyPress(event):
32393239
Y = []
32403240
Z = []
32413241
W = []
3242-
Plot.set_title('Instrument peak widths')
3242+
Plot.set_title('Instrument peak widths',fontsize=14)
32433243
Plot.set_xlabel(r'$Q, \AA^{-1}$',fontsize=14)
32443244
Plot.set_ylabel(r'$\Delta Q/Q, \Delta d/d$',fontsize=14)
32453245
negWarn = False
@@ -3256,8 +3256,8 @@ def OnKeyPress(event):
32563256
S = 1.17741*np.sqrt(data[8])/T
32573257
G = data[10]/T
32583258
W = G2pwd.getFWHM(T,Parms,0)/T
3259-
Plot.plot(Q,A,color='r',label='Alpha/1000')
3260-
Plot.plot(Q,B,color='orange',label='Beta/1000')
3259+
Plot.plot(Q,A,color='r',label=r'$\alpha/1000$')
3260+
Plot.plot(Q,B,color='orange',label=r'$\beta/1000$')
32613261
Plot.plot(Q,S,color='b',label='Gaussian')
32623262
Plot.plot(Q,G,color='m',label='Lorentzian')
32633263
Plot.plot(Q,W,color='g',label='FWHM (GL+ab)')
@@ -3273,8 +3273,8 @@ def OnKeyPress(event):
32733273
Sf = 1.17741*np.sqrt(fit[8])/T
32743274
Gf = fit[10]/T
32753275
Wf = G2pwd.getFWHM(T,Parms)/T
3276-
Plot.plot(Q,Af,color='r',dashes=(5,5),label='A/1000 fit')
3277-
Plot.plot(Q,Bf,color='orange',dashes=(5,5),label='B/1000 fit')
3276+
Plot.plot(Q,Af,color='r',dashes=(5,5),label=r'$\alpha/1000$ fit')
3277+
Plot.plot(Q,Bf,color='orange',dashes=(5,5),label=r'$\beta/1000$ fit')
32783278
Plot.plot(Q,Sf,color='b',dashes=(5,5),label='G fit')
32793279
Plot.plot(Q,Gf,color='m',label='L fit')
32803280
Plot.plot(Q,Wf,color='g',dashes=(5,5),label='FWHM fit (GL+ab)')
@@ -3305,15 +3305,16 @@ def OnKeyPress(event):
33053305

33063306
if Qp:
33073307
if G2frame.ErrorBars:
3308-
Plot.errorbar(Qp,Ap,xerr=sQp,yerr=sAp,fmt='r+',capsize=2,label='A/1000 peak')
3309-
Plot.errorbar(Qp,Bp,xerr=sQp,yerr=sBp,fmt='+',color='orange',capsize=2,label='B/1000 peak')
3308+
Plot.errorbar(Qp,Ap,xerr=sQp,yerr=sAp,fmt='r+',capsize=2,label=r'$\alpha/1000$ peak')
3309+
Plot.errorbar(Qp,Bp,xerr=sQp,yerr=sBp,fmt='+',color='orange',capsize=2,label=r'$\beta/1000$ peak')
33103310
Plot.errorbar(Qp,Sp,xerr=sQp,yerr=sSp,fmt='b+',capsize=2,label='G peak')
33113311
Plot.errorbar(Qp,Gp,xerr=sQp,yerr=sGp,fmt='m+',capsize=2,label='L peak')
33123312
else:
3313-
Plot.plot(Qp,Ap,'+',color='r',label='A/1000 peak')
3314-
Plot.plot(Qp,Bp,'+',color='orange',label='B/1000 peak')
3313+
Plot.plot(Qp,Ap,'+',color='r',label=r'$\alpha/1000$ peak')
3314+
Plot.plot(Qp,Bp,'+',color='orange',label=r'$\beta/1000$ peak')
33153315
Plot.plot(Qp,Sp,'+',color='b',label='G peak')
33163316
Plot.plot(Qp,Gp,'+',color='m',label='L peak')
3317+
Plot.tick_params(labelsize=14)
33173318
Plot.legend(loc='best')
33183319
elif 'E' in Parms['Type'][0]:
33193320
# TODO: add error bars to individual peak parms
@@ -3369,8 +3370,8 @@ def OnKeyPress(event):
33693370
Plot.plot(Xp,Yp,'+',color='r',label='G peak')
33703371
Plot.plot(Xp,Zp,'+',color='g',label='L peak')
33713372
Plot.plot(Xp,Wp,'+',color='b',label='G+L peak')
3372-
legend = Plot.legend(loc='best')
3373-
SetupLegendPick(legend,new)
3373+
Plot.tick_params(labelsize=14)
3374+
Plot.legend(loc='best')
33743375
Page.canvas.draw()
33753376

33763377
else: #'A', 'C' & 'B'
@@ -3397,8 +3398,8 @@ def OnKeyPress(event):
33973398
Z = g/nptand(X/2.)
33983399
W = G/nptand(X/2.)
33993400
if Parms['Type'][0][2] in ['A','B']:
3400-
Plot.plot(Q,A,color='r',label='Alpha/1000')
3401-
Plot.plot(Q,B,color='orange',label='Beta/1000')
3401+
Plot.plot(Q,A,color='r',label=r'$\alpha/1000$')
3402+
Plot.plot(Q,B,color='orange',label=r'$\beta/1000$')
34023403
Plot.plot(Q,Y,color='r',label='Gaussian')
34033404
Plot.plot(Q,Z,color='g',label='Lorentzian')
34043405
Plot.plot(Q,W,color='b',label='G+L')
@@ -3417,8 +3418,8 @@ def OnKeyPress(event):
34173418
Zf = gf/nptand(X/2.)
34183419
Wf = Gf/nptand(X/2.)
34193420
if Parms['Type'][0][2] in ['A','B']:
3420-
Plot.plot(Q,Af,color='r',dashes=(5,5),label='A/1000 fit')
3421-
Plot.plot(Q,Bf,color='orange',dashes=(5,5),label='B/1000 fit')
3421+
Plot.plot(Q,Af,color='r',dashes=(5,5),label=r'$\alpha/1000$ fit')
3422+
Plot.plot(Q,Bf,color='orange',dashes=(5,5),label=r'$\beta/1000$ fit')
34223423
Plot.plot(Q,Yf,color='r',dashes=(5,5),label='G fit')
34233424
Plot.plot(Q,Zf,color='g',dashes=(5,5),label='L fit')
34243425
Plot.plot(Q,Wf,color='b',dashes=(5,5),label='G+L fit')
@@ -3459,19 +3460,19 @@ def OnKeyPress(event):
34593460
if len(peaks):
34603461
if G2frame.ErrorBars:
34613462
if Parms['Type'][0][2] in ['A','B']:
3462-
Plot.errorbar(Xp,Ap,xerr=sQp,yerr=sAp,fmt='r+',capsize=2,label='A/1000 peak')
3463-
Plot.errorbar(Xp,Bp,xerr=sQp,yerr=sBp,fmt='+',color='orange',capsize=2,label='B/1000 peak')
3463+
Plot.errorbar(Xp,Ap,xerr=sQp,yerr=sAp,fmt='r+',capsize=2,label=r'$\alpha/1000$ peak')
3464+
Plot.errorbar(Xp,Bp,xerr=sQp,yerr=sBp,fmt='+',color='orange',capsize=2,label=r'$\beta/1000$ peak')
34643465
Plot.errorbar(Xp,Yp,xerr=sXp,yerr=sYp,fmt='r+',capsize=2,label='G peak')
34653466
Plot.errorbar(Xp,Zp,xerr=sXp,yerr=sZp,fmt='g+',capsize=2,label='L peak')
34663467
else:
34673468
if Parms['Type'][0][2] in ['A','B']:
3468-
Plot.plot(Xp,Ap,'+',color='r',label='A/1000 peak')
3469-
Plot.plot(Xp,Bp,'+',color='orange',label='B/1000 peak')
3469+
Plot.plot(Xp,Ap,'+',color='r',label=r'$\alpha/1000$ peak')
3470+
Plot.plot(Xp,Bp,'+',color='orange',label=r'$\beta/1000$ peak')
34703471
Plot.plot(Xp,Yp,'+',color='r',label='G peak')
34713472
Plot.plot(Xp,Zp,'+',color='g',label='L peak')
34723473
Plot.plot(Xp,Wp,'+',color='b',label='G+L peak')
3473-
legend = Plot.legend(loc='best')
3474-
SetupLegendPick(legend,new)
3474+
Plot.tick_params(labelsize=14)
3475+
Plot.legend(loc='best')
34753476
Page.canvas.draw()
34763477
if negWarn:
34773478
Plot.set_title('WARNING: profile coefficients yield negative peak widths; peaks may be skipped in calcuations')
@@ -3736,7 +3737,7 @@ def genMustrain(xyz,SGData,A,Shkl):
37363737
Plot.plot(X,Y,color='k',label=str(PH))
37373738
Plot.legend(loc='best')
37383739
Plot.set_title('Axial distribution for HKL='+str(PH)+' in '+phase+'\n'+hist)
3739-
Plot.set_xlabel(r'$\psi$',fontsize=16)
3740+
Plot.set_xlabel(r'$\psi$',fontsize=14)
37403741
Plot.set_ylabel('MRD',fontsize=14)
37413742
elif 'Inv. pole figure' in plotType:
37423743
sq2 = 1.0/math.sqrt(2.0)
@@ -3922,7 +3923,7 @@ def OnPick(event):
39223923
Plot.legend(loc='best')
39233924
h,k,l = SHData['PFhkl']
39243925
Plot.set_title('%d %d %d Axial distribution for %s'%(h,k,l,pName))
3925-
Plot.set_xlabel(r'$\psi$',fontsize=16)
3926+
Plot.set_xlabel(r'$\psi$',fontsize=14)
39263927
Plot.set_ylabel('MRD',fontsize=14)
39273928

39283929
else:
@@ -4308,8 +4309,8 @@ def OnMotion(event):
43084309
Plot.plot(Angles,Eval,'ro',picker=True,pickradius=5)
43094310
Plot.set_xlim((0.,360.))
43104311
Plot.set_title('Torsion angles for '+TorName+' in '+phaseName)
4311-
Plot.set_xlabel('angle',fontsize=16)
4312-
Plot.set_ylabel('Energy',fontsize=16)
4312+
Plot.set_xlabel('angle',fontsize=14)
4313+
Plot.set_ylabel('Energy',fontsize=14)
43134314
Page.canvas.draw()
43144315

43154316
#### PlotRama ################################################################################
@@ -4399,8 +4400,8 @@ def OnMotion(event):
43994400
Plot.set_xlim((0.,360.))
44004401
Plot.set_ylim((0.,360.))
44014402
Plot.set_title('Ramachandran for '+RamaName+' in '+phaseName)
4402-
Plot.set_xlabel(r'$\phi$',fontsize=16)
4403-
Plot.set_ylabel(r'$\psi$',fontsize=16)
4403+
Plot.set_xlabel(r'$\phi$',fontsize=14)
4404+
Plot.set_ylabel(r'$\psi$',fontsize=14)
44044405
Page.figure.colorbar(Img)
44054406
Page.canvas.draw()
44064407

@@ -5433,15 +5434,15 @@ def OnImRelease(event):
54335434
# try:
54345435
Plot1,Plot = Page.figure.subplots(1,2,gridspec_kw=GS_kw)
54355436
Plot1.set_title('Line scan at azm= %6.1f'%Data['linescan'][1])
5436-
Plot1.set_xlabel(r'$\mathsf{2\Theta}$',fontsize=12)
5437-
Plot1.set_ylabel('Intensity',fontsize=12)
5437+
Plot1.set_xlabel(r'$\mathsf{2\Theta}$',fontsize=14)
5438+
Plot1.set_ylabel('Intensity',fontsize=14)
54385439
xy = G2img.GetLineScan(G2frame.ImageZ,Data)
54395440
olderr = np.seterr(invalid='ignore') #get around sqrt(-ve) error
54405441
if Page.plotStyle['logPlot']:
54415442
xy[1] = np.log(xy[1])
5442-
Plot1.set_ylabel('log(Intensity)',fontsize=12)
5443+
Plot1.set_ylabel('log(Intensity)',fontsize=14)
54435444
elif Page.plotStyle['sqrtPlot']:
5444-
Plot1.set_ylabel(r'$\sqrt{Intensity}$',fontsize=12)
5445+
Plot1.set_ylabel(r'$\sqrt{Intensity}$',fontsize=14)
54455446
xy[1] = np.sqrt(xy[1])
54465447
np.seterr(invalid=olderr['invalid'])
54475448
Plot1.plot(xy[0],xy[1])
@@ -5498,8 +5499,8 @@ def OnImRelease(event):
54985499
xcent,ycent = Data['center']
54995500
if Data['det2theta']:
55005501
xcent += Data['distance']*nptand(Data['tilt']*npsind(Data['rotation'])+Data['det2theta'])
5501-
Plot.set_xlabel('Image x-axis, mm',fontsize=12)
5502-
Plot.set_ylabel('Image y-axis, mm',fontsize=12)
5502+
Plot.set_xlabel('Image x-axis, mm',fontsize=14)
5503+
Plot.set_ylabel('Image y-axis, mm',fontsize=14)
55035504
#do threshold mask - "real" mask - others are just boundaries
55045505
Zlim = Masks['Thresholds'][1]
55055506
wx.BeginBusyCursor()
@@ -5785,8 +5786,8 @@ def OnMotion(event):
57855786
Imin,Imax = Data['range'][1]
57865787
acolor = GetColorMap(Data['color'])
57875788
Plot.set_title(G2frame.GPXtree.GetItemText(G2frame.Image)[4:])
5788-
Plot.set_ylabel('azimuth',fontsize=12)
5789-
Plot.set_xlabel('2-theta',fontsize=12)
5789+
Plot.set_ylabel('azimuth',fontsize=14)
5790+
Plot.set_xlabel('2-theta',fontsize=14)
57905791
Img = Plot.imshow(image,cmap=acolor,vmin=Imin,vmax=Imax,interpolation='nearest', \
57915792
extent=[ysc[0],ysc[-1],xsc[-1],xsc[0]],aspect='auto')
57925793
Page.figure.colorbar(Img)
@@ -5846,8 +5847,8 @@ def OnMotion(event):
58465847
V = np.arange(Imin,Imax,step)
58475848
acolor = GetColorMap(Data['color'])
58485849
Plot.set_title(G2frame.GPXtree.GetItemText(G2frame.Image)[4:])
5849-
Plot.set_xlabel('azimuth',fontsize=12)
5850-
Plot.set_ylabel('2-theta',fontsize=12)
5850+
Plot.set_xlabel('azimuth',fontsize=14)
5851+
Plot.set_ylabel('2-theta',fontsize=14)
58515852
Plot.contour(tax,tay,taz,V,cmap=acolor)
58525853
if Data['showLines']:
58535854
IOtth = Data['IOtth']
@@ -8834,8 +8835,8 @@ def OnPick(event):
88348835
bbox_transform=Plot.transAxes,borderpad=0)
88358836
Page.figure.colorbar(Page.ImgObj, cax=cax)
88368837
Plot.set_title(Title+' distances')
8837-
Plot.set_xlabel('Data set',fontsize=12)
8838-
Plot.set_ylabel('Data set',fontsize=12)
8838+
Plot.set_xlabel('Data set',fontsize=14)
8839+
Plot.set_ylabel('Data set',fontsize=14)
88398840
elif CLuDict['plots'] == 'Suprise':
88408841
Suprise = []
88418842
for I in CLuDict['DataMatrix']:
@@ -8845,18 +8846,18 @@ def OnPick(event):
88458846
Suprise.append(S)
88468847
Plot.plot(Suprise)
88478848
Plot.set_title('Suprise factor')
8848-
Plot.set_xlabel('Data no.',fontsize=12)
8849-
Plot.set_ylabel('Suprise factor',fontsize=12)
8849+
Plot.set_xlabel('Data no.',fontsize=14)
8850+
Plot.set_ylabel('Suprise factor',fontsize=14)
88508851
elif CLuDict['plots'] == 'Dendrogram':
88518852
SCH.dendrogram(CLuDict['CLuZ'],orientation='right',ax=Plot)
88528853
Plot.set_title('%s %s'%(CLuDict['LinkMethod'],Title))
8853-
Plot.set_xlabel(r''+'data set no.',fontsize=12)
8854-
Plot.set_ylabel(r''+CLuDict['Method']+' distance',fontsize=12)
8854+
Plot.set_xlabel(r''+'data set no.',fontsize=14)
8855+
Plot.set_ylabel(r''+CLuDict['Method']+' distance',fontsize=14)
88558856
elif CLuDict['plots'] == 'Diffs' and YM is not None:
88568857
Plot.plot(neighD)
88578858
Plot.set_title('Distance to next data set')
8858-
Plot.set_xlabel('Data no.',fontsize=12)
8859-
Plot.set_ylabel('dist to next',fontsize=12)
8859+
Plot.set_xlabel('Data no.',fontsize=14)
8860+
Plot.set_ylabel('dist to next',fontsize=14)
88608861
elif CLuDict['plots'] == '2D PCA':
88618862
if Codes is not None:
88628863
for ixyz,xyz in enumerate(XYZ.T):
@@ -8874,9 +8875,9 @@ def OnPick(event):
88748875
else:
88758876
for ixyz,xyz in enumerate(XYZ.T):
88768877
Plot.scatter(xyz[0],xyz[1],xyz[2],color=Colors[0],picker=True)
8877-
Plot.set_xlabel('PCA axis-1',fontsize=12)
8878-
Plot.set_ylabel('PCA axis-2',fontsize=12)
8879-
Plot.set_zlabel('PCA axis-3',fontsize=12)
8878+
Plot.set_xlabel('PCA axis-1',fontsize=14)
8879+
Plot.set_ylabel('PCA axis-2',fontsize=14)
8880+
Plot.set_zlabel('PCA axis-3',fontsize=14)
88808881
else:
88818882
Plot.set_visible(False) #hide old plot frame, will get replaced below
88828883
gs = mpl.gridspec.GridSpec(2,2,figure=Page.figure)
@@ -8889,27 +8890,27 @@ def OnPick(event):
88898890
bbox_transform=ax1.transAxes,borderpad=0)
88908891
Page.figure.colorbar(Page.ImgObj, cax=cax)
88918892
ax1.set_title(Title+' distances')
8892-
ax1.set_xlabel('Data set',fontsize=12)
8893-
ax1.set_ylabel('Data set',fontsize=12)
8893+
ax1.set_xlabel('Data set',fontsize=14)
8894+
ax1.set_ylabel('Data set',fontsize=14)
88948895
if Codes is not None:
88958896
for ixyz,xyz in enumerate(XYZ.T):
88968897
ax2.scatter(xyz[0],xyz[1],color=Colors[Codes[ixyz]],picker=True)
88978898
else:
88988899
for ixyz,xyz in enumerate(XYZ.T):
88998900
ax2.scatter(xyz[0],xyz[1],color=Colors[0],picker=True)
8900-
ax2.set_xlabel('PCA axis-1',fontsize=12)
8901-
ax2.set_ylabel('PCA axis-2',fontsize=12)
8901+
ax2.set_xlabel('PCA axis-1',fontsize=14)
8902+
ax2.set_ylabel('PCA axis-2',fontsize=14)
89028903
if YM is not None:
89038904
ax4.plot(neighD)
8904-
ax4.set_xlabel('Data no.',fontsize=12)
8905-
ax4.set_ylabel('dist to next',fontsize=12)
8905+
ax4.set_xlabel('Data no.',fontsize=14)
8906+
ax4.set_ylabel('dist to next',fontsize=14)
89068907
if CLuDict['CLuZ'] is not None:
89078908
SCH.dendrogram(CLuDict['CLuZ'],orientation='right',ax=ax3)
89088909
ax3.set_title('%s %s'%(CLuDict['LinkMethod'],Title))
8909-
ax3.set_ylabel(r''+'data set no.',fontsize=12)
8910-
ax3.set_xlabel(r''+CLuDict['Method']+' distance',fontsize=12)
8910+
ax3.set_ylabel(r''+'data set no.',fontsize=14)
8911+
ax3.set_xlabel(r''+CLuDict['Method']+' distance',fontsize=14)
89118912
else:
89128913
ax3.plot(100.*CLuDict['PCA'][:10]/np.sum(CLuDict['PCA']))
8913-
ax3.set_xlabel('PCA index',fontsize=12)
8914-
ax3.set_ylabel('% of total',fontsize=12)
8914+
ax3.set_xlabel('PCA index',fontsize=14)
8915+
ax3.set_ylabel('% of total',fontsize=14)
89158916
Page.canvas.draw()

0 commit comments

Comments
 (0)