bugGNU Octave - Bugs: bug #53659, [octave forge] (geometry)...

 
 

bug #53659: [octave forge] (geometry) drawPoint: mixing FMT, PROPERTY-VALUE -> unexpected behaviour

Submitter:  Adrian <adaerr>
Submitted:  Sun 15 Apr 2018 12:56:29 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  juanpi
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 31 May 2018 11:17:45 PM UTC, comment #1: 

Thanks, this is now fixed in the development repository, bookmark release, commit 00e59a986baa

I went for a solution which is a mixture of both suggestions.

Juan Pablo Carbajal <juanpi>
Group Member
Sun 15 Apr 2018 12:56:29 PM UTC, original submission:  

The drawPoint command in the geometry package behaves unexpectedly
when mixing FMT and PROPERTY-VALUE specifications in its options.
Specifically, the marker color and shape may not correspond to the
values set in the options. Compare the figures produced by the
following commands:


plot(0,0,'*r') # -> red star
plot(0,0,'*r','markersize',20) # -> large red star

drawPoint(0,0,'*r') # -> red star
drawPoint(0,0,'*r','markersize',20) # -> large blue circle


The help for drawPoint specifies that its options are passed to the
plot function, so I expect the options to behave similarly.

The reason for this differing behaviour lies in the fact that
drawPoint prepends PROPERTY-VALUE pairs to the options before calling
plot (except if the latter consist in a single FMT arg):


  if length(varargin)~=1
    varargin = [{'linestyle', 'none', 'marker', 'o', 'color', 'b'}, varargin];
  end

[quoted from drawPoint.m]

Then the usual plot behaviour (pair-value properties have precedence
over FMT specifications whatever the order of the arguments) leads to
the behaviour above.

Note finally that mixing FMT and PROPERTY-VALUE options is permissible
according to the help for plot, which explicitly cites such an example.

The problem of color sticking to blue could be solved by just ommiting
the 'color' property setting from the drawPoint.m code quoted above.
As opposed to the 'linestyle' and 'marker' settings which are required
to make drawPoint indeed draw points, setting a default color can well
be left to plot.

There are several ways this could be solved for the marker:

  • modify plot so that its parser keeps the last set option *even when

 FMT and PROPERTY-VALUE pairs are mixed* ?
 

  • change the if-condition above into "if mod(length(varargin), 2) ==

  0", supposing that an uneven number of options implies the existence
  of a FMT arg.

  • document the misfeature and make it a feature ;-)


  • ...


cheers,
Adrian

Adrian <adaerr>

 

(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 juanpi (Posted a comment)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by adaerr (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-05-31 juanpi StatusNone Fixed
        Assigned toNone juanpi
        Open/ClosedOpen Closed
        Release4.2.2 dev
        Operating SystemGNU/Linux Any
    2018-04-15 mtmiller Summarygeometry: drawPoint: mixing FMT, PROPERTY-VALUE -&gt; unexpected behaviour [octave forge] (geometry) drawPoint: mixing FMT, PROPERTY-VALUE -> unexpected behaviour

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code