Re:One Chart, Twelve Charting Libraries
by jcheng on Saturday May 21, 2016 @01:52PM
(#11745495)
Thanks, I found this interesting.
> And I couldn’t combine a log-scale with setting the domain of the x-scale to zero
I don't think it's mathematically possible to have a log scale start at zero, you just make the exponent more and more negative. The first two charts look like you've done it but they're not correct--you don't want the values to be log, you want the scale to be log. In ggplot2 you do this by adding "scale_x_log10()" to the plotting expression, and in native R you usually pass log="x" (I believe).
Re:One Chart, Twelve Charting Libraries
by lisacrost on Saturday May 21, 2016 @02:06PM
(#11745535)
Great point! I'm surprised that nobody else noticed that so far :) sometimes I set the values to log because I couldn't find an option to set the scale to log, but you're right, in R and ggplot2 I should use your described options.
Re:One Chart, Twelve Charting Libraries
by hadley on Sunday May 22, 2016 @03:31AM
(#11747668)
And on a log scale you probably want to set the minimum value to 1 since the log of zero is negative infinity (I suspect that's the root cause of your ggvis problem)
> And I couldn’t combine a log-scale with setting the domain of the x-scale to zero
I don't think it's mathematically possible to have a log scale start at zero, you just make the exponent more and more negative. The first two charts look like you've done it but they're not correct--you don't want the values to be log, you want the scale to be log. In ggplot2 you do this by adding "scale_x_log10()" to the plotting expression, and in native R you usually pass log="x" (I believe).