octave-maintainers
[Top][All Lists]
Advanced

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

Re: fast scatter plots - advice sought


From: Kai Habel
Subject: Re: fast scatter plots - advice sought
Date: Mon, 11 Jan 2010 14:49:14 +0100

-------- Original-Nachricht --------
> Datum: Mon, 11 Jan 2010 08:22:03 +0100
> Von: Jaroslav Hajek <address@hidden>
> An: David Bateman <address@hidden>
> CC: octave maintainers list <address@hidden>
> Betreff: Re: fast scatter plots - advice sought

> On Mon, Jan 11, 2010 at 8:17 AM, David Bateman <address@hidden>
> wrote:
> > Jaroslav Hajek wrote:
> >>
> >> hi,
> >>
> >> I recently started some work where I'm going to use scatter plots
> >> heavily with a few thousand points.
> >> I found out, however, that scatter plots were unusably slow with so
> >> many points. This has also been reported before:
> >>
> >> http://old.nabble.com/scatter3-is-really-slow-to24312164.htm
> >>
> >> by this changeset
> >> http://hg.savannah.gnu.org/hgweb/octave/rev/2f435ed48143
> >>
> >> I tried to optimize the plotting strategy to get more reasonable
> >> times, especially in the simplest cases. The old strategy of creating
> >> one object per point is only used for small numbers of points (<= 20).
> >> Otherwise, the points are split into subsets with common color and
> >> size, and these subsets are plotted using a single primitive. This
> >> seems similar to what Matlab does.
> >>
> >
> > If this is done in the baackend ok, but I deliberately didn't make this
> > change in the frontend as it breaks matlab compatibility
> >
> 
> What breaks Matlab compatibility? Please explain. Note that it is
> *not* true that Matlab always creates one object per point (as you
> seemed to imply in the above linked mail), at least in 2007a. It does
> so only when there is a small number of points:
> 
> >> n = 10;
> >> h = scatter (rand (n, 1), rand (n, 1))
> 
> h =
> 
>   159.0022
> 
> >> get(h,'children')
> 
> ans =
> 
>   169.0011
>   168.0011
>   167.0011
>   166.0011
>   165.0011
>   164.0011
>   163.0011
>   162.0011
>   161.0015
>   160.0012
> 
> >> n = 1000;
> >> h = scatter (rand (n, 1), rand (n, 1))
> 
> h =
> 
>   159.0028
> 
> >> get(h,'children')
> 
> ans =
> 
>   160.0013
> 
> I bet the strategy Matlab uses is similar to ours. I didn't
> investigate the switch point, but I don't really think compatibility
> is needed at that level.
> 
> regards
> 
> -- 
> RNDr. Jaroslav Hajek, PhD
> computing expert & GNU Octave developer
> Aeronautical Research and Test Institute (VZLU)
> Prague, Czech Republic
> url: www.highegg.matfyz.cz




I did a quick check with 2009a:

>> n=100;h=scatter(rand(n,1),rand(n,1),'vi','off');ch=get(h,'ch');length(ch),get(ch(1),'Type')

ans =

   100


ans =

patch

>> n=101;h=scatter(rand(n,1),rand(n,1),'vi','off');ch=get(h,'ch');length(ch),get(ch(1),'Type')

ans =

     1


ans =

patch

So, the switching point is at 100/101. For 101 points and beyond matlab uses a 
single patch object to draw all data points.

Kai


reply via email to

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