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 12:10:36 -0500

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

> -----Original Message-----
> From: Ben Abbott [mailto:address@hidden 
> Sent: Friday, February 21, 2014 5:05 AM
> To: Byron Hawkins
> Cc: help-octave Octave
> Subject: Re: Plotting basics
>  
> 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 (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
>  
>  
> Here is the error:
>  
> Loading plot #2: data/word-create.ind.v.m
> Loading plot #3: data/word-create.ind.s0.m
> Loading plot #4: data/word-create.ind.s1.m
> error: ./generate-plot.m: subscript indices must be either positive integers 
> less than 2^31 or logicals
> error: called from:
> error:   
> /stash/experiments/train/word/create/current-merge/chart/generate-plot.m at 
> line 21, column 3
>  
> And here is the script:
>  
> 19  if length(plots) > 0,
> 20    # semilogy(index, plots); # it works with this instead of line 21
> 21    plot(index, plots); # this line fails
> 22  end;
>  
> So it looks like plot() is doing something with the parameters that doesn’t 
> work, but the error doesn’t indicate that. It just points out the call to 
> plot() itself. If line 20 is ok, shouldn’t line 21 always be ok? I’m just not 
> getting an idea what is happening.
>  
> Byron

Ok.  It appears that you have redefined "plot" as a variable. This suspicion 
can be verified by adding "which plot" before line 21 in generate-plot.m.  If 
"which" says "plot" is a variable, then look thru generate-plot.m for a line 
that begins as ...

        plot = ...

My guess is that it should be ...

        plots = ...

Ben




reply via email to

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