Re: using a log plot, can I show y=0?
- From: "Steven Lord" <slord@xxxxxxxxxxxxx>
- Date: Mon, 9 Jan 2006 08:09:34 -0500
"Rune Allnor" <allnor@xxxxxxxxxxxx> wrote in message
news:1136634989.101178.323100@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> tyler.parke@xxxxxxxxx wrote:
>> yes, haha :)
>>
>> I just want my graph to go smooooth. At points where I have y = 0, it
>> cuts off and disjoints the graph
>
> What's the joke?
>
> To include y in a log plot you need to include log(y)
> in the plottable area. So if you have a minimum y you
> want included in the plot, you will need to set the axes as
>
> axes([xmin,xmax, log(ymin) log(ymax)]);
>
> So if you want log(0) included in the plot, that means you
> will need to deal with log(0) as a numerical value.
>
> No jokes whatsoever.
>
> Rune
Or, as a workaround for the OP, you will need to 'fudge' the data to avoid
taking log(0). log(eps) is a finite number, so it will be displayed on a
log scale, and log(q+eps) is very close to log(q) for sufficiently large
values of q, so adding eps to your data should be sufficient -- and if you
require the nonzero data to be unchanged by the plotting, just add eps to
the 0 entries in what you're plotting.
x = 1:10;
y = mod(x, 2);
figure
plot(x, y)
set(gca, 'YScale', 'log')
figure
plot(x, y+eps)
set(gca, 'YScale', 'log')
--
Steve Lord
slord@xxxxxxxxxxxxx
.
- References:
- using a log plot, can I show y=0?
- From: tyler . parke
- Re: using a log plot, can I show y=0?
- From: Matt
- Re: using a log plot, can I show y=0?
- From: tyler . parke
- Re: using a log plot, can I show y=0?
- From: Rune Allnor
- using a log plot, can I show y=0?
- Prev by Date: Re: Plot with fill commands
- Next by Date: Re: Frequency divider
- Previous by thread: Re: using a log plot, can I show y=0?
- Next by thread: JPattern - numjac
- Index(es):
Relevant Pages
|