Skip to content

FIX plots not being rendered in 'Choice of n_components in the unsupervised case' notebook - #881

Merged
SebastienMelo merged 2 commits into
INRIA:mainfrom
ArturoAmorQ:plt_show
Aug 14, 2026
Merged

FIX plots not being rendered in 'Choice of n_components in the unsupervised case' notebook#881
SebastienMelo merged 2 commits into
INRIA:mainfrom
ArturoAmorQ:plt_show

Conversation

@ArturoAmorQ

@ArturoAmorQ ArturoAmorQ commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Follow up from #876.

The _ = axes[1].set_title(...) pattern used everywhere in the mooc doesn't render anything in the Choice of n_components in the unsupervised case notebook.

After some investigation, the issue seems to be that skrub.TableReport generates its per-column sparkline SVGs using matplotlib's rc_context internally (though patched in skrub#1172, skrub 0.4.1). Entering and exiting rc_context inside a Jupyter kernel can silently disable that post-execute hook, then every subsequent cell in that execution loses auto inline display. This is a known, still-open matplotlib bug (matplotlib#25041). As the underlying matplotlib issue has not being fixed upstream, it can resurface with different matplotlib/skrub version combinations.

The proposed fix is then to simply use plt.show() as it doesn't depend on that hook. It explicitly renders each open figure, so it works whether or not the hook is still installed.

@SebastienMelo
SebastienMelo merged commit c422c7f into INRIA:main Aug 14, 2026
3 checks passed
@ArturoAmorQ
ArturoAmorQ deleted the plt_show branch August 14, 2026 14:10
@ArturoAmorQ
ArturoAmorQ restored the plt_show branch August 14, 2026 14:18
@ArturoAmorQ
ArturoAmorQ deleted the plt_show branch August 14, 2026 14:20
ArturoAmorQ added a commit to probabl-ai/scikit-learn-course that referenced this pull request Aug 14, 2026
ArturoAmorQ added a commit to probabl-ai/scikit-learn-course that referenced this pull request Aug 14, 2026
github-actions Bot pushed a commit to Mahendra687/scikit-learn-mooc that referenced this pull request Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants