Re: Log plots: plot points *linearly* equidistant
- To: mathgroup at smc.vnet.net
- Subject: [mg31677] Re: Log plots: plot points *linearly* equidistant
- From: Tom Burton <tburton at cts.com>
- Date: Fri, 23 Nov 2001 05:47:30 -0500 (EST)
- References: <9th9f9$fml$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hello,
The following function will be handy if you want gridlines:
GridLogScale:=First/@LogScale[##]&
(LogScale returns {position, label} of each tickmark. The GridLines option takes only the first item in this list.)
Then
Plot[logstep[f][y], {y, -2, 3},
Ticks -> {LogScale, Automatic}, AxesOrigin -> {-2, 0},
PlotStyle -> Thickness[0.01],
GridLines -> {GridLogScale, Automatic}];
Tom Burton
On Wed, 21 Nov 2001 22:22:33 +0000 (UTC), in comp.soft-sys.math.mathematica David Park wrote:
>Primoz,
>
>The Log plots from Graphics`Graphics` present many difficulties in their
>use. The easiest approach to making log plots is to do it yourself. However,
>the LogScale Tick specification from Graphics`Graphics` is useful. The
>logstep function below allows relatively even spacing of the points on a log
>scale. Then you can use the regular Plot function.
>
>Needs["Graphics`Graphics`"]
>
>logstep[f_][y_] := f[10^(y)]
>
>f[x_] := UnitStep[x - 1]
>
>Plot[logstep[f][y], {y, -2, 3},
> Ticks -> {LogScale, Automatic},
> AxesOrigin -> {-2, 0}];
>
>David Park
>djmp at earthlink.net
>http://home.earthlink.net/~djmp/
>
>> From: Primoz Peterlin [mailto:primoz.peterlin at biofiz.mf.uni-lj.si]
To: mathgroup at smc.vnet.net
>>
>> Hello,
>>
>> Browsing through the archives, I have seen this question coming up
>> recurringly at least since 1995, but with no satisfactory answer...
>>
>> The problem is that LogLinearPlot and LogLogPlot functions evaluate plot
>> points at values which are *linearly* equidistant on the x-axis, not
>> logarithmically. Why this is erroneous can be seen on a simple example:
>>
>> Needs["Graphics`Graphics`"]
>> LogLinearPlot[UnitStep[x - 1], {x, 0.01, 1000}]
>>
>> As far as I know, there are two ways of avoiding this behaviour:
>>
>> a) setting PlotDivision option to higher, often prohibitively high
>> values,
>>
>> b) evaluating one's own list of {x,} pairs and using LogLinearListPlot
>> or LogLog
>> ListPlot to plot it
>>
>> The first solution is slow and inefficient, the second one is
>> cumbersome. Has nobody so far been annoyed by the LogLinearPlot
>> behaviour enough to actually rewrite it in a decent way? :)
>>
>> With kind regards,
>> Primoz
>>
>> --
>> Primo¾ Peterlin, In¹titut za biofiziko, Med. fakulteta, Univerza v
>> Ljubljani
>> Lipièeva 2, SI-1000 Ljubljana, Slovenija.
>> primoz.peterlin at biofiz.mf.uni-lj.si
>> Tel: +386-1-5437632, fax: +386-1-4315127,
>> http://sizif.mf.uni-lj.si/~peterlin/
>>
>