Re: Problem with Plot and Ticks-function
- To: mathgroup at smc.vnet.net
- Subject: [mg23283] Re: [mg23274] Problem with Plot and Ticks-function
- From: Jean-Marie Thomas <jmt at agat.net>
- Date: Sun, 30 Apr 2000 21:13:34 -0400 (EDT)
- References: <200004300205.WAA16759@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
A few remarks on your code :
- You don't need to use Module if you won't use local variables. You can use
constructions like (expr;expr) or CompoundExpression ;
- The return value of the print function is Null, the output of a Print
statement is a side effect. So, in your Module, the side effects of the Print
statement won't be sent as a return value of the module ;
- In your plot function, you call theticks with no input values : you don't
give a mechanism that takes the values of the plotting range to the tick
function.
theTicks[min_, max_] :=
With[{r = Range[min, max, Pi/4], f = NumberForm[N at #, {3, 2}] &},
Transpose[{r, f /@ r}]
]
myPlot[min_, max_] :=
Plot[Sin[x], {x, min, max}, Ticks -> {theTicks[min, max], Automatic}]
On Sun, 30 Apr 2000, Hans Friedrich Steffani wrote:
> theticks[min_, max_] :=
> Module[{}, Print["xmin=", min, " xmax=", max];
> Transpose[{Range[min + \[Pi]/4, max, \[Pi]/4],
> Range[min + \[Pi]/4, max, \[Pi]/4]*180/\[Pi]}]]
>
> Plot[Sin[x], {x, 0, \[Pi]}, Ticks -> {theticks, Automatic}]
>
> Produces the output
> xmin=-0.0785398, xmax=3.22013
> instead of
> xmin=0, xmax=3.14
>
> and stupid ticks at the x-Axis.
>
> How do I get correct ticks?
>
> Hans Friedrich Steffani
>
>
>
> --
> Hans Friedrich Steffani
> Institut fuer Elektrische Maschinen und Antriebe, TU Chemnitz
> mailto:hans.steffani at e-technik.tu-chemnitz.de
> http://www.tu-chemnitz.de/~hfst/
- References:
- Problem with Plot and Ticks-function
- From: hans.steffani@e-technik.tu-chemnitz.de (Hans Friedrich Steffani)
- Problem with Plot and Ticks-function