Skip to content

Instantly share code, notes, and snippets.

@Ken-Kuroki
Created August 25, 2019 06:45
Show Gist options
  • Save Ken-Kuroki/b03ecf5857fe31f510a9ba853c3fc6f6 to your computer and use it in GitHub Desktop.
Save Ken-Kuroki/b03ecf5857fe31f510a9ba853c3fc6f6 to your computer and use it in GitHub Desktop.
# Plotting in dark theme with Altair
import numpy as np
import pandas as pd
import altair as alt
alt.renderers.set_embed_options(theme='dark')
arr = np.concatenate([np.random.randn(100, 2), np.random.randint(0, 5, (100, 1))], axis=1)
df = pd.DataFrame(arr, columns=["X1", "X2", "Y"])
alt.Chart(df).mark_circle().encode(
x="X1",
y="X2",
color=alt.Color("Y:N", scale=alt.Scale(scheme="set2")), # accent, set2, and set3 are my favorite schemes with dark theme
)
@Ken-Kuroki
Copy link
Author

Here's the output
altair_dark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment