Skip to content

Instantly share code, notes, and snippets.

@has2k1
Created November 3, 2022 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save has2k1/ff455c7df8d5faab92e12990d33504eb to your computer and use it in GitHub Desktop.
Save has2k1/ff455c7df8d5faab92e12990d33504eb to your computer and use it in GitHub Desktop.
import pandas as pd
from plotnine import *
df = pd.DataFrame({'x': range(5), 'y': range(5), 'z': list('ccddf')})
df['z'] = pd.Categorical(df['z'], categories=list('cdf'), ordered=True)
p = (ggplot(df, aes('x', 'y', color='z'))
+ geom_point()
)
p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment