2
$\begingroup$

I try to create a special plot where several lines have to be generated automatically between two plots at very precise coordinate. My goal is to make something exactlly like this

But I want to do it for different spectra. If you wonder what does represent this picture, I can tell you that this is about atomic laser spectroscopy (If you have questions I will be glad to give you some answers.)

So, this graph is divided in two parts: the part on the top of the picture is a plot showing several line crossing each other. At each crossing point, a dashed line is drawn towards the second part of the picture, depicting the spectrum. The part on the right has absolutely no importance.

In Mathematica, I can generate each part of the picture separately without problems. I also have the coordinates of every crossing points (one can easily find them by solving the equations of each straight line). I know that it is possible to align verticaly both plots by using GraphicsColumn and ImagePadding.

Now I am searching for the way to generate these dashed vertical lines, knowing the coordinates of each crossing points. Does someone have an idea ?

After that, I would like to automate the method for generating these lines by creating an appropriate function. I guess that the arguments of this function will be the number of crossing points and their coordinates.

Thanks a lot for your coming help

Mimmo

$\endgroup$
3
  • 1
    $\begingroup$ Why not a single Plot using Epilog to draw the lines? $\endgroup$ Commented Jul 7, 2015 at 21:56
  • $\begingroup$ Each part is generated independently using two different routines that I have created. As in the picture, the final graphic has to show each part stil separated with their own axes ans label axes. The vertical dashed lines have to link both plots, from one crossing point to the corresponding peak in the spectrum. But certainly one will have to use the Epilog function. $\endgroup$
    – Mimmo
    Commented Jul 7, 2015 at 22:03
  • 1
    $\begingroup$ In this case, it would help you posted these routines with some sample data. $\endgroup$
    – yohbs
    Commented Jul 8, 2015 at 8:55

1 Answer 1

3
$\begingroup$

As @belisarius suggests:

Plot[{15 - x, x, -7 + Sin[x]}, {x, 0, 10},
 PlotRange -> {{-.5, 10}, Automatic},
 AxesOrigin -> {0, 0},
 TicksStyle -> {Automatic, White},
 AxesStyle -> {Automatic, White},
 ImageSize -> 700,
 Epilog -> {Rotate[Text[Style[
      "Velocity component \!\(\*SubscriptBox[\(v\), \(z\)]\) of \ atoms", 18], 
  {-0.2, 7}], 90 Degree],
   Arrow[{{0, 0}, {0, 16}}], 
   {Dashed, Line[{{7.5, -6}, {7.5, 7.5}}]}} 
   ]

enter image description here

Alternatively:

myPlot = Plot[{Sin[x], Sin[2 x]}, {x, 0, 2 \[Pi]}, ImageSize -> 200, 
   Frame -> True, Background -> LightYellow, AspectRatio -> 1/7, 
   ImagePadding -> 20];
Plot[Sin[x], {x, 0, 8 \[Pi]}, 
  PlotRange -> {{-1.5, 25}, {-3, 1}},
  Epilog -> {Inset[myPlot, {4, -2.2}, {1, 1}, 27], {Red, Dashed, 
     Line[{{5, -1}, {5, -2.2}}]}}]

enter image description here

$\endgroup$
3
  • $\begingroup$ Thank you for your answer though it is not exactly what I would like, but it is a good starting point for me. As i said in my previous comment, I would like that each part of the final graphic keep its own axes and axes label, that's why I generate these plots independently and combine them using 'GraphicsColumn'. But apparently you think that is not possible to do it ? $\endgroup$
    – Mimmo
    Commented Jul 8, 2015 at 8:46
  • 1
    $\begingroup$ @Mimmo IMO GraphicsColumn is not quite the best way to go. I would generate the two plots independently applying the necessary options to have them of the same size and then combine them within a single Graphics[...] and use, say, Epilog to generate the dashed lines. Using Graphics rather than GraphicsColumn allows for better control over the relative positioning of the sub-images. $\endgroup$
    – LLlAMnYP
    Commented Jul 8, 2015 at 12:05
  • $\begingroup$ Yes David this is more what I am searching for, thank you. I will test it and I will give you a feedback later $\endgroup$
    – Mimmo
    Commented Jul 10, 2015 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.