Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using one label for a facet grid not documented #28

Open
mcp292 opened this issue Aug 4, 2022 · 4 comments
Open

Using one label for a facet grid not documented #28

mcp292 opened this issue Aug 4, 2022 · 4 comments

Comments

@mcp292
Copy link

mcp292 commented Aug 4, 2022

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

@mcp292
Copy link
Author

mcp292 commented Aug 4, 2022

I will put a $10 bounty on this!

@jakevdp
Copy link
Member

jakevdp commented Aug 4, 2022

In general you'll have better luck getting questions answered at https://github.com/altair-viz/altair/discussions or https://stackoverflow.com/questions/tagged/altair

@mcp292
Copy link
Author

mcp292 commented Aug 4, 2022

Awesome! That's what I was looking for here and here. Will pursue in those channels, but if you want to make a quick ten bucks...

I leave it to you as to whether or not to close this issue. It would be great information to have in that section.

@mcp292
Copy link
Author

mcp292 commented Aug 9, 2022

vega/altair#2666 (reply in thread)

It is not documented that you can pass an iterable to either header or title!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants