question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dear all,

Is it possible to scale x-axis? No problem on y-axis…

# Plot the data points on an interactive axis
points = alt.Chart(df).mark_circle(color='black').encode(
    x=alt.X('Year:Q', title='Year', axis=alt.Axis(titlePadding=10, format = 'd', tickCount=15),
            scale=Scale(domain=[1984, 2019])),
    y=alt.Y('Number of rainy days', title='Number of rainy days', axis=alt.Axis(titlePadding=10)))


bar_linear = alt.Chart(prediction_df).transform_fold(
    ['Linear regression	'],
    as_=['degree', 'yfit']
).mark_line().encode(
    x=alt.X('Year:Q', scale=Scale(domain=[1984, 2019])),
    y=alt.Y('Linear regression'),
    color = alt.Color('degree:N', title = 'Type of regression')
)


# Plot the best fit polynomials
polynomial_fit = alt.Chart(wet_days_df).transform_fold(
    ['Cubic spline'],
    as_=['degree', 'yfit']
).mark_line().encode(
    x= alt.X('xfit:Q', scale=Scale(domain=[1984, 2019])),
    y= alt.Y('yfit:Q'),
    color = alt.Color('degree:N', title = 'Type of regression', scale=alt.Scale(range=['#d62728', '#1f77b4']))
)

points.properties(width=700, height=400) + polynomial_fit + bar_linear

**SchemaValidationError: Invalid specification

        altair.vegalite.v4.schema.core.Axis, validating 'additionalProperties'

        Additional properties are not allowed ('scale' was unexpected)**
        

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jakevdpcommented, Oct 26, 2020

Ah, I see. If you pass nice=False to the scale, it should work the way you want.

0reactions
Amarounekcommented, Feb 23, 2021

Sorry, thanks, closed! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scaling X axis error and need help adding "%" symbol to X ...
I am trying to scale the X axis from 3 to 5 by 0.5, but whenever I try using scale_x_continuous or discrete I...
Read more >
Mutliple Y axis scale error with brush · Issue #737 - GitHub
I expect the first Y axis has the correct scale. What is happening instead? The first Y axis has the same scale as...
Read more >
How to fix Y axis scale - Microsoft Power BI Community
I have made two visuals showing the total number of orders and in both the totals are the same per date, but the...
Read more >
How to Fix R Error: Discrete value supplied to continuous scale
This error occurs when you attempt to apply a continuous scale to an axis in ggplot2, yet the variable on that axis is...
Read more >
ggcyto wrong axis scale?
As you can see, the values on x-axis are not correct. ... Error when plotting flow cytometry data • ... color scale ggcyto::autoplot...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found