Skip to content

add light-html theme #24

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

Closed

Conversation

harrylojames
Copy link
Contributor

What do you think of this? Probably showing my ignorance in the world of css, but adding a new theme achieves what I was after. The upstream issue of being able to set styles on the figure would of course allow you to achieve the same but where users want to export an image and expect it to look as it did in a jupyter notebook perhaps this is more friendly?

from pyobsplot import Obsplot, Plot
import polars as pl

op = Obsplot(theme="light-html")
penguins = pl.read_csv("https://github.com/juba/pyobsplot/raw/main/doc/data/penguins.csv")

op({
    "color": {"legend": True},
    "marginLeft": 80,
    "marginRight": 80,
    "x": {"inset": 20},
    "grid": True,
    "marks": [
        Plot.boxX(penguins, {
            "x": "body_mass_g", "fill": "island", "y": "island", "fy": "species"
        })
    ],
    "title": "Test title",
    "subtitle": "Test subtitle",
    "caption": "Test caption"
}, path= "out.html")

Before -
image
After -
image

@harrylojames harrylojames mentioned this pull request Oct 20, 2023
@juba
Copy link
Owner

juba commented Nov 1, 2023

Thanks for the PR, but I'd prefer to wait for upstream to implement figure styling instead of creating a workaround which will be obsolete after... Moreover, the default behavior makes title and subtitle style the same as the rest of your HTML document, so it is kind of coherent. You can always add a custom CSS rule to your HTML to style it differently.

Hope it makes sense, don't hesitate if you have any remark or question.

@harrylojames
Copy link
Contributor Author

Hi, yep that sounds sensible! I'll look at adding a custom css rule / getting the upstream issue fixed. Thanks for the feedback.

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