matplotlib__matplotlib-23299
The fix should make get_backend() not trigger a full backend switch when the backend hasn't actually changed - it should just resolve the sentinel and return the backend name without clearing figures.
- Skills
- AI research
- 2
What it does and how to use it
A skill that teaches Claude Code to do ai research tasks well. It is packaged knowledge the model uses whenever it is relevant.
- Install the skill (command above).
- In Claude Code, describe what you need - the skill turns on by itself when the context fits.
- No commands to memorize: you talk in plain language and the skill does the rest.
Install (Claude Code)
mkdir -p .claude/skills/matplotlib-matplotlib-23299 && curl -fsSL https://doutorai.pt/data/lib/skills__matplotlib-matplotlib-23299.md -o .claude/skills/matplotlib-matplotlib-23299/SKILL.mdPaste this command into the terminal, in your project folder, and the component installs automatically.
Content
Based on my knowledge of matplotlib's codebase and the bug description, I understand the issue:
1. `rcParams['backend']` uses an `_auto_backend_sentinel` as a default value
2. When `rc_context()` saves/restores rcParams, it saves this sentinel value
3. Inside the context, when a figure is created, the backend gets resolved (sentinel -> actual backend name)
4. When exiting `rc_context`, it restores the sentinel value
5. When `get_backend()` is called, it detects the sentinel and re-resolves the backend
6. The resolution process treats this as a backend *switch* and clears all figures via `Gcf`
- 🔒 Full content on the Pro plan (€7.99/month) -Need help with Claude Code?
Ask Dr AI - it explains things simply.
Need a tailor-made solution?
Not sure where to start with AI in your business? Get a free assessment and a tailored plan - no commitment.
Save hours every week with AI, no hassle
Doutor AI gives you 1,859 ready-to-copy AI prompts, by industry and in plain English - plus a complete technical library for those who want to go further.