vegawidget / altair

R interface to 'Altair'
https://vegawidget.github.io/altair
Other
91 stars 9 forks source link

Rounding of small values for log scale #128

Closed andyreagan closed 4 years ago

andyreagan commented 4 years ago

When I'm plotting small values on a log scale, altair seems to be somehow rounding them, the vertical lines here are incorrect:

Screen Shot 2020-05-04 at 2 51 58 PM

^ that's what I see in the RStudio window. If I save the chart spec to json and paste in the vega-lite viewer, it looks fine (see link below). So there is a rounding happening somewhere between altair and vega-list is my best guess. Here's the my code for this chart (data is in the vega-lite viewer link at bottom):

base <- alt$Chart(data)$mark_line()$encode(
    x='age:Q',
    y=alt$Y('q:Q', scale=alt$Scale(type='log', nice=TRUE, round=FALSE)),
    detail='issue_age10:O'
)$properties(
    title='log10(q) versus age, banded by 10 years'
)

https://vega.github.io/editor/#/url/vega-lite/N4Igxg9gdgZglgcxALlANzgUwO4tJKAFzigFcJSBnAdTgBNCALFAFgAY2AacaYsiygAlMiRoRQBmDgF9p3OgENCCvCCgKAtphQhFygLQBWAOxgFADg7mFMAGzHzhgExOFATgUBGBYZbHMbrYwbCxOLCByIBoKAE4A1joANiTa3JhQkHQkSKi6mMpwiaqEAJ4ADtrIIBAxWepF3PCYiXQ6cJSUpJgA+goImJ5sEdwAHsXllSAAjqQKRHDKxGipIE0tOn3akSXjFTozc8SLcMsgjVjrVVNnIJRmiZWgUHBglYQxXdwxFFCtyDAKRKUTDcUp7KqJCBIWSRI4PJJQwYACimAEoAATLGKdSjozacdEAIzmdEwdCJJXRg3RJUwsUoNwAJHdGJhojoxIQypRkAB6XnLBAKAB0CAWjFIhOFcAgvJZbIUAswQv0yUImAFLGFbGFTmFACtKNAbnoFMDCAzcqajKYLFYbPZHC53F4fH4AkEQmEUABtUDtTo9TaDFBOLggTYoTzmbjXZA6jhsWxubiQhCDOP6CTCzy2TyeQxsNxFpy2JzGFiGOT+jpdXr9EPIMPcSPITwp6YoBMcWwxkBpjMoLM5+wsNyDczGJxuCTGWwsasgAN14NDJvh1vNzvx7U9wwSA+Ho9H1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KipwViNV81tdJ5MIjEdiKIDjNJ95Io8xPCUARIVi6FN5JZajcoASRZAZiotIZwAJwTkAKwViwiBE-C-jbkdiFYksHAo9c4ep0SL8oZnJ1N8T4M9MC5OVpwW1HJyTYCpsBkk9-jYcTAnxjjSIJ5ldXjyiliCDeJCo7j0DIoHIoJCpgZIjTjoDziQsJ5+VOTek5wzEkU4IGpBSwZpDVCO9bVqEg0Xi8xw5GFmFxCO09TDCWtdxc48Fc4MDkxml2Bh8yjdTOcN9eCtEBCGo7wh8zFxw1ZrSpD7DeC5xD0OUQ5KC-AFFgzOdvCqcBd3VD8PdTUNp4zojJcBl4FMoOs95rx3oOUTj3TGwQyMjYCQhNJczQljsDZKZ3CdSyzOcCCpNqS8cJUGjX8oVGllCH9yzKiq9GNujkFx5SIO4Y9+zOdRiHB2y6iqsXtHl3FcxMzziDTdwZxZ9AjdNxYnxixnxuTVzWwLiHEJw4TMwdjAheYQh2JyCm15jcDKilivS-45z4SEEkwTAoIiIoJQiQYpycZITTzNU7jHAgMRY0FHA30jzZJMTTz+E7jkFxw+pSJiwVpX55SByKSA4rw3yLz4MGptJYZ3CSYHyoCsLWSvFxSol5ZeJCwSoZUALziRTrwtzuIdioV8tRIRYmpRyYLKg38oZlS8Ti0djfAiDKJ5wMD-zMKlieDRITzOTrx9x2xKxHJIpSItJpAABdWQIAA

ijlyttle commented 4 years ago

I think this is a difference between the Vega-Lite version (4.0.2) used by altair and the version used by the Vega-Lite editor (4.12.0).

FWIW, I am thinking to update altair as soon as (python) Altair uses Vega-Lite 4.9, which has arc-marks.

Closing for now - please re-open if you think it should be.

andyreagan commented 4 years ago

I don't think that's the issue. In the vega-lite editor, you specify the vega spec to use. With 4.0.2 specified in the editor, will it still use 4.12.0 under the hood?

ijlyttle commented 4 years ago

Here's what I see at the Vega-Lite editor - it indicates it is using 4.12.0 under the hood:

image

andyreagan commented 4 years ago

Yeah that's what I see in the editor too. If you're confident that's due to a fix in vegalite then cool, I'll just hang tight for versions to get updated in sequence.

On Mon, May 11, 2020, 7:07 AM Ian Lyttle notifications@github.com wrote:

Here's what I see at the Vega-Lite editor - it indicates it is using 4.12.0 under the hood:

[image: image] https://user-images.githubusercontent.com/2800934/81555144-992f4c00-934d-11ea-8b00-ab8f9b05b242.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vegawidget/altair/issues/128#issuecomment-626635642, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAW7OCOCW5QCFNBNSSNDQEDRQ7L6PANCNFSM4MY75WBA .