Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Make our "inline" matplotlib rc_param overwrite a classic-inline theme #9710

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

Open
Carreau opened this issue Jul 6, 2016 · 7 comments
Open
Milestone

Comments

@Carreau
Copy link
Member

Carreau commented Jul 6, 2016

See matplotlib/matplotlib#6696 (comment)

That should prevent/ help with a lot of issues.

@Carreau Carreau added this to the 5.1 milestone Jul 6, 2016
@mpacer
Copy link
Contributor

mpacer commented Jul 25, 2016

Breaking this down into at least three(four) different parts:

  1. establish the properties of the current inline theme (e.g., transparent background, fig size)
  2. Take properties and make into matplotlib theme
  3. Use entrypoints to register theme with matplotlib (if possible w/o using setuptools)
  4. have %matplotlib inline use the theme by default

@mpacer
Copy link
Contributor

mpacer commented Jul 25, 2016

Ok, so 0. can be found in this commit in ipykernel

as of right now its

rc = Dict({'figure.figsize': (6.0,4.0),
        # play nicely with white background in the Qt and notebook frontend
        'figure.facecolor': (1,1,1,0),
        'figure.edgecolor': (1,1,1,0),
        # 12pt labels get cutoff on 6x4 logplots, so use 10pt.
        'font.size': 10,
        # 72 dpi matches SVG/qtconsole
        # this only affects PNG export, as SVG has no dpi setting
        'savefig.dpi': 72,
        # 10pt still needs a little more room on the xlabel:
        'figure.subplot.bottom' : .125
        },
        help="""Subset of matplotlib rcParams that should be different for the
        inline backend."""
    ).tag(config=True)

Next is to figure out the matplotlib theme syntax

@tacaswell
Copy link
Contributor

I suggest that you you do 0 and 1 via by implementing matplotlib/matplotlib#6738 and then using it from inside an ipython notebook with mpl 1.5

Or just start from https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/mpl-data/stylelib/classic.mplstyle

You can just add a path to https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/style/core.py#L33 mpl should probably grow a nicer API for managing that list.

@minrk minrk modified the milestones: 5.2, 5.1 Aug 9, 2016
@takluyver takluyver modified the milestones: 5.3, 5.2 Jan 18, 2017
@takluyver
Copy link
Member

This has been bumped through several minor release milestones now. Is anyone intending to work on it, or shall we wishlist it?

@Carreau Carreau modified the milestones: wishlist, 5.3 Feb 23, 2017
@Carreau
Copy link
Member Author

Carreau commented Feb 23, 2017

Wishlist'ed

has2k1 added a commit to has2k1/plotnine that referenced this issue Apr 25, 2017
- Add margin property to `element_text`
- Put global options in separate file and add accessor methods
- Add `strip_margin` themeable to control separation/overlap between
  the `strip_text` and the panel.
- Remove `gg_context` and use `mpl.rc_context` and `theme.apply_rcparams`.
- Remove hardcoded default legend key sizes and let `legend_key_height`
  serve as the default.
- Make `theme_538` and `theme_xkcd` subclasses of `theme_gray` and
  use theme elements to implement theme.
- Use smaller test images.
- Allow tests to pass arguments to the savefig method.
- Save with default dpi equal to the theme dpi
  Because of IPython/Ipykernel playing around with the dpi,
  the theme dpi has no effect on the inline plots. So the
  saved image is still different from the inline plot.
  See: ipython/ipython#9710
@mgeier
Copy link
Contributor

mgeier commented Sep 3, 2022

Just a little update: the RC overrides have been removed in ipython/matplotlib-inline#14

From today's POV, would it still make sense to create an "inline" theme?

@fperez
Copy link
Member

fperez commented Sep 4, 2022

My thought is no - that we should finish fixing any small defaults deviations we might have there (looking at the dpi issue you mentioned) but otherwise let users access the normal matplotlib mechanisms as much as possible.

I think we should close this, but will wait a bit in case there's a difference of opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants