Re: [julia-users] Gadfly: multiple y axes in one plot

2014-03-04 Thread Sven Mesecke
Thanks to everyone for the feedback, I actually tend to agree that the use 
of two different y axes in the same plot should be discouraged. Sometimes 
it's just too convenient...
In the end, I used `Geom.subplot_grid` with a `Geom.bar` plot which worked 
fine. However, it only worked with `position=:dodge` as `:stack` messed up 
y axis rescaling with the grouped bar plot (see the [github 
issue](https://github.com/dcjones/Gadfly.jl/issues/220)).

Thanks again,

Sven

On Friday, February 28, 2014 5:53:33 PM UTC+1, David Chudzicki wrote:

 For Harlan's first alternative, what you want is: 
 http://dcjones.github.io/Gadfly.jl/geom_subplot_grid.htmlhttp://www.google.com/url?q=http%3A%2F%2Fdcjones.github.io%2FGadfly.jl%2Fgeom_subplot_grid.htmlsa=Dsntz=1usg=AFQjCNGkuNRl54WCZ905qEjVlGLJ4I_giQ

 Here's an example (below). We should put an example like this (with 
 free_y_axis=true) in the documentation.

 For some reason the call with (free_y_axis=true) is giving me trouble in 
 an IJulia/IPython notebook, but work for me everywhere else. (I'm pasting 
 the error message below.) 

 -David



 using DataFrames
 using Gadfly

 widedf = DataFrame(x = [1:10], var1 = [1:10], var2 = [1:10].^2)

 longdf = stack(widedf, [:var1, :var2])

 # this isn't what we want b/c the scales are the same:
 plot(longdf, ygroup=variable, x=x, y=value, 
 Geom.subplot_grid(Geom.point))

 # this is what we want, but for some reason it isn't working for me in 
 iPython notebook
 plot(longdf, ygroup=variable, x=x, y=value, 
 Geom.subplot_grid(Geom.point, free_y_axis=true))




 # argument range must not be empty
 #  in maximum_rgn at reduce.jl:336
 #  in text_extents at 
 /Users/david/.julia/v0.3/Compose/src/fontfallback.jl:82
 #  in render at /Users/david/.julia/v0.3/Gadfly/src/guide.jl:587
 #  in render_prepared at /Users/david/.julia/v0.3/Gadfly/src/Gadfly.jl:712
 #  in render at /Users/david/.julia/v0.3/Gadfly/src/geom/subplot.jl:201
 #  in render_prepared at /Users/david/.julia/v0.3/Gadfly/src/Gadfly.jl:705
 #  in render at /Users/david/.julia/v0.3/Gadfly/src/Gadfly.jl:656
 #  in writemime at /Users/david/.julia/v0.3/Gadfly/src/Gadfly.jl:755
 #  in sprint at io.jl:467
 #  in display_dict at 
 /Users/david/.julia/v0.3/IJulia/src/execute_request.jl:35

 On Fri, Feb 28, 2014 at 8:07 AM, Harlan Harris 
 har...@harris.namejavascript:
  wrote:

 Don't do it. It's not good data visualization practice, and is explicitly 
 and intentionally not supported in most grammar of graphics 
 implementations. See, for one recent post I have handy: 
 http://junkcharts.typepad.com/junk_charts/2014/02/a-message-worth-repeating.html

 Two good alternatives are to stack/facet the graphs, one on top of each 
 other, or to normalize the Y values so that they're proportions of their 
 initial values. The latter's pretty common in financial plots, where Y=100 
 for X=min(X) for all series, so they start at the same point and then 
 diverge.




 On Fri, Feb 28, 2014 at 10:20 AM, Sven Mesecke 
 sven.m...@sveme.orgjavascript:
  wrote:

 I'd like to replicate the behavior of matlab's `plotyy` in Gadfly, i.e., 
 I'm trying to plot data with very different `y` axes but the same `x` axes 
 on the same plot, any idea of how to get this done? `layer` always seems to 
 use the same base `y` axis.

 Thanks for any pointers,

 Sven





 -- 
 David J. Chudzicki
 blog.davidchudzicki.com
 dch...@gmail.com javascript:
 (518) 366-7303

 Data Scientist
 Kaggle (we're hiring!) 



Re: [julia-users] Gadfly: multiple y axes in one plot

2014-03-04 Thread Tim Holy
Somehow, I didn't find the reasoning in that particular example very 
convincing. The real problem in that example---which the post completely 
ignores---is that neither of the axes starts at 0. (The zeros should also 
align between the two axes.) I can't see the objection to displaying the 
actual units of each signal; the only difference between that and normalizing 
to some value (say, the initial one) is that the latter throws information 
away; you'd end up with the same lines in the end.

--Tim

On Friday, February 28, 2014 11:07:19 AM Harlan Harris wrote:
 Don't do it. It's not good data visualization practice, and is explicitly
 and intentionally not supported in most grammar of graphics
 implementations. See, for one recent post I have handy:
 http://junkcharts.typepad.com/junk_charts/2014/02/a-message-worth-repeating.
 html
 
 Two good alternatives are to stack/facet the graphs, one on top of each
 other, or to normalize the Y values so that they're proportions of their
 initial values. The latter's pretty common in financial plots, where Y=100
 for X=min(X) for all series, so they start at the same point and then
 diverge.
 
 On Fri, Feb 28, 2014 at 10:20 AM, Sven Mesecke 
sven.mese...@sveme.orgwrote:
  I'd like to replicate the behavior of matlab's `plotyy` in Gadfly, i.e.,
  I'm trying to plot data with very different `y` axes but the same `x` axes
  on the same plot, any idea of how to get this done? `layer` always seems
  to
  use the same base `y` axis.
  
  Thanks for any pointers,
  
  Sven


[julia-users] Gadfly: multiple y axes in one plot

2014-02-28 Thread Sven Mesecke
I'd like to replicate the behavior of matlab's `plotyy` in Gadfly, i.e., 
I'm trying to plot data with very different `y` axes but the same `x` axes 
on the same plot, any idea of how to get this done? `layer` always seems to 
use the same base `y` axis.

Thanks for any pointers,

Sven


Re: [julia-users] Gadfly: multiple y axes in one plot

2014-02-28 Thread Harlan Harris
Don't do it. It's not good data visualization practice, and is explicitly
and intentionally not supported in most grammar of graphics
implementations. See, for one recent post I have handy:
http://junkcharts.typepad.com/junk_charts/2014/02/a-message-worth-repeating.html

Two good alternatives are to stack/facet the graphs, one on top of each
other, or to normalize the Y values so that they're proportions of their
initial values. The latter's pretty common in financial plots, where Y=100
for X=min(X) for all series, so they start at the same point and then
diverge.




On Fri, Feb 28, 2014 at 10:20 AM, Sven Mesecke sven.mese...@sveme.orgwrote:

 I'd like to replicate the behavior of matlab's `plotyy` in Gadfly, i.e.,
 I'm trying to plot data with very different `y` axes but the same `x` axes
 on the same plot, any idea of how to get this done? `layer` always seems to
 use the same base `y` axis.

 Thanks for any pointers,

 Sven