help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plotting basics


From: Ben Abbott
Subject: Re: Plotting basics
Date: Fri, 21 Feb 2014 08:05:05 -0500

On Feb 21, 2014, at 5:21 AM, Byron Hawkins <address@hidden> wrote:

> -----Original Message-----
> From: Ben Abbott [mailto:address@hidden 
> Sent: Friday, February 21, 2014 1:44 AM
> To: Byron Hawkins
> Cc: help-octave Octave
> Subject: Re: Plotting basics
> 
>> On Feb 21, 2014, at 4:00 AM, Byron Hawkins <address@hidden>
>> wrote:
>> 
>>> Thanks for your reply. I don't understand about zeros in a logarithmic
>> plot.
>>> What I need is very utilitarian, if mathematically nonsensical. The 
>>> values are large, so the axis needs to be logarithmic, but some of the 
>>> values are zero, and they should go down at the bottom just below one. 
>>> It doesn't matter that the logarithmic range doesn't include that 
>>> value, I just need to have the zeros drawn in that place which appears 
>>> visually a bit below one, just like the value one appears visually a 
>>> bit below two, etc. What is the convention for this? Should I change the
>> values to 0.01 or something?
>>> 
>>> My indices are just plain integers from 1 to 30. They work fine in the
>>> semilogy() function , but plot() won't accept them. Is it possible 
>>> that
>>> plot() doesn't allow floating point values? But then why does 
>>> semilogy() allow them?
>> 
>> I think you're misunderstanding what is happening.
>> 
>> The logarithm of "one" is equal to zero.  The logarithm of "zero" is equal
>> to -infinity ... which is an infinite distance from "just below one".
>> 
>> Also neither plot() or semilog() are indexed.  The index errors are related
>> to your variables.
>> 
>> Both plot() and semilogy() are designed to work with floating point values.
>> But only positive integers may be used to index an array.
>> 
>> If you'll provide the m-file code that is producing the errors, we'll be
>> able to examine it and figure out what is wrong.
>> 
>> Ben
> 
> I certainly agree with your point that placing zero on a logarithmic scale
> is not a meaningful thing to do. What I'm really hoping for is an ordinary
> linear axis with a "logarithm-like effect" applied to it, so that it scales
> in the convenient way that a logarithmic axis does, but isn't functionally
> logarithmic. Is there any convention for such a thing, or would readers just
> think it is a broken logarithmic axis? 
> 
> My .m file is wrapped up in some scripts, it's kind of tricky to pull it
> out. Maybe you can explain the arguments of semilogy() and plot(). I have an
> "index.m" file containing the X values, which for most of my plots is just a
> sequence. Then I have several files, each containing one set of
> corresponding Y values. So I load up the Y values like this:
> 
> args = argv();
> plots = [];
> for i = 3:length(args),
>  plot = dlmread(args{i});
>  plots = [plots;plot];
> end;
> 
> Then load the X values:
> 
> index = dlmread(args{2});
> 
> And finally plot:
> 
> if length(plots) > 0,
>  semilogy(index, plots);
> end;
> 
> When I use semilogy(), it works just like I would hope, but when I use
> plot() it fails with the error. The Y values are really ordinary, just
> positive (or zero) floating point numbers. Am I passing arguments the wrong
> way? Thanks again for your help, much appreciated.

Ok.  A quick point of etiquette.  Please "reply-all" when exchanging emails on 
a mail-list. That way others who arrive later and read the archived messages 
(from address@hidden) can benefit.  Also since others will arrive later and try 
to catch up, please bottom post (instead of top posting as you have done thus 
far).

        http://en.wikipedia.org/wiki/Posting_style#Bottom-posting 

Back to your problem, Please tell us exactly what the error is ... including 
the file name and line number at fault.  Then open the file and locate the line 
number which is producing the error.  Copy-n-paste the line causing the error 
into your next reply ... as a wild guess, are you doing something like plot 
(index, plots(index))?

Ben







reply via email to

[Prev in Thread] Current Thread [Next in Thread]