Sorry to reopen this issue, but I am trying to recreate this same plotting style in Gadfly as this issue Plotting histogram on the y-axis at the end of a time series. I have these two plots and want to plot side by side with the second plot being horizontal, however, unlike the previous issue I cannot just change the orientation of the histogram because I have a layer on it, I think I can achieve this by changing the orientation of the layer but I’m not sure how to do that.
tsteps = range(tspan[1], tspan[2], length = datasize)
GBM_Means = S₀.*exp.(r.*tsteps)
tsteps1 = tsteps[:,1]*30
GBM_Means = convert(Vector{Float32}, GBM_Means)
layer1 = Gadfly.layer(x = tsteps1,y = GBM_Means, Geom.line,linestyle=[:dash],color=[colorant"black"])
pa = Gadfly.layer(y_sort, x=Row.index, y=Col.value, color=Col.index, Geom.line)
plt1 = Gadfly.plot(layer1,pa,Guide.xlabel("Time"),Guide.ylabel("Stock Price"),Guide.yticks(ticks = [50 75 100 125 150 175]), Scale.ContinuousColorScale(p -> get(ColorSchemes.:YlOrBr_6, p)),Theme(key_label_font_size=6pt,major_label_font_size=7pt,key_position = :none),Guide.manual_color_key("", ["Neural SDE Stock Price Path","Mean"],["#FFA500","#000000"],pos=[0.05w,-0.45h],shape=[Gadfly.Shape.hline,Gadfly.Shape.hline]),Coord.cartesian(xmin=0, xmax=30, ymin=50, ymax=182))
and
lambda = -(4*0.08*exp(0.08))/(4*(1-exp(0.08)))*100
#LN = LogNormal(0.08,0.2)
LN = NoncentralChisq(1,lambda)*(-4(1-exp(0.08))/(4*0.08))
s = 40:0.005:200
s = s[:,1]
LNPDF = pdf.(LN,s)
layer1 = Gadfly.layer(x= s,y= LNPDF, ymin= zeros(size(LNPDF)), Theme(alphas=[0.3],default_color=colorant"black") , ymax= LNPDF, Geom.line ,Geom.ribbon)
p = Gadfly.plot(layer1)
plt = Gadfly.plot(layer1,x = y1,Guide.xlabel("Frequency"),Guide.ylabel(nothing),Theme(key_label_font_size=6pt,major_label_font_size=7pt,key_position = :none,default_color=colorant"orange"),Guide.manual_color_key("", ["Neural SDE Terminal Stock Price","Non-central Chi-squared Density Function"],["#FFA500","#000000"],pos=[0.6w,-0.45h],shape=[Gadfly.Shape.hline,Gadfly.Shape.hline]),xintercept=[m], Geom.vline(color=["black"],style=[:dash]),Geom.histogram(density=:true, bincount=20),Guide.xticks(ticks = [40 50 75 100 125 150 175 200]), Guide.xlabel(nothing))
I would like to plot these as stated in the question. Essentially I want it to look like this:
Also as a side question, is it possible to change the x-axis of the first plot to not use Row.index?