diff --git a/doc/changelog.rst b/doc/changelog.rst index c7d7dc967ed299fd2fdff6b03f4e16df88eb1ac2..543978002865b43afc475a1052bbfb983e238ab7 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -9,6 +9,7 @@ unreleased - **Improvements** + - remove calls to matplotlib tight_layout :mr:`206` - **New Features** diff --git a/doc/index.rst b/doc/index.rst index a260921bc3f6562c2f1465e9635951e1f0b095ed..27730a81c66fd41d243f532636686efd6dbff670 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -19,6 +19,21 @@ where in this example 2780 is the proposal number. After this and refreshing the browser, a new kernel named ``SCS Toolbox (p002780)`` is available and should be used to run jupyter notebooks on the Maxwell Jupyter hub. +Figures setup: enabling matplotlib constrained layout ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +To get the best looking figures generated by the SCS Toolbox, you +need to enable the experimental constrained_layout_ solver in matplotlib. This +is done in jupyter notebook with adding at the start the following lines: + +.. code:: python + + import matplotlib.pyplot as plt + plt.rcParams['figure.constrained_layout.use'] = True + +.. _constrained_layout: https://matplotlib.org/stable/tutorials/intermediate/constrainedlayout_guide.html + + Alternative: Manual ToolBox Installation ++++++++++++++++++++++++++++++++++++++++ diff --git a/src/toolbox_scs/detectors/digitizers.py b/src/toolbox_scs/detectors/digitizers.py index 3dadcb94554f8dde8c40582ccbdebf67826bd156..297a774ef1464fc68ded5e25dd6b0ad82a295f88 100644 --- a/src/toolbox_scs/detectors/digitizers.py +++ b/src/toolbox_scs/detectors/digitizers.py @@ -1102,7 +1102,6 @@ def calibrateTIM(data, rollingWindow=200, mcp=1, plot=False, use_apd=True, intst ax.set_ylabel(label_trace, size=10) ax.set_xlabel('sample #', size=10) ax.legend(fontsize=8) - plt.tight_layout() return F diff --git a/src/toolbox_scs/misc/bunch_pattern.py b/src/toolbox_scs/misc/bunch_pattern.py index 852f9ed71adce12faaf0365f5722d18922fa295f..90deb34e53e8d58430147d980e29c367a937025f 100644 --- a/src/toolbox_scs/misc/bunch_pattern.py +++ b/src/toolbox_scs/misc/bunch_pattern.py @@ -171,7 +171,6 @@ def pulsePatternInfo(data, plot=False): plt.plot(data['npulses_sase1'].trainId, data['npulses_sase1'], '^-', ms=3, color='C2', label='SASE 1') plt.legend() - plt.tight_layout() def repRate(data=None, runNB=None, proposalNB=None, key='sase3'): diff --git a/src/toolbox_scs/misc/laser_utils.py b/src/toolbox_scs/misc/laser_utils.py index 99698e10181fac6fb3368b5ad6364daf83e90e2b..0f052966b995f89e013779378436940bd4c79c59 100644 --- a/src/toolbox_scs/misc/laser_utils.py +++ b/src/toolbox_scs/misc/laser_utils.py @@ -110,5 +110,5 @@ def fluenceCalibration(hwp, power_mW, npulses, w0x, w0y=None, return 1e7*x*np.pi*w0x*w0y/2 ax2 = ax.secondary_yaxis('right', functions=(fTe, eTf)) ax2.set_ylabel(r'Pulse energy [$\mu$J]') - fig.tight_layout() + return F*1e-1, fit_F, E*1e6, fit_E diff --git a/src/toolbox_scs/routines/XAS.py b/src/toolbox_scs/routines/XAS.py index 878cc284d2e04fa151386461b89ffdaab0e80643..0f483c5439113540b1dedff90982930dbf3c9a45 100644 --- a/src/toolbox_scs/routines/XAS.py +++ b/src/toolbox_scs/routines/XAS.py @@ -235,7 +235,6 @@ def xas(nrun, bins=None, Iokey='SCS_SA3', Itkey='MCP3peaks', nrjkey='nrj', color='C0', alpha=0.2) ax2.set_xlabel('Energy (eV)') ax2.set_ylabel('counts') - plt.tight_layout() return {'nrj': bins_c, 'muA': muA, 'sterrA': sterrA, 'sigmaA': nosample['sigmaA'], 'muIo': nosample['muIo'], diff --git a/src/toolbox_scs/routines/knife_edge.py b/src/toolbox_scs/routines/knife_edge.py index 78ad7d52ca04a565ad846842d6a283f25209d8cc..5f1e47ef255d6bd92557e32597a94d99b992ce4c 100644 --- a/src/toolbox_scs/routines/knife_edge.py +++ b/src/toolbox_scs/routines/knife_edge.py @@ -93,4 +93,3 @@ def plot_knife_edge(positions, intensities, fit_params, rel_err, title, plt.ylabel(signalKey) plt.xlabel(axisKey + ' position [mm]') plt.title(title) - plt.tight_layout()