MathGroup Archive 2003

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

Search the Archive

Re: Trouble customizing 2D plots in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42183] Re: Trouble customizing 2D plots in Mathematica
  • From: bobhanlon at aol.com (Bob Hanlon)
  • Date: Sat, 21 Jun 2003 20:57:01 -0400 (EDT)
  • References: <bcrsbv$hrs$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Include a FrameLabel

Plot[x^2/1000,{x,0,100},Frame->True, PlotRange->{0,6},
    FrameLabel->{None,None," ",None}, 
    Epilog->Text["*\!\(10\^3\)",Scaled[{-0.05,1.04}],{-1.5,0}]];


Bob Hanlon

In article <bcrsbv$hrs$1 at smc.vnet.net>, Kevin Gross <kc144 at woh.rr.com> wrote:

<< Subject:	Trouble customizing 2D plots in Mathematica
From:		Kevin Gross <kc144 at woh.rr.com>
To: mathgroup at smc.vnet.net
Date:		Thu, 19 Jun 2003 08:30:55 +0000 (UTC)

Hi all,

While I'm a devout Mathematica user, I do like the way some other 
plotting packages handle 2D plots with large y values.  Specifically, 
some packages will factor out a common value, e.g., 10^3, from the 
y-axis labels and displays that common value above the y-axis.  Below 
is my attempt at mimicking this behavior in Mathematica:

(*Standard Mathematica plot with specific PlotRange*)
p1 = Plot[x^2, {x, 0, 100}, Frame -> True, PlotRange -> {0, 6000}];

(*Attempt at producing a nicer-looking plot*)
p2 = Show[p1, FrameTicks -> {Automatic, {{0, 0}, {2000, 2}, {4000, 4}, 
{6000, 6}, {8000, 8}, {10000, 10}}, Automatic, Automatic}, 
DisplayFunction -> Identity];
p3 = Graphics[Text["*\!\(10\^3\)", Scaled[{-0.05, 1.04}], {-1.5, 0}]];
Show[p2, p3, PlotRange -> All, DisplayFunction -> $DisplayFunction];

There are a couple of problems with my approach:

1.) The text box only becomes visible when I use PlotRange->All.  
However, in some plots, I wish to specify a PlotRange different from 
All and still have the text box visible.  For example:

(*Must use PlotRange -> All*)
Show[p2, p3, DisplayFunction -> $DisplayFunction];

2.) The coordinates and offsets I've chosen, namely Scaled[{-0.05, 
1.04}], {-1.5, 0}, need to be changed if the image size is changed.  
I'd like to be able to resize the graphic without messing up the 
alignment of the text box relative to the y-axis.  These coordinates 
and offsets are also dependent on the default text size, but this 
probably isn't too much of a problem.  For example:

(*Sensetive to resizing*)
Show[p2, p3, ImageSize -> 8*72, PlotRange -> All, DisplayFunction -> 
$DisplayFunction];

Can anyone offer a suggestion on how to accomplish my objective while 
avoiding these shortcomings?  Or has someone already invented this 
wheel?
 >><BR><BR>


  • Prev by Date: Re: Re: InverseFunction[]
  • Next by Date: Re: On capitalization
  • Previous by thread: Re: Trouble customizing 2D plots in Mathematica
  • Next by thread: MathML Question in 4.2