Force Altair to Share Axis / Get Domain Range
See original GitHub issueHi,
I am looking to figure out how to either: a) Force a concatenated chart to share an axis b) Retrieve the domain (y and/or x limits) of another chart
You can see in the below that I have concatenated a series of charts. I would like the histograms on the right to have the same y domain as the line charts on the left.
Any ideas?
Thanks!
chart1 = alt.Chart(temp.loc[temp['Series'] != 'Error', :]).mark_line().encode(
alt.X('index:T'),
alt.Y('value:Q'),
alt.Color('Series:N', legend=alt.Legend(orient='left')),
).properties(
height=400,
width=1000
)
chart2 = alt.Chart(temp.loc[temp['Series'] == 'Error', :]).mark_line().encode(
alt.X('index:T'),
alt.Y('value:Q'),
color='Series:N'
).properties(
height=200,
width=1000
)
chart3 = alt.Chart(temp.loc[temp['Series'] == 'Error', :]).mark_bar().encode(
alt.X('count()'),
alt.Y('value:Q', bin=alt.Bin(maxbins=100)),
alt.Color('Series:N')
).properties(
height=200,
width=200
)
chart4 = alt.Chart(temp.loc[temp['Series'] != 'Error', :]).mark_bar(opacity=.4).encode(
alt.X('count()'),
alt.Y('value:Q', bin=alt.Bin(maxbins=100)),
alt.Color('Series:N')
).properties(
height=400,
width=200
)
alt.vconcat(
alt.hconcat(
chart1,
chart4
),
alt.hconcat(
chart2,
chart3
)
)
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Altair: use a field to specify the domain of the Y axis?
Suppose I have an interactive plot like the below, and I want the Y axis domain to change with the selection in the...
Read more >Customizing Visualizations — Altair 4.2.0 documentation
To make a custom mapping of discrete values to colors, use the domain and range parameters of the Scale class for values and...
Read more >Tutorial 1b: High- and low-level plotting
The main high-level plotting package we will use is Altair. It uses the Vega/Vega-Lite ... labeling the axes, setting their ranges, stylizing the...
Read more >How to use the altair.Axis function in altair - Snyk
How to use the altair.Axis function in altair · To help you get started, we've selected a few altair examples, based on popular...
Read more >Chapter 4. Visualization with Matplotlib - O'Reilly
Figure 4-63. Shared x and y axis in plt.subplots() · Figure 4-64. Identifying plots in a subplot grid.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can use the
resolve_scale
method to specify shared scales. Here is a quick example:Ah - that’s too bad.
Thanks so much for your help!