scatter - markersize

View: New views
7 Messages — Rating Filter:   Alert me  

scatter - markersize

by Christoph Keller :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

in my opinion, scatter(X,Y,S) places the scatter-marks constant in size, even if a "weigth"-vector S is given as an argument of scatter.

In __scatter__.m I found:

  h = patch("faces", [1:length(x)].', "vertices", [x, y, z], "facecolor",
              "none", "edgecolor", "flat", "cdata", c, "marker", marker,
              "markersize", s, "linestyle", "none");

where 's' is a scalar rather than a vector. Is this by design or by accident?

thank you for your comments, sincerely
Christoph Keller
(octave 3.0.0, Windows XP)

Re: scatter - markersize

by David Bateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christoph Keller wrote:

> in my opinion, scatter(X,Y,S) places the scatter-marks constant in size, even
> if a "weigth"-vector S is given as an argument of scatter.
>
> In __scatter__.m I found:
>
>   h = patch("faces", [1:length(x)].', "vertices", [x, y, z], "facecolor",
>      "none", "edgecolor", "flat", "cdata", c, "marker", marker,
>      "markersize", s, "linestyle", "none");
>
> where 's' is a scalar rather than a vector. Is this by design or by
> accident?
>
> thank you for your comments, sincerely
> Christoph Keller
> (octave 3.0.0, Windows XP)
>  

The calculation of "s" in __scatter__.m is

<quote>
  if (istart < nargin && firstnonnumeric > istart)
    s = varargin{istart};
    if (isempty (s))
      s = 8;
    endif
  else
    s = 8;
  endif
  ## Note markersize is in points^2 for 2D and points for 3D, and
  ## the below is an approximation, that is empircally visually correct.
  if (nd == 2)
    s = sqrt (s) / 2;
  else
    s = s / 4;
  endif
</quote>

Therefore if you pass a value for s as a vector, it is passed to patch
as a vector.. The code

 n = 100; x = randn(n,1); y = randn(n,1); c = sqrt(x.^2 + y.^2);
scatter(x, y, 1:100, c)

works fine for me under Octave 3.0.0 and gnuplot 4.2.3 that I'm using..
However, it appears to be broken under 3.1.x

D.

--
David Bateman                                David.Bateman@...
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax)

The information contained in this communication has been classified as:

[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary

_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www.cae.wisc.edu/mailman/listinfo/bug-octave

Re: scatter - markersize

by Christoph Keller :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Therefore if you pass a value for s as a vector, it is passed to patch
> as a vector.. The code
>
> n = 100; x = randn(n,1); y = randn(n,1); c = sqrt(x.^2 + y.^2);
> scatter(x, y, 1:100, c)
>
> works fine for me under Octave 3.0.0 and gnuplot 4.2.3 that I'm using..
> However, it appears to be broken under 3.1.x

I agree that the vector is passed to patch(), but this very patch returns
with the error:

<quote>
error: [java] org.octave.graphics.PropertyException: invalid property
value - [
(1 by 100) array of double ]
error: evaluating for command near line 32, column 11
error: evaluating if command near line 31, column 9
error: evaluating for command near line 29, column 7
error: evaluating if command near line 24, column 5
</quote>

Is this a Windows issue?
Christoph Keller
(octave 3.0.0, Windows XP)


----- Original Message -----
From: "David Bateman" <David.Bateman@...>
To: "Christoph Keller" <chkeller@...>
Cc: <bug-octave@...>
Sent: Wednesday, March 19, 2008 4:59 PM
Subject: Re: scatter - markersize


> Christoph Keller wrote:
>> in my opinion, scatter(X,Y,S) places the scatter-marks constant in size,
>> even
>> if a "weigth"-vector S is given as an argument of scatter.
>>
>> In __scatter__.m I found:
>>
>>   h = patch("faces", [1:length(x)].', "vertices", [x, y, z], "facecolor",
>>       "none", "edgecolor", "flat", "cdata", c, "marker", marker,
>>       "markersize", s, "linestyle", "none");
>>
>> where 's' is a scalar rather than a vector. Is this by design or by
>> accident?
>>
>> thank you for your comments, sincerely
>> Christoph Keller
>> (octave 3.0.0, Windows XP)
>>
>
> The calculation of "s" in __scatter__.m is
>
> <quote>
>  if (istart < nargin && firstnonnumeric > istart)
>    s = varargin{istart};
>    if (isempty (s))
>      s = 8;
>    endif
>  else
>    s = 8;
>  endif
>  ## Note markersize is in points^2 for 2D and points for 3D, and
>  ## the below is an approximation, that is empircally visually correct.
>  if (nd == 2)
>    s = sqrt (s) / 2;
>  else
>    s = s / 4;
>  endif
> </quote>
>
> Therefore if you pass a value for s as a vector, it is passed to patch
> as a vector.. The code
>
> n = 100; x = randn(n,1); y = randn(n,1); c = sqrt(x.^2 + y.^2);
> scatter(x, y, 1:100, c)
>
> works fine for me under Octave 3.0.0 and gnuplot 4.2.3 that I'm using..
> However, it appears to be broken under 3.1.x
>
> D.
>
> --
> David Bateman                                David.Bateman@...
> Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph)
> Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob)
> 91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax)
>
> The information contained in this communication has been classified as:
>
> [x] General Business Information
> [ ] Motorola Internal Use Only
> [ ] Motorola Confidential Proprietary
>
>

_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www.cae.wisc.edu/mailman/listinfo/bug-octave

[CHANGESET]: Re: scatter - markersize

by David Bateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

David Bateman wrote:

> Christoph Keller wrote:
>  
>> in my opinion, scatter(X,Y,S) places the scatter-marks constant in size, even
>> if a "weigth"-vector S is given as an argument of scatter.
>>
>> In __scatter__.m I found:
>>
>>   h = patch("faces", [1:length(x)].', "vertices", [x, y, z], "facecolor",
>>      "none", "edgecolor", "flat", "cdata", c, "marker", marker,
>>      "markersize", s, "linestyle", "none");
>>
>> where 's' is a scalar rather than a vector. Is this by design or by
>> accident?
>>
>> thank you for your comments, sincerely
>> Christoph Keller
>> (octave 3.0.0, Windows XP)
>>  
>>    
>
> The calculation of "s" in __scatter__.m is
>
> <quote>
>   if (istart < nargin && firstnonnumeric > istart)
>     s = varargin{istart};
>     if (isempty (s))
>       s = 8;
>     endif
>   else
>     s = 8;
>   endif
>   ## Note markersize is in points^2 for 2D and points for 3D, and
>   ## the below is an approximation, that is empircally visually correct.
>   if (nd == 2)
>     s = sqrt (s) / 2;
>   else
>     s = s / 4;
>   endif
> </quote>
>
> Therefore if you pass a value for s as a vector, it is passed to patch
> as a vector.. The code
>
>  n = 100; x = randn(n,1); y = randn(n,1); c = sqrt(x.^2 + y.^2);
> scatter(x, y, 1:100, c)
>
> works fine for me under Octave 3.0.0 and gnuplot 4.2.3 that I'm using..
> However, it appears to be broken under 3.1.x
>
> D.
>
>  
Here is a changeset that gets the markersize for scatter plots working
again in 3.1.x. However.

n = 100; x = randn(n,1); y = randn(n,1); c = sqrt(x.^2 + y.^2);
scatter(x, y, 1:100, c)

won't work in 3.1.x though it works in 3.0.0... The reason is that the
patch objects now require that the markersize is a scalar value. This is
compatible with the behavior of the Matlab patch objects. However,
matlab allows vector markersizes to scatter plots, and does this by
using an hggroup to form a "scattergroup" which is a group of N patch
objects each with different marker sizes.

I see two ways of fixing this issue

1) The right way would be to implement a scattergroup and keep the
markersize as a scalar value in the patch objects. This seems to me to
be a significant amount of work and I don't want to do something like
that if Shai or Michael are working in the background on the graphics.

2) The hack would be to allow patch markersize to be a matrix and so
keep the same behavior as Octave 3.0.0, and a visually similar behavior
to matlab, but with a handle that is incompatible. I'd be happy enough
to propose a patch for this if people want this to be done, but its not
the right thing to do..

D.

--
David Bateman                                David.Bateman@...
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax)

The information contained in this communication has been classified as:

[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary


# HG changeset patch
# User David Bateman <dbateman@...>
# Date 1205944201 -3600
# Node ID 104f381e3339a33b2cd7c1aae4dfa3a9e4168215
# Parent  a4eafb155ab95f5600ef183368d6fc04aa8b6fef
fix for scatter markersize

diff --git a/scripts/ChangeLog b/scripts/ChangeLog
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,11 @@ 2008-03-18  Ben Abbott <bpabbott@...
+2008-03-19  David Bateman  <dbateman@...>
+
+ * plot/__scatter__.m: Modify for change of markersize in
+ __go_draw_axes__.m and for compatibility.
+ * plot/__go_draw_axes__.m: Don't divide the marker size by 6
+ twice.
+ * plot/scatter3.m: Doc fix.
+
 2008-03-18  Ben Abbott <bpabbott@...>
 
  * specfun/beta.m: Fix for negative inputs.
diff --git a/scripts/plot/__go_draw_axes__.m b/scripts/plot/__go_draw_axes__.m
--- a/scripts/plot/__go_draw_axes__.m
+++ b/scripts/plot/__go_draw_axes__.m
@@ -747,9 +747,9 @@ function __go_draw_axes__ (h, plot_strea
 
      if (isfield (obj, "markersize"))
        if (length (mdat) == nc)
- m = mdat(i) / 6;
+ m = mdat(i);
        else
- m = mdat / 6;
+ m = mdat;
        endif
        if (! strcmpi (style, "lines"))
  if (have_newer_gnuplot)
diff --git a/scripts/plot/__scatter__.m b/scripts/plot/__scatter__.m
--- a/scripts/plot/__scatter__.m
+++ b/scripts/plot/__scatter__.m
@@ -52,17 +52,10 @@ function h = __scatter__ (varargin)
   if (istart < nargin && firstnonnumeric > istart)
     s = varargin{istart};
     if (isempty (s))
-      s = 8;
+      s = 6;
     endif
   else
-    s = 8;
-  endif
-  ## Note markersize is in points^2 for 2D and points for 3D, and
-  ## the below is an approximation, that is empircally visually correct.
-  if (nd == 2)
-    s = sqrt (s) / 2;
-  else
-    s = s / 4;
+    s = 6;
   endif
 
   if (istart < nargin && firstnonnumeric > istart + 1)
diff --git a/scripts/plot/scatter3.m b/scripts/plot/scatter3.m
--- a/scripts/plot/scatter3.m
+++ b/scripts/plot/scatter3.m
@@ -17,7 +17,7 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {} scatter3 (@var{x}, @var{y}, @var{s}, @var{c})
+## @deftypefn {Function File} {} scatter3 (@var{x}, @var{y}, @var{z}, @var{s}, @var{c})
 ## @deftypefnx {Function File} {} scatter3 (@dots{}, 'filled')
 ## @deftypefnx {Function File} {} scatter3 (@dots{}, @var{style})
 ## @deftypefnx {Function File} {} scatter3 (@dots{}, @var{prop}, @var{val})

_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www.cae.wisc.edu/mailman/listinfo/bug-octave

Re: scatter - markersize

by David Bateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christoph Keller wrote:

>> Therefore if you pass a value for s as a vector, it is passed to patch
>> as a vector.. The code
>>
>> n = 100; x = randn(n,1); y = randn(n,1); c = sqrt(x.^2 + y.^2);
>> scatter(x, y, 1:100, c)
>>
>> works fine for me under Octave 3.0.0 and gnuplot 4.2.3 that I'm using..
>> However, it appears to be broken under 3.1.x
>
> I agree that the vector is passed to patch(), but this very patch
> returns with the error:
>
> <quote>
> error: [java] org.octave.graphics.PropertyException: invalid property
> value - [
> (1 by 100) array of double ]
> error: evaluating for command near line 32, column 11
> error: evaluating if command near line 31, column 9
> error: evaluating for command near line 29, column 7
> error: evaluating if command near line 24, column 5
> </quote>
>
> Is this a Windows issue?
> Christoph Keller
> (octave 3.0.0, Windows XP)
Try using the gnuplot backend, it works fine for this case.. JHandles
which you are using correctly enforces that the patch objects must have
a scalar markersize, but there is no scattergroup implemented in
JHandles.. I suspect this will be fixed sometime during the development
of Octave 3.1.x

Regards
David


--
David Bateman                                David.Bateman@...
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax)

The information contained in this communication has been classified as:

[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary

_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www.cae.wisc.edu/mailman/listinfo/bug-octave

[CHANGESET]: Re: scatter - markersize

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 19-Mar-2008, David Bateman wrote:

| David Bateman wrote:
| > Christoph Keller wrote:
| >  
| >> in my opinion, scatter(X,Y,S) places the scatter-marks constant in size, even
| >> if a "weigth"-vector S is given as an argument of scatter.
| >>
| >> In __scatter__.m I found:
| >>
| >>   h = patch("faces", [1:length(x)].', "vertices", [x, y, z], "facecolor",
| >>      "none", "edgecolor", "flat", "cdata", c, "marker", marker,
| >>      "markersize", s, "linestyle", "none");
| >>
| >> where 's' is a scalar rather than a vector. Is this by design or by
| >> accident?
| >>
| >> thank you for your comments, sincerely
| >> Christoph Keller
| >> (octave 3.0.0, Windows XP)
| >>  
| >>    
| >
| > The calculation of "s" in __scatter__.m is
| >
| > <quote>
| >   if (istart < nargin && firstnonnumeric > istart)
| >     s = varargin{istart};
| >     if (isempty (s))
| >       s = 8;
| >     endif
| >   else
| >     s = 8;
| >   endif
| >   ## Note markersize is in points^2 for 2D and points for 3D, and
| >   ## the below is an approximation, that is empircally visually correct.
| >   if (nd == 2)
| >     s = sqrt (s) / 2;
| >   else
| >     s = s / 4;
| >   endif
| > </quote>
| >
| > Therefore if you pass a value for s as a vector, it is passed to patch
| > as a vector.. The code
| >
| >  n = 100; x = randn(n,1); y = randn(n,1); c = sqrt(x.^2 + y.^2);
| > scatter(x, y, 1:100, c)
| >
| > works fine for me under Octave 3.0.0 and gnuplot 4.2.3 that I'm using..
| > However, it appears to be broken under 3.1.x
| >
| > D.
| >
| >  
| Here is a changeset that gets the markersize for scatter plots working
| again in 3.1.x. However.
|
| n = 100; x = randn(n,1); y = randn(n,1); c = sqrt(x.^2 + y.^2);
| scatter(x, y, 1:100, c)
|
| won't work in 3.1.x though it works in 3.0.0... The reason is that the
| patch objects now require that the markersize is a scalar value. This is
| compatible with the behavior of the Matlab patch objects. However,
| matlab allows vector markersizes to scatter plots, and does this by
| using an hggroup to form a "scattergroup" which is a group of N patch
| objects each with different marker sizes.
|
| I see two ways of fixing this issue
|
| 1) The right way would be to implement a scattergroup and keep the
| markersize as a scalar value in the patch objects. This seems to me to
| be a significant amount of work and I don't want to do something like
| that if Shai or Michael are working in the background on the graphics.
|
| 2) The hack would be to allow patch markersize to be a matrix and so
| keep the same behavior as Octave 3.0.0, and a visually similar behavior
| to matlab, but with a handle that is incompatible. I'd be happy enough
| to propose a patch for this if people want this to be done, but its not
| the right thing to do..

I applied the patch.

I'd say wait for hggroups.  If that doesn't happen before 3.1, then we
can go for the hack as a temporary solution.

jwe
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www.cae.wisc.edu/mailman/listinfo/bug-octave

Re: [CHANGESET]: Re: scatter - markersize

by Michael Goffioul-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

For you information, I'm currently working on providing the
building blocks for hggroup (listeners, dynamic properties,
hggroup object...). I'm quite busy these days, but I hope
to get something working in a week or two.

Michael.


On Wed, Mar 19, 2008 at 6:10 PM, John W. Eaton <jwe@...> wrote:

>
> On 19-Mar-2008, David Bateman wrote:
>
>  | David Bateman wrote:
>  | > Christoph Keller wrote:
>  | >
>  | >> in my opinion, scatter(X,Y,S) places the scatter-marks constant in size, even
>  | >> if a "weigth"-vector S is given as an argument of scatter.
>  | >>
>  | >> In __scatter__.m I found:
>  | >>
>  | >>   h = patch("faces", [1:length(x)].', "vertices", [x, y, z], "facecolor",
>  | >>          "none", "edgecolor", "flat", "cdata", c, "marker", marker,
>  | >>          "markersize", s, "linestyle", "none");
>  | >>
>  | >> where 's' is a scalar rather than a vector. Is this by design or by
>  | >> accident?
>  | >>
>  | >> thank you for your comments, sincerely
>  | >> Christoph Keller
>  | >> (octave 3.0.0, Windows XP)
>  | >>
>  | >>
>  | >
>  | > The calculation of "s" in __scatter__.m is
>  | >
>  | > <quote>
>  | >   if (istart < nargin && firstnonnumeric > istart)
>  | >     s = varargin{istart};
>  | >     if (isempty (s))
>  | >       s = 8;
>  | >     endif
>  | >   else
>  | >     s = 8;
>  | >   endif
>  | >   ## Note markersize is in points^2 for 2D and points for 3D, and
>  | >   ## the below is an approximation, that is empircally visually correct.
>  | >   if (nd == 2)
>  | >     s = sqrt (s) / 2;
>  | >   else
>  | >     s = s / 4;
>  | >   endif
>  | > </quote>
>  | >
>  | > Therefore if you pass a value for s as a vector, it is passed to patch
>  | > as a vector.. The code
>  | >
>  | >  n = 100; x = randn(n,1); y = randn(n,1); c = sqrt(x.^2 + y.^2);
>  | > scatter(x, y, 1:100, c)
>  | >
>  | > works fine for me under Octave 3.0.0 and gnuplot 4.2.3 that I'm using..
>  | > However, it appears to be broken under 3.1.x
>  | >
>  | > D.
>  | >
>  | >
>  | Here is a changeset that gets the markersize for scatter plots working
>  | again in 3.1.x. However.
>  |
>  | n = 100; x = randn(n,1); y = randn(n,1); c = sqrt(x.^2 + y.^2);
>  | scatter(x, y, 1:100, c)
>  |
>  | won't work in 3.1.x though it works in 3.0.0... The reason is that the
>  | patch objects now require that the markersize is a scalar value. This is
>  | compatible with the behavior of the Matlab patch objects. However,
>  | matlab allows vector markersizes to scatter plots, and does this by
>  | using an hggroup to form a "scattergroup" which is a group of N patch
>  | objects each with different marker sizes.
>  |
>  | I see two ways of fixing this issue
>  |
>  | 1) The right way would be to implement a scattergroup and keep the
>  | markersize as a scalar value in the patch objects. This seems to me to
>  | be a significant amount of work and I don't want to do something like
>  | that if Shai or Michael are working in the background on the graphics.
>  |
>  | 2) The hack would be to allow patch markersize to be a matrix and so
>  | keep the same behavior as Octave 3.0.0, and a visually similar behavior
>  | to matlab, but with a handle that is incompatible. I'd be happy enough
>  | to propose a patch for this if people want this to be done, but its not
>  | the right thing to do..
>
>  I applied the patch.
>
>  I'd say wait for hggroups.  If that doesn't happen before 3.1, then we
>  can go for the hack as a temporary solution.
>
>  jwe
>  _______________________________________________
>  Bug-octave mailing list
>  Bug-octave@...
>  https://www.cae.wisc.edu/mailman/listinfo/bug-octave
>
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www.cae.wisc.edu/mailman/listinfo/bug-octave