Set different Y-axis scale/range for each row
See original GitHub issueIs it possible to define or auto-set different y-axis ranges for different rows ? For instance, in the trellis_bar example, I would like to display a y-axis range that would better capture the data range.
In the default implementation (code below), the y-axis is set as the maximum range of all the rows, which in this case all the rows range between ymin=0 and ymax=80.
from altair import *
Chart('https://vega.github.io/vega-lite/data/cars.json').mark_bar().encode(
row='Origin:N',
x=X('Horsepower:Q',
bin=Bin(
maxbins=15.0,
),
),
y='count(*):Q',
)
Is there any way to change the display for each row? I would prefer a “zoomed” range for each row like : row 1 : [0,40] row 2: [0,50] row 3: [0,80]
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (11 by maintainers)
Top Results From Across the Web
Change the scale of the vertical (value) axis in a chart
By default, Microsoft Office Excel determines the minimum and maximum scale values of the vertical (value) axis, also known as the y axis,...
Read more >Different y scale for each row Matplotlib - Stack Overflow
Since it seems you want a shared y for each row, you will have to calculate the max value for each row and...
Read more >Re: How to set separate Y-Axis ranges for single-c...
I'd like to avoid breaking these into separate charts, but I can't figure out a way to make the Y-axis relative to the...
Read more >Edit Axes - Tableau Help
When you use an independent axis range, each row or column will have its own axis range based on the underlying data values....
Read more >Adjusting scales on axes - TIBCO Product Documentation
When you use the Dual scales option, there is one scale to the left and one scale to the right on the Value...
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
Thanks @jimmywan!
Below are two quick examples of setting independent x- and y- axes for anyone who may stumble upon this in the future:
Independent X-Axis
Independent Y-Axis
In Altair you can do this with the
resolve_scale
method; e.g.chart.resolve_scale(axis='independent')