Code Monkey home page Code Monkey logo

Comments (8)

has2k1 avatar has2k1 commented on May 22, 2024

I saw the post and immediately noticed the grey background in the legend keys. First, the background of the keys defaults to the plot background, but since theme_seaborn is entirely specified through rcParams and not theme elements there is a glitch. I think having white as a default will lessen the impact.

This

 + theme_seaborn(style='ticks', context='talk', font_scale=0.75)
 + theme(legend_key=element_rect(fill='white', color='white'))

should work. Did you add theme after theme_seaborn?

from plotnine.

has2k1 avatar has2k1 commented on May 22, 2024

Sometimes there are weird edge cases that cause plotnine plots to break (although as an important note, resetting your kernel tends to fix them. I have no idea why this happens and I can't faithfully reproduce it), and they arise from complicated layering of plot elements

Any more on this? I do complicated layering without issues.

from plotnine.

darothen avatar darothen commented on May 22, 2024

Hi @has2k1, I do call theme_seaborn before theme in the manner you suggest, and it doesn't resolve the issue. Explicitly setting the plot_background doesn't work either, before or after the call to theme_seaborn. Here is a gist with the original notebook and the data - just change the path in the first cell.

On the layering issue, like I mentioned, I haven't been able to consistently reproduce any issues, but if I stumble across an MWE that works, I'll be sure to post it.

from plotnine.

has2k1 avatar has2k1 commented on May 22, 2024

Sorry I meant 'panel_background'.

from plotnine.

darothen avatar darothen commented on May 22, 2024

Nope, that doesn't fix the legend key background either.

from plotnine.

has2k1 avatar has2k1 commented on May 22, 2024

Ahh I have seen this before. The confidence interval markers for stat_smooth have a default grey background and that is showing up in the legend. Try stat_smooth(se=False).

from plotnine.

darothen avatar darothen commented on May 22, 2024

Aha! That did the trick. Is there a way to clip the way the confidence interval markers are drawn so they don't 100% fill the legend_key box? That way we would have some feedback on how theming is changing that element.

from plotnine.

has2k1 avatar has2k1 commented on May 22, 2024

That is what I immediately thought about.

from plotnine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.