bugGNU Octave - Bugs: bug #59534, Long form color like...

 
 

bug #59534: Long form color like "black" not accepted in LineSpec for functions like plot

Submitter:  Hartmut <hardy>
Submitted:  Tue 24 Nov 2020 05:24:10 PM UTC
   
 
Category:  Plotting Severity:  1 - Wish
Priority:  3 - Low Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
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 30 Nov 2020 12:00:05 AM UTC, comment #6: 

I'm going to close this as fixed.  It worked for some simple examples I tried, and someone can always make a new report if something is wrong.

Rik <rik5>
Group administrator
Fri 27 Nov 2020 04:07:51 PM UTC, comment #5: 

If a programmer has gone to the trouble of writing a function, even an internal one, it makes sense to document it.  I added the extra calling forms in this changeset: http://hg.savannah.gnu.org/hgweb/octave/rev/2fa4d47eb6f7.

Rik <rik5>
Group administrator
Fri 27 Nov 2020 08:55:09 AM UTC, comment #4: 

Thanks for this fast improvement, Rik!
Unfortunatelly I am currently not able to (easily) test the new functionality  (because the "backported" file "pltopt.m" does not work in my "old" Octave 5.2).
But I have noticed that the doc string at the top of the file "pltopt.m" not yet lists those new color options. I am unsure if it would be useful to add them there as well, since this is only an internal function.

Hartmut <hardy>
Fri 27 Nov 2020 02:29:09 AM UTC, comment #3: 

It turns out this wasn't that hard to add.  I checked in a changeset which improves the performance of _pltopt_ as well as adding support for long form names.  See http://hg.savannah.gnu.org/hgweb/octave/rev/c661350ee8df.  Note, that only full long form names such as "black" or "yellow" are detected.  Truncated color specifications such as "yell" will result in an error.  I don't consider that a big issue, although it is a difference from Matlab which can take "blasq" and parse it into "black" and "square".  Marking as Ready for Test.

Rik <rik5>
Group administrator
Thu 26 Nov 2020 03:33:50 PM UTC, comment #2: 

It seems like kind of a nice feature.  Just to note, Matlab has not behaved this way in the past and they don't document that the feature exists.  See https://www.mathworks.com/help/matlab/ref/plot.html.

There are two parts to supporting this in Octave

1) Having "color" properties support long-form arguments
2) Having LineSpec parsed correctly.

Part 1 already exists in Octave.  For example, this code works:


h = plot (1:10, 'o-k')
set (h, 'MarkerEdgeColor', 'green')


The second part should be possible because there is a single routine for decoding LineSpec.

Rik <rik5>
Group administrator
Tue 24 Nov 2020 07:03:24 PM UTC, comment #1: 

Marking this as a feature request.  The "matlab compatibility" tag has a narrow meaning here.  It's reserved for things that work in work in reasonable but different ways in both Octave and Matlab.  Since this is something that doesn't yet work, I consider it a request for a new feature.

John W. Eaton <jwe>
Group administrator
Tue 24 Nov 2020 05:24:10 PM UTC, original submission:  

I have just seen, that in Matlab the following format argument works as expected:


plot (1:10, 2:11, '.-black');


This gives a proper plot with a black line in Matlab (tested with Rr2019b). But it gives an error message in Octave (version 5.2.0).

I assume that other "color names" will also work in Matlab. I could try to generate a list of them, if needed.

I do know many workarounds for this, e.g. '.-k' would work fine in Octave. But nevertheless this makes Matlab m-files throw an error when using them in Octave (as I did).

This syntax also looks 'nice' (read: human readable) to me. So maybe we should add it to Octave as well?

Hartmut <hardy>

 

(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 (Updated the item)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by hardy (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-11-30 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-11-27 rik5 StatusConfirmed Ready For Test
    2020-11-26 rik5 Summarycolor format arguments like &quot;black&quot; do not work in plots Long form color like "black" not accepted in LineSpec for functions like plot
    2020-11-25 rik5 StatusNone Confirmed
        Release5.2.0 dev
    2020-11-24 jwe Severity3 - Normal 1 - Wish
        Priority5 - Normal 3 - Low
        Item GroupMatlab Compatibility Feature Request

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code