MathGroup Archive 2009

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

Search the Archive

Re: Show problem: combining ListPlot and Plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96946] Re: Show problem: combining ListPlot and Plot
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 28 Feb 2009 06:39:30 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <go8ht0$l0a$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

set the aspect ratio by hand, i.e.,

DisplayChannel = $DisplayFunction;
If[$VersionNumber >= 6.0, DisplayChannel = Print];
(*fix for Mathematica 6& later*)
Off[General::spell1]; Off[General::spell];

ClearAll[r];
vFEM = {{4., 0.054}, {7., 0.0395}, {10., 0.037}};
vexact = 0.1905*(1/r + r/100); rbeg = 4.; rend = 10.;
pFEM = ListPlot[vFEM, PlotJoined -> True,
    PlotStyle -> {RGBColor[1, 0, 0]}, DisplayFunction -> Identity];
pexact = Plot[vexact, {r, rbeg, rend},
    PlotStyle -> {RGBColor[0, 0, 0]}, DisplayFunction -> Identity];
Show[Graphics[AbsoluteThickness[2]], pexact, pFEM,
  TextStyle -> {FontFamily -> "Times", FontSize -> 12},
  GridLines -> Automatic, Axes -> True, PlotRange -> All,
  PlotLabel -> "Radial displacement (black=exact,red=FEM)",
  Frame -> True, DisplayFunction -> DisplayChannel, AspectRatio -> 1]


Regards
   Jens



carlos at colorado.edu wrote:
> The following extract exemplifies a plot technique I used to
> combine ListPlot and a Plot under v 2.2. It worked fine
> under 3.0, 4.1,4.2 and 5.1.  But students using this under 6.0 and
> 7.0 for a HW report the plot frame "squished", and that line colors
> disagree with the title. Question: can this be fixed in
> a simple way or should it be completely rewritten? Thanks.
> 
>    DisplayChannel=$DisplayFunction;
>    If [$VersionNumber>=6.0, DisplayChannel=Print];
>   (* fix for Mathematica 6 & later *)
>    Off[General::spell1]; Off[General::spell];
> 
>    ClearAll[r];
>    vFEM={{4., 0.054}, {7., 0.0395}, {10., 0.037}};
>    vexact=0.1905*(1/r + r/100); rbeg=4.; rend=10.;
>    pFEM=ListPlot[vFEM,PlotJoined->True,PlotStyle->{RGBColor[1,0,0]},
>         DisplayFunction->Identity];
>    pexact=Plot[vexact,{r,rbeg,rend},PlotStyle->{RGBColor[0,0,0]},
>         DisplayFunction->Identity];
>    Show[Graphics[AbsoluteThickness[2]],pexact,
>         pFEM,TextStyle->{FontFamily->"Times",FontSize->12},
>         GridLines->Automatic,Axes->True,PlotRange->All,
>         PlotLabel->"Radial displacement (black=exact,red=FEM)",
>         Frame->True, DisplayFunction->DisplayChannel];
> 


  • Prev by Date: Re: procedures
  • Next by Date: Re: Dificulty on Integrate function!
  • Previous by thread: Re: Show problem: combining ListPlot and Plot
  • Next by thread: FindRoot and evaluations