Coloumn Graphics with a shape placed on both elements

I want to make the following plot:

The blue one is

p1 = Plot[x Sin[x] - 1, {x, -2.5, 2.5}]

and the red one is

p2 = Plot[Evaluate[D[x Sin[x] - 1, x]], {x, -2.5, 2.5}, 
  PlotStyle -> Red]

(Copied from this tutorial)

and then I used

GraphicsColumn[{p1, p2}]

I want to insert these two black vertical lines that would attract notice from the reader on a more subtle figure I am working on (I drew these two lines with Windows Paint).

Is that possible?

Ehud,

if it is just for a single graphic, then here is a really “quick and dirty” way: You make a right-click with your mouse over the graphics generated from GraphicsColumn[{p1, p2}], choose “Get Coordinates” and read out the respective values. This then can be used for GridLines, e.g.:

GraphicsColumn[{p1, p2}, GridLines -> {{90, 260}, None}, GridLinesStyle -> Thick]

But I am curious myself for a clean solution.
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=gridlines.png&userId=32203

Hi Ehud,

I don’t think there is a way to do that without rasterizing the column and adding the lines. If combining the plots is acceptable

Show[p1, p2,
 Graphics@InfiniteLine[{1.1, 0}, {0, 1}],
 Graphics@InfiniteLine[{-1.4, 0}, {0, 1}],
 PlotRange -> All]

or

Show[p1, p2,
 GridLines -> {{{1.1, Black}, {-1.4, Black}}, None},
 GridLinesStyle -> Directive[Black, Thickness[0.003]],
 PlotRange -> All]

Nice, I would not have thought of that. There must be a way to convert from plot coordinates to graphics coordinates?

Hi Rohit,

I guess those coordinates are in terms of ImageDimensions[<respective graphics>], i.e. this transformation might be pretty ugly.

@Henrik Schachner,

Thanks so much for your advice. It is exactly what I was looking for.