Skip to content

Commit

Permalink
fixing plot_spectrum (#429)
Browse files Browse the repository at this point in the history
* fixing mpl deprecations for version 3.8
* preparation for release 0.11.3
  • Loading branch information
JoschD authored Sep 20, 2023
1 parent c929e01 commit c55dd09
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# OMC3 Changelog

#### 2023-09-20 - v0.11.3 - _jdilly_, _awegsche_

- Fixed:
- compatibility with matplotlib 3.8
- skipping important phase advances for HL-LHC (as not defined yet)
- allowing responses with delta_k < 1e-6 for full-response creation

#### 2023-09-01 - v0.11.2 - _jdilly_

- Fixed:
Expand Down
2 changes: 1 addition & 1 deletion omc3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
__title__ = "omc3"
__description__ = "An accelerator physics tools package for the OMC team at CERN."
__url__ = "https://github.com/pylhc/omc3"
__version__ = "0.11.2"
__version__ = "0.11.3"
__author__ = "pylhc"
__author_email__ = "[email protected]"
__license__ = "MIT"
Expand Down
8 changes: 7 additions & 1 deletion omc3/plotting/plot_tfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,13 @@ def _share_xaxis(fig_collection):
"""Shared xaxis at last axes and remove all xlabels, ticks of other axes."""
for fig_container in fig_collection.figs.values():
axs = fig_container.axes.values()
fig_container.axes[fig_container.axes_ids[-1]].get_shared_x_axes().join(*axs)

# Axes.get_shared_x_axes() does not work here as it returns a GrouperView
# instead of the Grouper (i.e. _shared_axes['x'], matplotlib < 3.8),
# so we access _shared_axes directly
fig_container.axes[fig_container.axes_ids[-1]]._shared_axes["x"].join(*axs)

# remove ticks and labels for all but the last axes.
for ax_id in fig_container.axes_ids[:-1]:
fig_container.axes[ax_id].set_xticklabels([])
fig_container.xlabels[ax_id] = None
Expand Down
9 changes: 7 additions & 2 deletions omc3/plotting/spectrum/stem.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ def _plot_stems(fig_cont: FigureContainer) -> None:
if data[plane] is None:
continue
# plot
markers, stems, base = ax.stem(data[plane][FREQS], data[plane][AMPS],
use_line_collection=True, basefmt='none', label=label)
try:
# Matplotlib < v3.8
markers, stems, base = ax.stem(data[plane][FREQS], data[plane][AMPS], basefmt='none', label=label,
use_line_collection=True)
except TypeError:
# Matplotlib >= v3.8
markers, stems, base = ax.stem(data[plane][FREQS], data[plane][AMPS], basefmt='none', label=label)

# Set appropriate colors
color = get_cycled_color(idx_data)
Expand Down

0 comments on commit c55dd09

Please sign in to comment.