has2k1 / plotnine

A Grammar of Graphics for Python
https://plotnine.org
MIT License
4.07k stars 225 forks source link

panel_ontop has opposite meaning from ggplot2 - intentional? #585

Closed JorySchossau closed 2 years ago

JorySchossau commented 2 years ago

Hi, I'm curious if ontop was intentionally made backwards from ggplot2's version? Instead of submitting a PR that was not asked for, I figured I should ask. From ggplot2 docs [https://ggplot2.tidyverse.org/reference/theme.html]:

panel.ontop
    option to place the panel (background, gridlines) over the data layers (logical).
    Usually used with a transparent or blank panel.background.

So I take that to mean setting ontop to True would draw the gridlines over the data layer. But plotnine currently does this the other way around, where setting ontop to False draws gridlines over the data layer. You can verify that common themes like theme_gray sets ontop to True, which seems odd. It's so consistent across the code base that it seems intentional for some good reason, in which case don't mind me :) but I'd love to know the logic here for my own curiosity.

has2k1 commented 2 years ago

It is a bug. The default should be set to False so the underlying code (in themeables.py) should negate that. Yes, you can make a PR. The documentation is right!