Plotting histogram on the y-axis at the end of a time series

Here is my quick attempt to produce a “similar” plot in Gadfly.

x = 1.0:5:500.0
D = DataFrame(x=x, y=x/250+randn(100))
pa = plot(D, layer(x=:x, y=:y, Geom.point, Geom.smooth),
    layer(x=[0], y=[4], label=["x10⁴"], Geom.label(position=:right)),
    Guide.xlabel("Time<sub> </sub>(yr)"), Guide.ylabel("Volume (km³)"), 
    Guide.title("Grounded Volume") )
pb = plot(D, y=:y, Geom.histogram(orientation=:horizontal, bincount=10, density=true), 
    Guide.xlabel("π(<i>V̂<sub>g</sub></i>)<sup>x10⁻⁵</sup>"), Guide.ylabel(""),
    Guide.title(" "))

M = Array{Compose.Context}(1,2)
M[1] = compose(context(0,0,2/3,1), render(pa))
M[2] = compose(context(0,0,1/3,1), render(pb))

draw(PNG(6.6inch, 3.3inch), hstack(M...))

fig1

3 Likes