Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] GUI dipole plot bug. #695

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hnn_core/gui/_viz_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _update_ax(fig, ax, single_simulation, sim_name, plot_type, plot_config):

elif plot_type == 'PSD':
if len(dpls_copied) > 0:
color = next(ax._get_lines.prop_cycler)['color']
color = ax._get_lines.get_next_color()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this API change work for earlier versions of matplotlib as well? If so I'm definitely happy to merge as is!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I developed with 3.8.2 and tested it with matplotlib older versions 3.5.3 and 3.7.4. ">=3.5.3" is what is specified in the setup file.

dpls_copied[0].plot_psd(fmin=0, fmax=50, ax=ax, color=color,
label=sim_name, show=False)

Expand All @@ -175,7 +175,7 @@ def _update_ax(fig, ax, single_simulation, sim_name, plot_type, plot_config):
else:
label = sim_name

color = next(ax._get_lines.prop_cycler)['color']
color = ax._get_lines.get_next_color()
if plot_type == 'current dipole':
plot_dipole(dpls_copied,
ax=ax,
Expand Down
5 changes: 4 additions & 1 deletion hnn_core/tests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,12 @@ def test_gui_add_figure():
gui.run_button.click()
assert len(fig_tabs.children) == 1
assert len(axes_config_tabs.children) == 1

assert gui.viz_manager.fig_idx['idx'] == 2

# Check default figs have data on their axis
assert gui.viz_manager.figs[1].axes[0].has_data()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the has_data() docstring:

This should not be used to determine whether the dataLim need to be updated, and may not actually be useful for anything.

Useful for us! 😄

assert gui.viz_manager.figs[1].axes[1].has_data()

for idx in range(3):
n_fig = idx + 2
gui.viz_manager.make_fig_button.click()
Expand Down
Loading