Compared to default altair

First we setup a scatterplot graph and show it in stock altair.

import altair as alt
from vega_datasets import data

source = data.cars()

chart = (
    alt.Chart(
        source,
        title={
            "text": "Mileage vs. Power",
            "subtitle": "A simple scatterplot example from Altair's documentation",
        },
    )
    .mark_circle(size=60)
    .encode(
        x="Horsepower",
        y="Miles_per_Gallon",
        color="Origin",
        tooltip=["Name", "Origin", "Horsepower", "Miles_per_Gallon"],
    )
    .interactive()
)

# This is only needed when executing cells out of order
alt.themes.enable("default")
chart

Now we setup altair_morberg and show the same graph.

import altair_morberg.core as morberg

alt.themes.register("morberg_theme", morberg.theme)
alt.themes.enable("morberg_theme")

chart

Example charts

Here are some additional examples. Some are based on altair-latimes examples.

import numpy as np
import pandas as pd
from vega_datasets import data
source = pd.DataFrame(
    {
        "a": ["A", "B", "C", "D", "E", "F", "G", "H", "I"],
        "b": [28, 55, 43, 91, 81, 53, 19, 87, 52],
    }
)

alt.Chart(source).mark_bar().encode(x="a", y="b")
x = np.arange(100)
source = pd.DataFrame({"x": x, "f(x)": np.sin(x / 5)})

alt.Chart(source).mark_line().encode(x="x", y="f(x)")
source = pd.DataFrame(
    {"x": [1, 3, 5, 7, 9], "y": [1, 3, 5, 7, 9], "label": ["A", "B", "C", "D", "E"]}
)

bars = alt.Chart(source).mark_point().encode(x="x:Q", y="y:Q")

text = bars.mark_text(align="left", baseline="middle", dx=7).encode(text="label")

bars + text
source = data.iowa_electricity()

alt.Chart(source, title="Iowa's renewable energy boom").mark_area().encode(
    x=alt.X("year:T", title="Year"),
    y=alt.Y(
        "net_generation:Q",
        stack="normalize",
        title="Share of net generation",
        axis=alt.Axis(format=".0%"),
    ),
    color=alt.Color("source:N", legend=alt.Legend(title="Electricity source"),),
)
source = "https://vega.github.io/vega-datasets/data/seattle-weather-hourly-normals.csv"

alt.Chart(
    source, title="2010 Daily High Temperature (F) in Seattle, WA"
).mark_rect().encode(
    x=alt.X("date:O", timeUnit="date"),
    y=alt.Y("date:O", timeUnit="month"),
    color=alt.Color("temperature:Q", aggregate="max"),
    tooltip=[
        alt.Tooltip("date:T", timeUnit="monthdate", title="Date"),
        alt.Tooltip("temperature:Q", aggregate="max", title="Max Temp"),
    ],
).properties(
    width=600
)
source = data.zipcodes.url

alt.Chart(source).mark_circle(size=3).encode(
    longitude="longitude:Q", latitude="latitude:Q", color="digit:N"
).project(type="albersUsa").transform_calculate(
    "digit", alt.expr.substring(alt.datum.zip_code, 0, 1)
)
source = data.barley()

alt.Chart(source, title="The Morris Mistake").mark_point().encode(
    alt.X(
        "yield:Q",
        title="Barley Yield (bushels/acre)",
        scale=alt.Scale(zero=False),
        axis=alt.Axis(grid=False),
    ),
    alt.Y(
        "variety:N",
        title="",
        sort=alt.EncodingSortField(field="yield", op="sum", order="descending"),
        axis=alt.Axis(grid=True),
    ),
    color=alt.Color("year:N", legend=alt.Legend(title="Year")),
    row=alt.Row(
        "site:N",
        title="",
        sort=alt.EncodingSortField(field="yield", op="sum", order="descending"),
    ),
).configure_view(stroke="transparent", width=400, height=150)
source = data.barley.url

alt.Chart(source, title="Becker’s Barley Trellis Plot").mark_point().encode(
    alt.X('median(yield):Q', scale=alt.Scale(zero=False), axis=alt.Axis(grid=True)),
    alt.Y('variety:O', title=""),
    color='year:N',
    facet=alt.Facet('site:O', columns=2),
).properties(
    width=200,
    height=125,
)