Re: using a log plot, can I show y=0?




"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


.



Relevant Pages

  • Re: Need urgent help
    ... > to me is very high and I'm not able to plot that manu pixels on screen. ... which means plotting 300 pixels in a second. ... > desired because then the plotting of line graph is degraded. ...
    (microsoft.public.vb.winapi.graphics)
  • Re: Need urgent help
    ... > I have a hardware connected to my Comm Port. ... > to me is very high and I'm not able to plot that manu pixels on screen. ... which means plotting 300 pixels in a second. ... > desired because then the plotting of line graph is degraded. ...
    (microsoft.public.vb.winapi.graphics)
  • Ploting a matrix
    ... I have a problem in plotting the elements of or ... matrix in a graph every 60 seconds. ... Does anyone know how to plot this. ... I'll be looking forward to your replies. ...
    (comp.soft-sys.matlab)
  • resizing automatically
    ... to that I am plotting one graph. ... now I want to add a 2 static test below this plot. ...
    (comp.soft-sys.matlab)
  • Re: [opensuse] Lies, damned lies and statistics
    ... Recently we have done a poll around the office. ... line with bash/sed/awk and then produce graphs from that, then spline, graph ... GNU 'plot' is then called to display a graph on the screen: ...
    (SuSE)