Skip to content

Commit

Permalink
make xticklabels invisible
Browse files Browse the repository at this point in the history
Signed-off-by: Arnau Aguasca-Cabot <[email protected]>
  • Loading branch information
aaguasca committed Jun 21, 2024
1 parent 532e3d6 commit 7728205
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gammapy/datasets/flux_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ def plot_fit(
gs = GridSpec(7, 1)
if ax_spectrum is None:
ax_spectrum = fig.add_subplot(gs[:5, :])
if ax_residuals is None:
plt.setp(ax_spectrum.get_xticklabels(), visible=False)

if ax_residuals is None:
ax_residuals = fig.add_subplot(gs[5:, :], sharex=ax_spectrum)
Expand Down
5 changes: 5 additions & 0 deletions gammapy/datasets/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def plot_fit(
>>> dataset.plot_fit(kwargs_residuals=kwargs_residuals, kwargs_spectrum=kwargs_spectrum) # doctest: +SKIP
"""
gs = GridSpec(7, 1)
if ax_spectrum is None and ax_residuals is None:
bool_visible_xticklabel = False
else:
bool_visible_xticklabel = True
ax_spectrum, ax_residuals = get_axes(
ax_spectrum,
ax_residuals,
Expand All @@ -77,6 +81,7 @@ def plot_fit(
method = kwargs_residuals.get("method", "diff")
label = self._residuals_labels[method]
ax_residuals.set_ylabel(f"Residuals\n{label}")
plt.setp(ax_spectrum.get_xticklabels(), visible=bool_visible_xticklabel)

return ax_spectrum, ax_residuals

Expand Down

0 comments on commit 7728205

Please sign in to comment.