Services & Resources / Wolfram Forums / MathGroup Archive
-----

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: [mg105263] Re: How to make large graphics object fit within a plot?
  • From: "M.Roellig" <markus.roellig at googlemail.com>
  • Date: Wed, 25 Nov 2009 22:59:41 -0500 (EST)
  • References: <hej3p8$d70$1@smc.vnet.net>

On 25 Nov., 12:18, "Nasser M. Abbasi" <n... at 12000.org> wrote:
> 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

Hi,

you can use:

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

or as a workaround:

Show[{Graphics[Disk[{5, 0}, 2]], Plot[Sin[x], {x, 0, 10}],
  Graphics[Disk[{5, 0}, 2]]}, Axes -> True]

Show takes the PlotRange from the first object in the list.
I suppose you want the disk to be printed on top of the
plot so I had to add the disk a second time to overplot the
sine.

Cheers,

Markus


  • Prev by Date: Re: Re: Bug associated with Graphics3D???
  • Next by Date: Re: Re: newbie q-n about FinancialData
  • 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?