MathGroup Archive 2006

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

Search the Archive

Re: Scale ContourPlot axes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67404] Re: [mg67393] Scale ContourPlot axes
  • From: "Carl K. Woll" <carlw at wolfram.com>
  • Date: Thu, 22 Jun 2006 06:21:21 -0400 (EDT)
  • References: <200606210613.CAA08944@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Nick wrote:
> Hi there,
> 
> I have a ContourPlot with axes of parameters "a" and "b" and contours
> of a function "f". Obviously the parameters, "a" and "b" are varied
> within defined boundary conditions to calculate "f".
> 
> My question: Is it possible to convert the axes to a log scale (within
> ConoutPlot) while maintaining the normal values of these parameters,
> ie. scale the linear axes to a log scale without converting to log
> units?
> 
> I haven't been able to find a way of acheiving this and would really
> appreciate any ideas out there.
> 
> Nick

You need to do the scaling by hand, using FrameTicks. Here is a simple 
example:

f[x_,y_]:=x^2+Log[y]^2

Let's plot this over the range -3<x<3 and Exp[-3]<y<Exp[3] so that we 
get a nice circle.

xmin=-3;
xmax=3;
ymin=Exp[-3];
ymax=Exp[3];

Now, we want to use ContourPlot with Log scaling. So

ContourPlot[f[x, 10^z],{x,xmin,xmax},{z,Log[10,ymin],Log[10,ymax]}]

will produce the desired plot, but with ticks labeled using the log 
scale. We fix the ticks by using FrameTicks. Here is a function that 
produces a table of {linear,log} values:

tickfunction[min_,max_]:=
Flatten[
   N@Table[
     {e+Log[10,d],d 10^e},
     {e,Floor[Log[10,min]],Ceiling[Log[10,max]]},
     {d,1,5,4}
   ],
   1
]

So, the following produces the desired plot:

ContourPlot[f[x,10^z],{x,xmin,xmax},{z,Log[10,ymin],Log[10,ymax]},
    FrameTicks->{Automatic,tickfunction[ymin,ymax]}]

Carl Woll
Wolfram Research


  • Prev by Date: Re: Uniform arc length basis curve fitting
  • Next by Date: Re: Re: Package writing
  • Previous by thread: Scale ContourPlot axes
  • Next by thread: Re: Scale ContourPlot axes