Skip to content

Using one label for a facet grid not documented #28

@mcp292

Description

@mcp292

Using one label for an entire facet grid is not documented in Adjusting Axis Labels.

How can I make this plot only use one y-label?

MWE

import pandas as pd
import altair as alt


data = [{"P": "HD", "T": 0,  "C":100, "Max": 1},
        {"P": "HD", "T": 0,  "C":400, "Max": 3},
        {"P": "HD", "T": 0,  "C":800, "Max": 0},
        {"P": "HD", "T": 23, "C":100, "Max": 2},
        {"P": "HD", "T": 23, "C":400, "Max": 1},
        {"P": "HD", "T": 23, "C":800, "Max": 1},
        {"P": "HD", "T": 80, "C":100, "Max": 7},
        {"P": "HD", "T": 80, "C":400, "Max": 2},
        {"P": "HD", "T": 80, "C":800, "Max": 1},
        {"P": "LD", "T": 0,  "C":100, "Max": 1},
        {"P": "LD", "T": 0,  "C":400, "Max": 2},
        {"P": "LD", "T": 0,  "C":800, "Max": 7},
        {"P": "LD", "T": 23, "C":100, "Max": 7},
        {"P": "LD", "T": 23, "C":400, "Max": 1},
        {"P": "LD", "T": 23, "C":800, "Max": 0},
        {"P": "LD", "T": 80, "C":100, "Max": 2},
        {"P": "LD", "T": 80, "C":400, "Max": 0},
        {"P": "LD", "T": 80, "C":800, "Max": 1}]

df = pd.DataFrame(data)

chart = alt.Chart(df).mark_bar().encode(
    x="P:N",
    y=alt.Y("Max:Q", title="Maximum Long Word Observed (units)"),
    color="P:N",
    row="T:N",
    column="C:N"
).properties(width=100, height=100)
     P   T    C  Max
0   HD   0  100    1
1   HD   0  400    3
2   HD   0  800    0
3   HD  23  100    2
4   HD  23  400    1
5   HD  23  800    1
6   HD  80  100    7
7   HD  80  400    2
8   HD  80  800    1
9   LD   0  100    1
10  LD   0  400    2
11  LD   0  800    7
12  LD  23  100    7
13  LD  23  400    1
14  LD  23  800    0
15  LD  80  100    2
16  LD  80  400    0
17  LD  80  800    1

facet_grid

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