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: [mg127758] Re: Drawing a Line From One Plot to Another
  • From: E. Martín-Serrano <eMartinSerrano at telefonica.net>
  • Date: Mon, 20 Aug 2012 04:13:26 -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> <20120816055616.C876667E5@smc.vnet.net>

f2[x_]:=2  x
f1[x_]:= x^2
xmin =-3;
xmax= 3;
plotrange1={{-3.3,3.3},{-0.9,9.9}};
plotrange2={{-3.3,3.3},{-6.6,6.6}};

Manipulate[
Module[{isize =300},
xmin =-3;
xmax= 3;

pt11 ={xx, f1[xx]};
pt12 ={xx, plotrange1[[2]][[1]]};

g1 =Show[{Plot[f1[x],{x,xmin,xmax},PlotStyle-> Purple ],
Graphics[{{Red,Dashed, Line[{pt11 ,pt12}]},  Red,PointSize[.02],
Point[pt11], Black, Circle[pt11,Offset[4]]}]}, PlotRange -> plotrange1,
Axes-> True,AxesStyle->{Transparent,LightGray},Ticks->Automatic,Frame->
True,FrameStyle -> {{LightGray, LightGray},{Transparent,
LightGray}},FrameTicks -> False,ImageSize -> isize];


pt21 ={xx, f2[xx]};
pt22 ={xx, plotrange2[[2]][[2]]};

g2=Show[{Plot[f2[x],{x,xmin,xmax},PlotStyle-> Blue ], Graphics[{{Red,Dashed,
Line[{pt21 ,pt22}]},  Red,PointSize[.02], Point[pt21],Black,
Circle[pt21,Offset[4]]}]}, PlotRange -> plotrange2, Axes->
True,AxesStyle->{Transparent,LightGray},Ticks->Automatic,Frame->
True,FrameStyle -> {{LightGray,
LightGray},{LightGray,{Dashed,LightGray}}},FrameTicks -> False,ImageSize ->
isize];

Column[{g1,g2},Center,Spacings->0]],

{{xx,.6,"Current 'x' value"},xmin,xmax, ImageSize->Small}]

(* Try the slider and the Manipulate 'Autorun' *)







  • Prev by Date: Re: Inconsistent behavior of RegionFunction in ContourPlot and ListContourPlot
  • Next by Date: Re: V8 slow like a snail
  • Previous by thread: Re: Drawing a Line From One Plot to Another
  • Next by thread: Re: Drawing a Line From One Plot to Another