Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11351

Re: Drawing a Line From One Plot to Another

From Vincenzo Carrino <vincent.carrino@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Drawing a Line From One Plot to Another
Date 2012-08-15 07:33 +0000
Message-ID <k0fjbs$q7j$1@smc.vnet.net> (permalink)
References <k0d4b9$m8b$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Drawing a Line From One Plot to Another Gregory Lypny <gregory.lypny@videotron.ca> - 2012-08-14 09:04 +0000
  Re: Drawing a Line From One Plot to Another Vincenzo Carrino <vincent.carrino@gmail.com> - 2012-08-15 07:33 +0000
  Re: Drawing a Line From One Plot to Another "Alexander Elkins" <alexander_elkins@hotmail.com> - 2012-08-16 06:06 +0000
  Re: Drawing a Line From One Plot to Another E. Martín-Serrano <eMartinSerrano@telefonica.net> - 2012-08-20 08:16 +0000
  Re: Drawing a Line From One Plot to Another "Alexander Elkins" <alexander_elkins@hotmail.com> - 2012-08-29 05:19 +0000

csiph-web