generate_plots: add option to adjust plot text sizes

This commit is contained in:
2025-05-25 18:22:32 +02:00
parent cd04b272ca
commit c36c227e11
+18 -6
View File
@@ -15,6 +15,18 @@ import concurrent.futures
from concurrent.futures import wait, ALL_COMPLETED
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):
if(phaseMin is None):
phaseMin = np.abs(np.min(phase))
@@ -70,7 +82,7 @@ def plotBinsHistogram(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, bins, ti
quit()
axHisto.set_ylabel("Num. flares")
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_locator(MaxNLocator(5))
axHisto.legend()
@@ -90,7 +102,7 @@ def plotBinsHistogram(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, bins, ti
fitCol = np.array([0, 1])
axHistoPhase.set_ylim(np.min(fitCol), np.max(fitCol)*1.2)
plt.savefig(filename)
plt.savefig(filename, bbox_inches="tight")
plt.close()
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)
axFlarepeakHist.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))
axFlarepeakHist.xaxis.set_major_locator(MaxNLocator(5))
axFlarepeakHist.set_title(title)
plt.savefig(filename)
axFlarepeakHist.set_title(title, wrap=True)
plt.savefig(filename, bbox_inches="tight")
plt.close()
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_ylabel("Flare peak")
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_locator(MaxNLocator(5))
axFlarePeaks.legend()
plt.savefig(filename)
plt.savefig(filename, bbox_inches="tight")
plt.close()
def setupxyDataAndDataList(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak, pdcsapbinningData,