Skip to content

Commit c55dd09

Browse files
authored
fixing plot_spectrum (#429)
* fixing mpl deprecations for version 3.8 * preparation for release 0.11.3
1 parent c929e01 commit c55dd09

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# OMC3 Changelog
22

3+
#### 2023-09-20 - v0.11.3 - _jdilly_, _awegsche_
4+
5+
- Fixed:
6+
- compatibility with matplotlib 3.8
7+
- skipping important phase advances for HL-LHC (as not defined yet)
8+
- allowing responses with delta_k < 1e-6 for full-response creation
9+
310
#### 2023-09-01 - v0.11.2 - _jdilly_
411

512
- Fixed:

omc3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
__title__ = "omc3"
1212
__description__ = "An accelerator physics tools package for the OMC team at CERN."
1313
__url__ = "https://github.com/pylhc/omc3"
14-
__version__ = "0.11.2"
14+
__version__ = "0.11.3"
1515
__author__ = "pylhc"
1616
__author_email__ = "[email protected]"
1717
__license__ = "MIT"

omc3/plotting/plot_tfs.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,13 @@ def _share_xaxis(fig_collection):
509509
"""Shared xaxis at last axes and remove all xlabels, ticks of other axes."""
510510
for fig_container in fig_collection.figs.values():
511511
axs = fig_container.axes.values()
512-
fig_container.axes[fig_container.axes_ids[-1]].get_shared_x_axes().join(*axs)
512+
513+
# Axes.get_shared_x_axes() does not work here as it returns a GrouperView
514+
# instead of the Grouper (i.e. _shared_axes['x'], matplotlib < 3.8),
515+
# so we access _shared_axes directly
516+
fig_container.axes[fig_container.axes_ids[-1]]._shared_axes["x"].join(*axs)
517+
518+
# remove ticks and labels for all but the last axes.
513519
for ax_id in fig_container.axes_ids[:-1]:
514520
fig_container.axes[ax_id].set_xticklabels([])
515521
fig_container.xlabels[ax_id] = None

omc3/plotting/spectrum/stem.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,13 @@ def _plot_stems(fig_cont: FigureContainer) -> None:
4444
if data[plane] is None:
4545
continue
4646
# plot
47-
markers, stems, base = ax.stem(data[plane][FREQS], data[plane][AMPS],
48-
use_line_collection=True, basefmt='none', label=label)
47+
try:
48+
# Matplotlib < v3.8
49+
markers, stems, base = ax.stem(data[plane][FREQS], data[plane][AMPS], basefmt='none', label=label,
50+
use_line_collection=True)
51+
except TypeError:
52+
# Matplotlib >= v3.8
53+
markers, stems, base = ax.stem(data[plane][FREQS], data[plane][AMPS], basefmt='none', label=label)
4954

5055
# Set appropriate colors
5156
color = get_cycled_color(idx_data)

0 commit comments

Comments
 (0)