Skip to content

Commit 5653531

Browse files
committed
Merge remote-tracking branch 'upstream/main' into rory/lint-examples
2 parents afd3fe3 + ad996f9 commit 5653531

File tree

6 files changed

+42
-4
lines changed

6 files changed

+42
-4
lines changed

.github/conda-env/doctest-env.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
- numpy
88
- matplotlib
99
- scipy
10-
- sphinx
10+
- sphinx<8.2
1111
- sphinx_rtd_theme
1212
- ipykernel
1313
- nbsphinx

.github/workflows/install_examples.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ jobs:
2020
--quiet --yes \
2121
python=3.12 pip \
2222
numpy matplotlib scipy \
23-
slycot pmw jupyter
23+
slycot pmw jupyter \
24+
ipython!=9.0
2425
2526
- name: Install from source
2627
run: |

control/freqplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,12 +2556,12 @@ def singular_values_plot(
25562556
nyq_freq = None
25572557

25582558
# Determine the color to use for this response
2559-
color = _get_color(
2559+
current_color = _get_color(
25602560
color, fmt=fmt, offset=color_offset + idx_sys,
25612561
color_cycle=color_cycle)
25622562

25632563
# To avoid conflict with *fmt, only pass color kw if non-None
2564-
color_arg = {} if color is None else {'color': color}
2564+
color_arg = {} if current_color is None else {'color': current_color}
25652565

25662566
# Decide on the system name
25672567
sysname = response.sysname if response.sysname is not None \

control/iosys.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ def _repr_latex_(self):
314314
def _repr_html_(self):
315315
# Defaults to using __repr__; override in subclasses
316316
return None
317+
318+
def _repr_markdown_(self):
319+
return self._repr_html_()
317320

318321
@property
319322
def repr_format(self):

control/tests/freqplot_test.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,39 @@ def test_display_margins(nsys, display_margins, gridkw, match):
680680
assert cplt.axes[0, 0].get_title() == ''
681681

682682

683+
def test_singular_values_plot_colors():
684+
# Define some systems for testing
685+
sys1 = ct.rss(4, 2, 2, strictly_proper=True)
686+
sys2 = ct.rss(4, 2, 2, strictly_proper=True)
687+
688+
# Get the default color cycle
689+
color_cycle = plt.rcParams['axes.prop_cycle'].by_key()['color']
690+
691+
# Plot the systems individually and make sure line colors are OK
692+
cplt = ct.singular_values_plot(sys1)
693+
assert cplt.lines.size == 1
694+
assert len(cplt.lines[0]) == 2
695+
assert cplt.lines[0][0].get_color() == color_cycle[0]
696+
assert cplt.lines[0][1].get_color() == color_cycle[0]
697+
698+
cplt = ct.singular_values_plot(sys2)
699+
assert cplt.lines.size == 1
700+
assert len(cplt.lines[0]) == 2
701+
assert cplt.lines[0][0].get_color() == color_cycle[1]
702+
assert cplt.lines[0][1].get_color() == color_cycle[1]
703+
plt.close('all')
704+
705+
# Plot the systems as a list and make sure colors are OK
706+
cplt = ct.singular_values_plot([sys1, sys2])
707+
assert cplt.lines.size == 2
708+
assert len(cplt.lines[0]) == 2
709+
assert len(cplt.lines[1]) == 2
710+
assert cplt.lines[0][0].get_color() == color_cycle[0]
711+
assert cplt.lines[0][1].get_color() == color_cycle[0]
712+
assert cplt.lines[1][0].get_color() == color_cycle[1]
713+
assert cplt.lines[1][1].get_color() == color_cycle[1]
714+
715+
683716
if __name__ == "__main__":
684717
#
685718
# Interactive mode: generate plots for manual viewing

control/tests/statesp_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,7 @@ def test_html_repr(gmats, ref, dt, dtref, repr_type, num_format, editsdefaults):
14401440
dt_html = dtref.format(dt=dt, fmt=defaults['statesp.latex_num_format'])
14411441
ref_html = ref[refkey].format(dt=dt_html)
14421442
assert g._repr_html_() == ref_html
1443+
assert g._repr_html_() == g._repr_markdown_()
14431444

14441445

14451446
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)