bugGNU Octave - Bugs: bug #56271, Improve documentation of plot...

 
 

bug #56271: Improve documentation of plot function style argument when it specifies only one of linestyle or marker

Submitter:  None
Submitted:  Mon 06 May 2019 01:36:19 AM UTC
   
 
Category:  Documentation Severity:  2 - Minor
Priority:  3 - Low Item Group:  Documentation
Status:  Confirmed Assigned to:  None
Originator Name:  pinknoise2077 Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 13 May 2019 12:05:30 AM UTC, comment #9: 

Sounds good.

Martin Gaudreault <pinknoise2077>
Sun 12 May 2019 11:26:52 PM UTC, comment #8: 

It's been a stated goal of the project that Octave should be able to run a user's existing Matlab code and deliver the same expected results. So the behavior is correct and Octave will continue to interpret the format options as they are now.

I believe that in this particular case, if the optional arguments to the plot function can appear inconsistent to a user, then that may be a failure of the documentation. I believe that we can improve the documentation if necessary to help explain the format options more clearly.

Mike Miller <mtmiller>
Group Member
Sun 12 May 2019 07:34:13 PM UTC, comment #7: 

I guess it poses a good question for the Octave project. Is the priority to be consistent, or the priority should be to be a clone of MATLAB? I believe that it is not because the MATLAB plot function options are inconsistent that its Octave counterpart should also be. Of course, this is my personal take on it.

Martin Gaudreault <pinknoise2077>
Thu 09 May 2019 07:38:14 PM UTC, comment #6: 

So after looking at this again, one confusing aspect of the shortcut format argument is that the default line style is used if you only specify the color, but isn't used if you specify marker style. So that is a particular case, but it is clearly mentioned in the docs.

In the Octave manual

> When a marker is specified, but no linestyle, only the markers are plotted.


And in the Matlab online manual

> For example, if you omit the line style and specify the marker, then the plot shows only the marker and no line.

Mike Miller <mtmiller>
Group Member
Tue 07 May 2019 06:54:38 PM UTC, comment #5: 

Confirmed. So Octave's current behavior agrees with Matlab. Apologies to the reporter, but the current inconsistent behavior is the correct one, so we have to keep it.

If it helps, we could improve the documentation of the plot function to help explain this apparent difference. Do you have any suggestions?

One way of looking at it is that the shortcut "LineSpec" option must contain all three of line style, marker style, and color. If you only specify "k+" instead of "k+-", you are intentionally declaring that the line style is none, not that the line style should be the default. There is no way to use the shortcut syntax and say "use the default line style".

Mike Miller <mtmiller>
Group Member
Mon 06 May 2019 07:42:11 PM UTC, comment #4: 

For reference, Matlab behavior for situation #1:


x = 1:5;
y = 1:5;
plot (x, y, 'k+')


This draws black markers with NO connecting line between them.  This behavior is the same as Octave.

For situation #2:


x = 1:5;
y = 1:5;
plot (x, y, 'marker', '+', 'color', 'k')


This draws black markers WITH a connecting line between them.  This behavior is the same as Octave.

I'm marking as Works for Me since Octave and Matlab produce identical results.  This was with R2019A.


Rik <rik5>
Group administrator
Mon 06 May 2019 02:34:59 AM UTC, comment #3: 

I would have to validate at work what MATLAB does. In any case, it should be consistent. The correct behavior I am expecting would be one of those two options:

1) [This is my preference by far as I believe it is more intuitive]
plot(x, y, 'Marker', '+', 'Color', 'k') shouldn't draw the line between the points because it should assume that if I specify a marker, it means linestyle = none by default.

2)
plot(x, y, 'k+') should have the same behavior as plot (x, y, 'Marker', '+', 'Color', 'k'), which is to draw the line between the plot points because the 'linestyle' argument wasn't mentioned.



Anonymous
Mon 06 May 2019 02:27:02 AM UTC, comment #2: 

Yes, the equivalent plot commands in Octave are


plot (x, y, 'k+')


and


plot (x, y, 'marker', '+', 'color', 'k', 'linestyle', 'none')


The default in Matlab for the 'LineStyle' property is '-', meaning a solid line. Does Matlab implicitly change the value of 'LineStyle' to 'none' when the command


plot (x, y, 'Marker', '+', 'Color', 'k')


is used? Is it because 'Marker' is specified without 'LineStyle' that the default is changed?

Mike Miller <mtmiller>
Group Member
Mon 06 May 2019 01:45:38 AM UTC, comment #1: 

I made a mistake... I was talking about the plot function, and not the scatter function.

Please correct to:

The plot function formatting options do not work as intended.

Steps to reproduce, assuming any data set of same size:

plot (x,y, 'marker', '+', 'color', 'k');

doesn't produce the same result as this function is used

plot (x,y, 'k+');

I believe those should be the same.

In MATLAB, plot format options are a lot more user friendly.

Anonymous
Mon 06 May 2019 01:36:19 AM UTC, original submission:  

The scatter function formatting options do not work as intended.

Steps to reproduce, assuming any data set of same size:

scatter(x,y, 'marker', '+', 'color', 'k');

doesn't produce the same result as this function is used

scatter(x,y, 'k+');

I believe those should be the same.

In MATLAB, scatter plot format options are a lot more user friendly.

Anonymous

 

(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 pinknoise2077 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-01-31 mtmiller Severity3 - Normal 2 - Minor
        Priority5 - Normal 3 - Low
        Release5.1.0 dev
    2019-05-18 rik5 Carbon-CopyRemoved 72865 -
    2019-05-18 rik5 CategoryPlotting Documentation
        Item GroupMatlab Compatibility Documentation
        StatusWorks For Me Confirmed
        Operating SystemMicrosoft Windows Any
        Summaryplot function default &quot;linestyle&quot; option when &quot;marker&quot; is specified Improve documentation of plot function style argument when it specifies only one of linestyle or marker
    2019-05-06 rik5 StatusNeed Info Works For Me
    2019-05-06 mtmiller Item GroupIncorrect Result Matlab Compatibility
        StatusNone Need Info
        Summaryscatter function format options produces incorrect plot plot function default "linestyle" option when "marker" is specified

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code