octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53659] geometry: drawPoint: mixing FMT, PROPE


From: Adrian
Subject: [Octave-bug-tracker] [bug #53659] geometry: drawPoint: mixing FMT, PROPERTY-VALUE -> unexpected behaviour
Date: Sun, 15 Apr 2018 08:56:30 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

URL:
  <http://savannah.gnu.org/bugs/?53659>

                 Summary: geometry: drawPoint: mixing FMT, PROPERTY-VALUE ->
unexpected behaviour
                 Project: GNU Octave
            Submitted by: adaerr
            Submitted on: Sun 15 Apr 2018 12:56:29 PM UTC
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.2
        Operating System: GNU/Linux

    _______________________________________________________

Details:

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





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53659>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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