MathGroup Archive 2009

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

Search the Archive

Re: How to make large graphics object fit within a plot?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105470] Re: How to make large graphics object fit within a plot?
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Fri, 4 Dec 2009 04:31:47 -0500 (EST)
  • References: <hf86rt$1a3$1@smc.vnet.net>

Nasser M. Abbasi schrieb:
> I am trying to add a disk at some location on top of an existing plot.  So I 
> use Epilog to add the disk.
> 
> But it seems if the disk is larger than the plot image size, it gets chopped 
> off.  I wanted the whole disk to show.
> 
> I tried increasing ImagePadding for the plot, and also ImageMargins, but 
> this did not help.
> 
> Here is what I tried
> 
> Plot[Sin[x], {x, 0, 10}, AspectRatio -> Automatic,
>   Epilog -> {Disk[{5, 0}, 2]}]
> 
> Show[Plot[Sin[x], {x, 0, 10}, AspectRatio -> Automatic],
>   Graphics[Disk[{5, 0}, 2]]]
> 
> Show[Plot[Sin[x], {x, 0, 10}, AspectRatio -> Automatic, PlotRange -> 
> Automatic],
>   Graphics[Disk[{5, 0}, 2]]]
> 
> None of the above works. But the below WORKS:
> 
> Show[Plot[Sin[x], {x, 0, 10}, AspectRatio -> Automatic, PlotRange -> 
> {Automatic,{-3,3}}],
>   Graphics[Disk[{5, 0}, 2]]]
> 
> So, I had to explicitly make the plot y-axis large enough to accommodate the 
> disk to make it 'fit'
> 
> I wanted to do this automatically. I am sure there is a way. I just thought 
> of something, may be I need to look at
> Inset[] may be there is something there? which I'll do that next.
> 
> --Nasser 
> 
> 
What's wrong with:

Show[
 Plot[Sin[x], {x, 0, 10}, AspectRatio -> Automatic],
 Graphics[Disk[{5, 0}, 2]],
 PlotRange -> Automatic
]

note that the first Plot does not know it will be combined with another
graphics, so changing its plot range to Automatic you can't expect that
it will consider the disk of the other graphics. Show on the other hand
knows about all the Graphics it is combining. I think Show will
understand (almost?) all options of Graphics...

hth,

albert


  • Prev by Date: Mathematica links
  • Next by Date: Re: Re: piecewice pdf, problems with cdf
  • Previous by thread: Re: How to make large graphics object fit within a plot?
  • Next by thread: Re: How to make large graphics object fit within a plot?