mixed colors

Hi all When I plot the same data set with say red and blue

    > markers, then mpl seems to mix the colors (red + blue ->
    > purple). How can I turn this behavior off?

This doesn't sound right to me -- can you post an example which
exposes this problem and provide the backend you are using -- eg, run
your script with

> python myscript.py --verbose-helpful

and post the output along with myscript.py

Thanks,
JDH

Hi

Here the test. As you can see the points 1,2,3 are red, 4 and 5 are purple and 6 and 7 are red.

overlay.eps (141 KB)

overlay.py (120 Bytes)

···

=======================================================================
elcorto@...662...:~/Python/torsten/psa/test$ python overlay.py --verbose-helpful
matplotlib data path /usr/share/matplotlib
loaded rc file /usr/share/matplotlib/.matplotlibrc
matplotlib version 0.81
verbose.level helpful
interactive is False
platform is linux2
numerix Numeric 23.8
font search path ['/usr/share/matplotlib']
loaded ttfcache file /home/elcorto/.ttffont.cache
backend GTKAgg version 2.6.1

cheers,
steve

John Hunter wrote:

"Steve" == Steve Schmerler <elcorto@...361...> writes:

    > Hi all When I plot the same data set with say red and blue
    > markers, then mpl seems to mix the colors (red + blue ->
    > purple). How can I turn this behavior off?

This doesn't sound right to me -- can you post an example which
exposes this problem and provide the backend you are using -- eg, run
your script with

> python myscript.py --verbose-helpful

and post the output along with myscript.py

Thanks,
JDH

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Steve Schmerler schrieb:

Hi

Here the test. As you can see the points 1,2,3 are red, 4 and 5 are purple and 6 and 7 are red.

Hello Steve,

I used ghostview (gv) on Linux to display the .eps and it looks perfectly fine -- only blue and red crosses. Might this be a display problem of your eps viewer?

Best regards,

Niklas.

Hi

Well this is kinda strange. I checked with gsview (on Win) and ggv and
gv on Linux. The 'mixed' points (4 and 5) _are_ purple/dark red while
the others are blue and (light)red.

cheers,
steve

N. Volbers wrote:

···

Steve Schmerler schrieb:

Hi

Here the test. As you can see the points 1,2,3 are red, 4 and 5 are purple and 6 and 7 are red.

Hello Steve,

I used ghostview (gv) on Linux to display the .eps and it looks perfectly fine -- only blue and red crosses. Might this be a display problem of your eps viewer?

Best regards,

Niklas.

Steve Schmerler wrote:

Hi

Well this is kinda strange. I checked with gsview (on Win) and ggv and
gv on Linux. The 'mixed' points (4 and 5) _are_ purple/dark red while
the others are blue and (light)red.

I blame antialiasing. Using Preview.app on OS X, when zoomed out, yes, I can see that the middle points appear to be somewhat darker than the "pure" red ones. Zooming in, however, I see little difference except for a bit of fuzz. Using "DigitalColor Meter.app", I can verify that the color of the middle crosses is indeed pure red with some purplish fuzz at the edges. When zoomed out enough, all of the pixels are antialiased fuzz and so it mixes both the top color and the bottom.

IOW, it's an issue with how the display program handles antialiasing of overlaid colors, not the output generated by matplotlib.

···

--
Robert Kern
rkern@...376...

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

Hi

Hmmm now that you mention antialiasing ... I turned it off in my .matplotlibrc but my plots (GTKAgg on Linux) are still antialiased. I had the same problem on Win (TkAgg) but didn't bother too much. I remember that there was a discussion before about this. I'm using mpl 0.81. Would upgrading fix this issue?

cheers,
steve

Robert Kern wrote:

···

Steve Schmerler wrote:

Hi

Well this is kinda strange. I checked with gsview (on Win) and ggv and
gv on Linux. The 'mixed' points (4 and 5) _are_ purple/dark red while
the others are blue and (light)red.

I blame antialiasing. Using Preview.app on OS X, when zoomed out, yes, I can see that the middle points appear to be somewhat darker than the "pure" red ones. Zooming in, however, I see little difference except for a bit of fuzz. Using "DigitalColor Meter.app", I can verify that the color of the middle crosses is indeed pure red with some purplish fuzz at the edges. When zoomed out enough, all of the pixels are antialiased fuzz and so it mixes both the top color and the bottom.

IOW, it's an issue with how the display program handles antialiasing of overlaid colors, not the output generated by matplotlib.

Hi

Just to be clear at this point. I get this mixing issue both on Linux (GTKAgg, mpl 0.81) and Win (TkAgg, mpl 0.82) in the .eps outputs as well as in the interactive plots.

cheers,
steve

Steve Schmerler wrote:

···

Hi

Hmmm now that you mention antialiasing ... I turned it off in my .matplotlibrc but my plots (GTKAgg on Linux) are still antialiased. I had the same problem on Win (TkAgg) but didn't bother too much. I remember that there was a discussion before about this. I'm using mpl 0.81. Would upgrading fix this issue?

cheers,
steve

Robert Kern wrote:

Steve Schmerler wrote:

Hi

Well this is kinda strange. I checked with gsview (on Win) and ggv and
gv on Linux. The 'mixed' points (4 and 5) _are_ purple/dark red while
the others are blue and (light)red.

I blame antialiasing. Using Preview.app on OS X, when zoomed out, yes, I can see that the middle points appear to be somewhat darker than the "pure" red ones. Zooming in, however, I see little difference except for a bit of fuzz. Using "DigitalColor Meter.app", I can verify that the color of the middle crosses is indeed pure red with some purplish fuzz at the edges. When zoomed out enough, all of the pixels are antialiased fuzz and so it mixes both the top color and the bottom.

IOW, it's an issue with how the display program handles antialiasing of overlaid colors, not the output generated by matplotlib.

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Women are like cell phones. They like to be held and talked to, but push the wrong button, and you'll be disconnected.

Hmmm now that you mention antialiasing ... I turned it off in my .matplotlibrc but my plots (GTKAgg on Linux) are still antialiased. I had the same problem on Win (TkAgg) but didn't bother too much. I remember that there was a discussion before about this. I'm using mpl 0.81. Would upgrading fix this issue?

I tested the python script on my mpl, version 0.83.1 with no custom matplotlibrc. To my surprise, I got the result you were talking about. Then I opened the resulting eps with gv on linux. There is an option "antialias", which when you turn it on, will cause this color mixing.

To demonstrate this, I wrote a little gnuplot script that produces a similar output. If you look at the attached file with gv and toggle antialiasing, you will notice the same effect as with mpl.

On a side note, when comparing these two graphs I noticed that the gnuplot generated eps is only 15 K while the mpl generated eps has a size of 300 K. Why is this so?

Regards,

Niklas.

overlay.gp (158 Bytes)

overlay2.eps (14.9 KB)

N. Volbers wrote:

Hmmm now that you mention antialiasing ... I turned it off in my .matplotlibrc but my plots (GTKAgg on Linux) are still antialiased. I had the same problem on Win (TkAgg) but didn't bother too much. I remember that there was a discussion before about this. I'm using mpl 0.81. Would upgrading fix this issue?

I tested the python script on my mpl, version 0.83.1 with no custom matplotlibrc. To my surprise, I got the result you were talking about. Then I opened the resulting eps with gv on linux. There is an option "antialias", which when you turn it on, will cause this color mixing.

To demonstrate this, I wrote a little gnuplot script that produces a similar output. If you look at the attached file with gv and toggle antialiasing, you will notice the same effect as with mpl.

Yes I can varify that (on Win) with gsview (where turning off AA is done by setting Media > Display Settings > 'Text Alpha' and 'Graphics Alpha' to 1 bit). OK so it really seems to be no mpl issue. Just like Jhon mentioned :slight_smile:

But one problem remains: I'm not able to turn off AA in .matplotlibrc
If anyone could point me in the right direction (upgrading, other backend?) ....

On a side note, when comparing these two graphs I noticed that the gnuplot generated eps is only 15 K while the mpl generated eps has a size of 300 K. Why is this so?

I guess the dpi setting. But playing around with different dpi settings

  figure(dpi=<number>); plot(...); savefig(...)

or

  plot(...); savefig(...,dpi=<number>)

_always_ produces a .eps of 365 kb.

Regards,

Niklas.

cheers,
steve

···

--
Women are like cell phones. They like to be held and talked to, but push the wrong button, and you'll be disconnected.