bugGNU Octave - Bugs: bug #60588, Vector/scalar combination in...

 
 

bug #60588: Vector/scalar combination in plotting not well documented

Submitted by:  Michael Leitner <mleitner>
Submitted on:  Wed 12 May 2021 06:25:01 AM UTC  
 
Category:  Documentation Severity:  3 - Normal
Priority:  3 - Low Item Group:  Documentation
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 12 May 2021 03:38:52 PM UTC, comment #1: 

I think this can be documented more clearly, but the behavior should probably stay Matlab-compatible.

For the sample code, Matlab produces 10 line objects.  The "LineStyle" property is '-' and the "Marker" property is 'none'.

Octave does nearly the same thing.  It creates 10 line objects with "LineStyle" = '-'.  However, the "Marker" property is '.' which thus at least displays the points.

Interestingly, I'm pretty sure this is a change in behavior for Matlab.  I remember that Octave had to introduce a special case for one point like this

plot (0.5, 0.5)

so that the "Marker" property would be '.' rather than the default of "none".  That it still the case.  This code

h = plot ([0 1], [0 1])
get (h, 'marker')

is not special-cased because it has more than one point and the "Marker" is "none".

Rik <rik5>
Project Administrator
Wed 12 May 2021 06:25:01 AM UTC, original submission:  

Plotting

x=(1:10)';
y=1;
plot(x,y)

gives ten points of different colour. I would have expected the y to be singleton-expanded and thus a single line to be plotted. The point is that if x is a very large vector, the execution takes unexpectedly long, while a single line would have been drawn much quicker. I see that the Matlab documentation says that in the present case discrete points are plotted, but they say nothing about whether they should have the same style or not (which probably would also complete faster than the present case). As I see it, the octave documentation does not treat the present case at all.

So this is at least a documentation bug. Perhaps it is also a Matlab incompatibility, if Matlab should have the same style on all points. What I do not get is their point that to see the points a marker symbol has to be specified -- if no symbol is specified, does the plot stay empty? Because in fact that is what happens if in octave I execute plot(x,y,'-'), presumably because it plots ten lines consisting only of a single point. Thus, for the simplest conceivable plot you can request, just a single horizontal line, you have to do something like

plot([0 1],[1 1])

while the more obvious and simple

plot([0 1],1)

does not work, not even with an '-'. That's why I would argue here even for a voluntary Matlab incompatibility.

Michael Leitner <mleitner>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mleitner (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-05-12 rik5 CategoryPlotting => Documentation
        Priority5 - Normal => 3 - Low
        Release6.1.0 => dev
        SummaryVector/scalar combination in plotting => Vector/scalar combination in plotting not well documented

    Back to the top


    Powered by Savane 3.6