Skip to content

Add xkcd style template for plotly #3438

Closed
@RatanShreshtha

Description

@RatanShreshtha

I have been using plotly.py for a while now and I love this library as it is a delight to use and plots are so beautiful.

I recently got know about the themes and templates in plotly.py and I wish there was one option for making plots look like xkcd comics.

import plotly.io as pio
pio.templates
Templates configuration
-----------------------
    Default template: 'plotly'
    Available templates:
        ['ggplot2', 'seaborn', 'simple_white', 'plotly',
         'plotly_white', 'plotly_dark', 'presentation', 'xgridoff',
         'ygridoff', 'gridon', 'xkcd', 'none']

And can be used in plots like below

import plotly.express as px

df = px.data.gapminder()
df_2007 = df.query("year==2007")

fig = px.scatter(df_2007,
                     x="gdpPercap", y="lifeExp", size="pop", color="continent",
                     log_x=True, size_max=60,
                     template="xkcd", title="Gapminder 2007: 'xkcd' theme")
fig.show()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions