Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Drawing a Line From One Plot to Another

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127692] Re: Drawing a Line From One Plot to Another
  • From: Vincenzo Carrino <vincent.carrino at gmail.com>
  • Date: Wed, 15 Aug 2012 03:34:46 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <k0d4b9$m8b$1@smc.vnet.net>

On Tuesday, August 14, 2012 5:04:41 AM UTC-4, Gregory Lypny wrote:
> Hello everyone,
>
>
>
> Say I have two plots, y=x^2 and y=2x, aligned vertically using GraphicsColumn.  Their domains are aligned because x runs from -3 to +3 in both. I'd like to be able to draw a line from a point in the top graph to a point in the bottom graph.  How can I do that?
>
>
>
> Regards,
>
>
>
> Gregory

If we use the Epilog option on each plot then a line can be drawn on both plots independently. The result would have a gap in the middle though. It is possible to then use the Spacings option on the GraphicsColumn to bring the plots together, but then the plots blend together. Also important is to use ImagePadding to control the width of each plot.

GraphicsColumn[{Plot[x^2, {x, -5, 5}, ImagePadding -> 10, Epilog -> Line[{{3, -100}, {3, 100}}]],
    Plot[2*x, {x, -5, 5}, ImagePadding -> 10, Epilog -> Line[{{3, -100}, {3, 100}}]]},
  Spacings -> -21]

The other option is to use Show with the GraphicsColumn and Graphics[Line[]]. You have to just play with the coordinates for that line though, very adhoc.

Show[GraphicsColumn[{Plot[x^2, {x, -5, 5}, ImagePadding -> 10], Plot[2*x, {x, -5, 5}, ImagePadding -> 10]}],
  Graphics[Line[{{282, -470}, {282, 0}}]]]

Hope that helps.

Cheers,

Vincenzo



  • Prev by Date: working with nested lists
  • Next by Date: Clear Citation Style Cache?
  • Previous by thread: Re: Drawing a Line From One Plot to Another
  • Next by thread: Re: Drawing a Line From One Plot to Another