This question already has an answer here:

This is my first question here, so I'm sorry if I do something wrong. Also I'm fairly new to Mathematica (using 8). I've used it about 2 months. Only 2 weeks intensive. The rest was about NDSolve most of the time to be honest.

I have some results (approx. $100,000$) which I want to represent as a ListPlot. I can generate a SmoothHistogram which gives me the distribution of the points.

What I now want to do is something like this:

sample plot

I tried using Epilog -> Inset[plot,{0,20},{0,0}]. But I can't get the alignment fixed.

I used following code:

Definition of subplot.

    distriW = 
  SmoothHistogram[data[[All, 1]], Automatic, "PDF", 
   PlotRange -> {{-22, 20}, {0, 0.75}}, ImageSize -> 400, 
   AspectRatio -> 2/9, Axes -> {True, False}, AxesOrigin -> {-20, 0}];

Code for the entire plot

 Show[ListPlot[data[[All, {1, 2}]], ImageSize -> 400, Axes -> False, 
  PlotStyle -> {AbsolutePointSize[1]}, AxesOrigin -> {-20, 0}, 
  Epilog -> {Inset[distriW, {0, 20}, {0, 0}]}, 
  PlotRange -> {{-20, 20}, {-20, 40}}, 
  Prolog -> {Directive[lijnen], vert, hori}, Frame -> True, 
  PlotRangePadding -> None, FrameTicks -> Automatic]]



As you can see the alignment isn't great in my opinion. Furthermore, I can get the ticks for the small (sub-)axis right but I need to change the position a little bit. I have no idea how to do this. I can find the rotated part myself once I know how to fix this.


marked as duplicate by Sjoerd C. de Vries, Michael E2, rm -rf Jan 19 '14 at 21:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Browse other questions tagged or ask your own question.