[chaco] scatter plot issue...

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[chaco] scatter plot issue...

fred-2
Hi all,

I have about 9000 points in the following file:

http://ktools.free.fr/err.txt

If I display data in this file using Chaco, I get chaco.png,
which is obviously wrong: all value above 200 are displayed on the top.

The result is very different using Mayavi (mayavi.png).

What's wrong?

Any hint?

TIA

Cheers,

--
Fred

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

chaco.png (81K) Download Attachment
mayavi.png (129K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [chaco] scatter plot issue...

Peter Wang
On Mon, Apr 12, 2010 at 10:46 AM, Fred <[hidden email]> wrote:

> Hi all,
>
> I have about 9000 points in the following file:
>
> http://ktools.free.fr/err.txt
>
> If I display data in this file using Chaco, I get chaco.png,
> which is obviously wrong: all value above 200 are displayed on the top.
> The result is very different using Mayavi (mayavi.png).
> What's wrong?
> Any hint?

Well, there are several answers to your several questions.  The way
that chaco draws colormapped scatter plots is by doing colors in
bands.  If there are a large number of points relative to the number
of color bands (>> 255), it can be much faster to render in passes,
because you can render many points in bulk, instead of one at a time.
(Eventually it would be nice to add indexed colors/styles to Kiva to
support doing this differently, but for right now that's the trade off
we have to make.)

If you wish to disable this banded rendering, set the renderer's
_render_method to "bruteforce".  That will draw one point at a time,
and produce a result similar to Mayavi.

Taking a step back, while it's probably correct to say that in the
case when there are a lot of overlapping points, rendering by sorted
colorbands is inaccurate because it places more weight on particular
colors, it's not clear than randomizing the order of colors is really
any more accurate.  That is, it's less of a lie but is it any closer
to the truth?  I think when you try to do a colormapped scatterplot
with overlap, it's important to set opacity to something less than
1.0, so that regions of overlap are properly additive and visually
weighted more than other regions.

Ideally, there would be a two-pass render where we first look at the
total color of each pixel, without capping it to (1.0,1.0,1.0), and
then normalize the entire image, to maximally express the dynamic
range of values.  That's more work, but not impossible with our
current toolset.


-Peter
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [chaco] scatter plot issue...

fred-2
Le 12/04/2010 18:47, Peter Wang a écrit :

> Well, there are several answers to your several questions.  The way
> that chaco draws colormapped scatter plots is by doing colors in
> bands.  If there are a large number of points relative to the number
> of color bands (>>  255), it can be much faster to render in passes,
> because you can render many points in bulk, instead of one at a time.
> (Eventually it would be nice to add indexed colors/styles to Kiva to
> support doing this differently, but for right now that's the trade off
> we have to make.)
Ok.
>
> If you wish to disable this banded rendering, set the renderer's
> _render_method to "bruteforce".  That will draw one point at a time,
> and produce a result similar to Mayavi.
OK.

I have attached a CME and two snapshots.

The first comes from no _render_method in plot.
The second with _render_method set to 'bruteforce'.

What am I doing wrong here?



http://ktools.free.fr/err.txt



> Taking a step back, while it's probably correct to say that in the
> case when there are a lot of overlapping points, rendering by sorted
> colorbands is inaccurate because it places more weight on particular
> colors, it's not clear than randomizing the order of colors is really
Yes...

> any more accurate.  That is, it's less of a lie but is it any closer
> to the truth?  I think when you try to do a colormapped scatterplot
:-))
It depends of the context ;-)

And the context here was : how much values are greater than 200?
Looking at chaco display, one could answer: a lot.
Which is not expected.

Computing histogram shows that this is not the case. Good :-)

 From Mayavi display, one can't say there are a lot of values above 200.

It's less confusing :-)))


> with overlap, it's important to set opacity to something less than
> 1.0, so that regions of overlap are properly additive and visually
> weighted more than other regions.
Result with opacity less than 1.0 is not clear...
>
> Ideally, there would be a two-pass render where we first look at the
> total color of each pixel, without capping it to (1.0,1.0,1.0), and
> then normalize the entire image, to maximally express the dynamic
> range of values.  That's more work, but not impossible with our
> current toolset.
As you want ;-)


Cheers,

--
Fred

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

cmap_scatter.py (5K) Download Attachment
snapshot.png (52K) Download Attachment
snapshot2.png (52K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [chaco] scatter plot issue...

Peter Wang
On Mon, Apr 12, 2010 at 4:18 PM, Fred <[hidden email]> wrote:
> Le 12/04/2010 18:47, Peter Wang a écrit :
>
> I have attached a CME and two snapshots.
>
> The first comes from no _render_method in plot.
> The second with _render_method set to 'bruteforce'.
>
> What am I doing wrong here?

Ah, you set the trait on the Plot object and not the renderer it created.

I have made a change to the class in colormapped_scatter.py so that
"render_method" is now a public trait and has a default "auto" option
that can be overridden.  Please do an SVN update, or patch your local
copy with the following change:
https://svn.enthought.com/enthought/changeset/25470/Chaco/trunk

I have made the appropriate changes to your CME, as well as including
two additional modifications:
1. Added a vertical histogram plot on the right of the colorbar, that
uses the same axis scale as the colorbar.
2. Added a global flag at the top of the demo named
"ZOOMABLE_COLORBAR".  If you set this to True, then you can pan and
zoom the colorbar or the histogram plot, and change the dynamic range
of the colormapping of the scatterplot.

I did these in response to your question:
> And the context here was : how much values are greater than 200?

The histogram plot shows you how far the long tail of values goes.

HTH,
Peter

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

cmap_scatter.py (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [chaco] scatter plot issue...

fred-2
Le 13/04/2010 07:24, Peter Wang a écrit :

> Ah, you set the trait on the Plot object and not the renderer it created.

[snip]

Thanks a lot, Peter!!!


Cheers,

--
Fred
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev