[CHANGESET]: Re: scatter - markersize
Michael Goffioul
michael.goffioul at gmail.com
Wed Mar 19 15:33:48 CDT 2008
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 at bevo.che.wisc.edu> 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 at octave.org
> https://www.cae.wisc.edu/mailman/listinfo/bug-octave
>
More information about the Bug-octave
mailing list