generate_plots: add option to adjust plot text sizes
This commit is contained in:
+18
-6
@@ -15,6 +15,18 @@ import concurrent.futures
|
|||||||
from concurrent.futures import wait, ALL_COMPLETED
|
from concurrent.futures import wait, ALL_COMPLETED
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
SMALL_SIZE = 16
|
||||||
|
MEDIUM_SIZE = 18
|
||||||
|
BIGGER_SIZE = 20
|
||||||
|
|
||||||
|
plt.rc('font', size=SMALL_SIZE) # controls default text sizes
|
||||||
|
plt.rc('axes', titlesize=MEDIUM_SIZE) # fontsize of the axes title
|
||||||
|
plt.rc('axes', labelsize=MEDIUM_SIZE) # fontsize of the x and y labels
|
||||||
|
plt.rc('xtick', labelsize=SMALL_SIZE) # fontsize of the tick labels
|
||||||
|
plt.rc('ytick', labelsize=SMALL_SIZE) # fontsize of the tick labels
|
||||||
|
plt.rc('legend', fontsize=SMALL_SIZE) # legend fontsize
|
||||||
|
plt.rc('figure', titlesize=BIGGER_SIZE) # fontsize of the figure title
|
||||||
|
|
||||||
def normalizePhase(phase, phaseMin = None, phaseMax = None):
|
def normalizePhase(phase, phaseMin = None, phaseMax = None):
|
||||||
if(phaseMin is None):
|
if(phaseMin is None):
|
||||||
phaseMin = np.abs(np.min(phase))
|
phaseMin = np.abs(np.min(phase))
|
||||||
@@ -70,7 +82,7 @@ def plotBinsHistogram(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, bins, ti
|
|||||||
quit()
|
quit()
|
||||||
axHisto.set_ylabel("Num. flares")
|
axHisto.set_ylabel("Num. flares")
|
||||||
axHisto.set_xlabel("Phase")
|
axHisto.set_xlabel("Phase")
|
||||||
axHisto.set_title(title)
|
axHisto.set_title(title, wrap=True)
|
||||||
axHisto.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))
|
axHisto.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))
|
||||||
axHisto.xaxis.set_major_locator(MaxNLocator(5))
|
axHisto.xaxis.set_major_locator(MaxNLocator(5))
|
||||||
axHisto.legend()
|
axHisto.legend()
|
||||||
@@ -90,7 +102,7 @@ def plotBinsHistogram(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, bins, ti
|
|||||||
fitCol = np.array([0, 1])
|
fitCol = np.array([0, 1])
|
||||||
axHistoPhase.set_ylim(np.min(fitCol), np.max(fitCol)*1.2)
|
axHistoPhase.set_ylim(np.min(fitCol), np.max(fitCol)*1.2)
|
||||||
|
|
||||||
plt.savefig(filename)
|
plt.savefig(filename, bbox_inches="tight")
|
||||||
plt.close()
|
plt.close()
|
||||||
|
|
||||||
def plotFlarePhasePeakHistogram(xData, yData, bins, maxY, title, filename):
|
def plotFlarePhasePeakHistogram(xData, yData, bins, maxY, title, filename):
|
||||||
@@ -106,8 +118,8 @@ def plotFlarePhasePeakHistogram(xData, yData, bins, maxY, title, filename):
|
|||||||
figFlarepeakHist.colorbar(im, label='Counts', ax=axFlarepeakHist)
|
figFlarepeakHist.colorbar(im, label='Counts', ax=axFlarepeakHist)
|
||||||
axFlarepeakHist.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))
|
axFlarepeakHist.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))
|
||||||
axFlarepeakHist.xaxis.set_major_locator(MaxNLocator(5))
|
axFlarepeakHist.xaxis.set_major_locator(MaxNLocator(5))
|
||||||
axFlarepeakHist.set_title(title)
|
axFlarepeakHist.set_title(title, wrap=True)
|
||||||
plt.savefig(filename)
|
plt.savefig(filename, bbox_inches="tight")
|
||||||
plt.close()
|
plt.close()
|
||||||
|
|
||||||
def plotFlarePeaks(plotdata, filters, labels, colors, maxY, title, filename):
|
def plotFlarePeaks(plotdata, filters, labels, colors, maxY, title, filename):
|
||||||
@@ -134,11 +146,11 @@ def plotFlarePeaks(plotdata, filters, labels, colors, maxY, title, filename):
|
|||||||
axFlarePeaks.set_ylim(0.99, maxY)
|
axFlarePeaks.set_ylim(0.99, maxY)
|
||||||
axFlarePeaks.set_ylabel("Flare peak")
|
axFlarePeaks.set_ylabel("Flare peak")
|
||||||
axFlarePeaks.set_xlabel("Phase")
|
axFlarePeaks.set_xlabel("Phase")
|
||||||
axFlarePeaks.set_title(title)
|
axFlarePeaks.set_title(title, wrap=True)
|
||||||
axFlarePeaks.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))
|
axFlarePeaks.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))
|
||||||
axFlarePeaks.xaxis.set_major_locator(MaxNLocator(5))
|
axFlarePeaks.xaxis.set_major_locator(MaxNLocator(5))
|
||||||
axFlarePeaks.legend()
|
axFlarePeaks.legend()
|
||||||
plt.savefig(filename)
|
plt.savefig(filename, bbox_inches="tight")
|
||||||
plt.close()
|
plt.close()
|
||||||
|
|
||||||
def setupxyDataAndDataList(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak, pdcsapbinningData,
|
def setupxyDataAndDataList(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak, pdcsapbinningData,
|
||||||
|
|||||||
Reference in New Issue
Block a user