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

PR: Fix issue where Spyder's inline graphics preferences were not applied #487

Merged
merged 9 commits into from
May 31, 2024

Conversation

mrclary
Copy link
Contributor

@mrclary mrclary commented May 16, 2024

This fixes an issue where:

  • Spyder's inline graphics preferences were not applied when toggling from inline to interactive and back to inline.
  • Matplotlib's rcParams are over-written by Spyder's inline preferences even with the preference set for an interactive backend.

For more detail, see spyder-ide/spyder#22034.

@mrclary mrclary marked this pull request as ready for review May 16, 2024 20:53
@mrclary mrclary changed the title Fix issue where Spyder's inline preferences were not applied Fix issue where Spyder's inline graphics preferences were not applied May 16, 2024
@mrclary mrclary force-pushed the issue-22304 branch 3 times, most recently from ee46d3c to 870f22d Compare May 24, 2024 20:53
@mrclary mrclary marked this pull request as draft May 24, 2024 22:46
@mrclary mrclary marked this pull request as ready for review May 25, 2024 04:33
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

@mrclary, sorry to say it but I think your current approach is not feasible (see below).

spyder_kernels/console/kernel.py Outdated Show resolved Hide resolved
spyder_kernels/console/kernel.py Outdated Show resolved Hide resolved
spyder_kernels/console/kernel.py Outdated Show resolved Hide resolved
spyder_kernels/console/kernel.py Outdated Show resolved Hide resolved
spyder_kernels/console/kernel.py Show resolved Hide resolved
@ccordoba12 ccordoba12 changed the title Fix issue where Spyder's inline graphics preferences were not applied PR: Fix issue where Spyder's inline graphics preferences were not applied May 29, 2024
@mrclary mrclary force-pushed the issue-22304 branch 3 times, most recently from 89dc88b to ccfb4a9 Compare May 29, 2024 20:59
@ccordoba12 ccordoba12 added this to the v3.0.0b7 milestone May 30, 2024
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

This looks much better, thanks @mrclary!

spyder_kernels/console/kernel.py Outdated Show resolved Hide resolved
spyder_kernels/console/kernel.py Outdated Show resolved Hide resolved
spyder_kernels/console/kernel.py Outdated Show resolved Hide resolved
spyder_kernels/console/shell.py Outdated Show resolved Hide resolved
mrclary and others added 9 commits May 30, 2024 18:19
…kend if necessary.

Do not directly set rcParams or re-apply inline backend since doing either while in inline mode will prevent restoring rcParams when toggling to interactive mode. Rather, toggle the backend to interactive and back to inline.

Note that when adding InlineBackend to kernel.config, it must be a Config object.
… there were any rc changes.

Rather than condition on pylab autoload in the configuration, condition on it being true.
This prevents user's matplotlib rc parameters from being clobbered when Spyder's "Activate support" is disabled. This makes sense because when disabled, a user should expect that Spyder does not interfere in any way.
Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
Apply rcParams explicitly while in inline mode.
Always reset rcParams to file defaults before applying backend. This will ensure correct rcParams in interactive backends if rcParams are explicitly set in inline mode. When changing to inline mode, InlineBackend settings will be applied to rcParams.
Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Looks good to me now, thanks @mrclary!

@ccordoba12 ccordoba12 merged commit ea04753 into spyder-ide:master May 31, 2024
12 checks passed
@mrclary mrclary deleted the issue-22304 branch May 31, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants