MathGroup Archive 2009

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

Search the Archive

Re: Adding text to RegionPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98567] Re: [mg98536] Adding text to RegionPlot
  • From: "David Park" <djmpark at comcast.net>
  • Date: Mon, 13 Apr 2009 03:32:15 -0400 (EDT)
  • References: <2081939.1239523047445.JavaMail.root@n11>

Use Epilog,

RegionPlot[y <= (1/x^2) && y >= 0, {x, 1, 3}, {y, 0, 1}, 
 PlotRange -> {{0, 3}, {0, 1.1}},
 Epilog -> {Text["mytext", {1.5, 1}]},
 AspectRatio -> Automatic]

One has to wonder why the default AspectRatio for RegionPlot is 1 and all
the examples in Help use iterators that result in a square region (except
the example in Options, AspectRatio). An AspectRatio of 1 will normally
distort the shape of the region.

With the Presentations package you don't have to use Epilog or Show and you
can just draw one thing after another without any jumping of graphics
levels.

Needs["Presentations`Master`"]

Draw2D[
 {RegionDraw[y <= (1/x^2) && y >= 0, {x, 1, 3}, {y, 0, 1}],
  RegionDraw[y <= Sqrt[x] && x <= 2, {x, 0, 3}, {y, 0, 3},
   PlotStyle -> Opacity[.3, Orange],
   MaxRecursion -> 4],
  Text["mytext", {1.5, 1}]},
 PlotRange -> {{0, 3}, {0, 1.5}},
 Frame -> True
 ]


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  


From: Jim Rockford [mailto:jim.rockford1 at gmail.com] 

I would like to add text at specific (x,y) locations for a 2D graphic
generated by RegionPlot (meaning, I'd rather not use the graphic tool
and add text by hand).  Is there a way to do this?  I get mathematica
complaints that RegionPlot is not a "type of graphics."

For example, this code fails:

RegionPlot[y <= (1/x^2) && y >= 0, {x, 1, 3}, {y, 0, 1}, PlotRange ->
{{0, 3}, {0, 1}},Graphics[Text["mytext", {1.5, 1}]]

Apparently I'm using Graphics[Text[]]  incorrectly.  How can I get
such a simple function of putting text at a specific location to work
in RegionPlot?

Thanks,
Jim




  • Prev by Date: Re: Controlling axes lengths in Plots
  • Next by Date: Re: Change in NSolve algorithm
  • Previous by thread: Re: Adding text to RegionPlot
  • Next by thread: Re: Adding text to RegionPlot