screen colors invert with matplotlib

I’ve recently started using matplotlib on new unix
box and I’m running in to an odd problem. I’m not sure what
the root cause is (my linux installation, graphics drivers, matplotlib, or
something else) but I thought I would ask here to see if anyone else had
experienced this.

OS: Fedora Core 8

Video Card: Nvidia GeForce 8800 Ultra

Driver: Latest Unix driver from Nvidia (169.07, release
date: Dec 20, 2007)

Matplotlib version: matplotlib-0.91.2.tar.gz (built from
source)

Backend chosen: qt4agg

Qt4 version: 4.3.3

The problem: If a matplotlib plot window ever has
focus, the screen colors on the whole screen invert themselves. White
becomes black, etc. I can probably post a link to a screenshot if that
will help, but it looks like a simple color inversion to me. If the plot window
doesn’t have focus, everything is drawn correctly.

My simple test was:

$ ipython –pylab

In [1]: plot(range(10))

With older versions of matplotlib, the colors did not invert—the
screen went totally black when the plot window had focus. When it doesn’t,
everything looks fine.

I’m not seeing this behavior with any other
application so far. If upgrading to the SVN trunk version would help, I’m
willing to give that a try. But I wanted to get some feedback before
updating anything else.

Thanks,

-Dan

···

Dan Karipides

Tech-X Corporation

karipid@…1338…

OS: Fedora Core 8

Video Card: Nvidia GeForce 8800 Ultra

Driver: Latest Unix driver from Nvidia (169.07, release date: Dec 20, 2007)

Matplotlib version: matplotlib-0.91.2.tar.gz (built from source)

Backend chosen: qt4agg

Hi Dan,

No one has ever reported anything like this before as far as I know.
Could you try running a simple test script with a different GUI
backend, eg tkagg or gtkagg

  > python simple_plot.py -dTkAgg #or GTKAgg

I assume this is a qt4 problem, but I'd just like to confirm before we
proceed. Do you see it with qtagg or just qt4agg?

···

On Jan 9, 2008 10:14 AM, Dan Karipides <karipid@...1338...> wrote:

Thanks John.

I did this test:

  python simple_plot.py -dTkAgg

and it worked just fine. (The GTK backend won't compile for me, but that is
a topic for another email.)

So you are correct, it seems to be a qt4 problem or a pyqt4 problem, I
guess.

At least I know where to look now.

-Dan

···

-----Original Message-----
From: John Hunter [mailto:jdh2358@…287…]
Sent: Wednesday, January 09, 2008 11:40 AM
To: Dan Karipides
Cc: Matplotlib Users
Subject: Re: [Matplotlib-users] screen colors invert with matplotlib

On Jan 9, 2008 10:14 AM, Dan Karipides <karipid@...1338...> wrote:

OS: Fedora Core 8

Video Card: Nvidia GeForce 8800 Ultra

Driver: Latest Unix driver from Nvidia (169.07, release date: Dec 20,

2007)

Matplotlib version: matplotlib-0.91.2.tar.gz (built from source)

Backend chosen: qt4agg

Hi Dan,

No one has ever reported anything like this before as far as I know.
Could you try running a simple test script with a different GUI
backend, eg tkagg or gtkagg

  > python simple_plot.py -dTkAgg #or GTKAgg

I assume this is a qt4 problem, but I'd just like to confirm before we
proceed. Do you see it with qtagg or just qt4agg?

I wonder if the problem exhibits itself in any other pyqt4 apps (such as the demo apps)... In that case, I would take your question to the pyqt list. Otherwise, we'll want to track down what specifically matplotlib is doing that causes this.

Cheers,
Mike

Dan Karipides wrote:

···

Thanks John.

I did this test:

  python simple_plot.py -dTkAgg

and it worked just fine. (The GTK backend won't compile for me, but that is
a topic for another email.)

So you are correct, it seems to be a qt4 problem or a pyqt4 problem, I
guess.

At least I know where to look now.

-Dan

-----Original Message-----
From: John Hunter [mailto:jdh2358@…287…] Sent: Wednesday, January 09, 2008 11:40 AM
To: Dan Karipides
Cc: Matplotlib Users
Subject: Re: [Matplotlib-users] screen colors invert with matplotlib

On Jan 9, 2008 10:14 AM, Dan Karipides <karipid@...1338...> wrote:

OS: Fedora Core 8

Video Card: Nvidia GeForce 8800 Ultra

Driver: Latest Unix driver from Nvidia (169.07, release date: Dec 20,

2007)

Matplotlib version: matplotlib-0.91.2.tar.gz (built from source)

Backend chosen: qt4agg

Hi Dan,

No one has ever reported anything like this before as far as I know.
Could you try running a simple test script with a different GUI
backend, eg tkagg or gtkagg

  > python simple_plot.py -dTkAgg #or GTKAgg

I assume this is a qt4 problem, but I'd just like to confirm before we
proceed. Do you see it with qtagg or just qt4agg?

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Do the demo apps come with the standard qt4/pyqt4 install? I just used the
Fedora Core 8 package manager to install both of these packages.

I apologize that my knowledge of qt is limited. I'll do some investigation
of qt4 / pyqt4 on my own before bothering the list further.

Thanks for the suggestion,

-Dan

···

-----Original Message-----
From: Michael Droettboom [mailto:mdroe@…86…]
Sent: Wednesday, January 09, 2008 2:35 PM
To: Dan Karipides
Cc: 'Matplotlib Users'
Subject: Re: [Matplotlib-users] screen colors invert with matplotlib

I wonder if the problem exhibits itself in any other pyqt4 apps (such as
the demo apps)... In that case, I would take your question to the pyqt
list. Otherwise, we'll want to track down what specifically matplotlib
is doing that causes this.

Cheers,
Mike

Dan Karipides wrote:

Thanks John.

I did this test:

  python simple_plot.py -dTkAgg

and it worked just fine. (The GTK backend won't compile for me, but that

is

a topic for another email.)

So you are correct, it seems to be a qt4 problem or a pyqt4 problem, I
guess.

At least I know where to look now.

-Dan

-----Original Message-----
From: John Hunter [mailto:jdh2358@…287…]
Sent: Wednesday, January 09, 2008 11:40 AM
To: Dan Karipides
Cc: Matplotlib Users
Subject: Re: [Matplotlib-users] screen colors invert with matplotlib

On Jan 9, 2008 10:14 AM, Dan Karipides <karipid@...1338...> wrote:

OS: Fedora Core 8

Video Card: Nvidia GeForce 8800 Ultra

Driver: Latest Unix driver from Nvidia (169.07, release date: Dec 20,

2007)

Matplotlib version: matplotlib-0.91.2.tar.gz (built from source)

Backend chosen: qt4agg

Hi Dan,

No one has ever reported anything like this before as far as I know.
Could you try running a simple test script with a different GUI
backend, eg tkagg or gtkagg

  > python simple_plot.py -dTkAgg #or GTKAgg

I assume this is a qt4 problem, but I'd just like to confirm before we
proceed. Do you see it with qtagg or just qt4agg?

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.

http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Could you please post a screenshot of the bad behavior? I don't see anything
strange here, and I'm using qt-4.3.3, pyqt-4.3.3, and an nvidia GeForce 6600.

Darren

···

On Wednesday 09 January 2008 05:00:28 pm Dan Karipides wrote:

Do the demo apps come with the standard qt4/pyqt4 install? I just used the
Fedora Core 8 package manager to install both of these packages.

I apologize that my knowledge of qt is limited. I'll do some investigation
of qt4 / pyqt4 on my own before bothering the list further.

Thanks for the suggestion,

-Dan

-----Original Message-----
From: Michael Droettboom [mailto:mdroe@…86…]
Sent: Wednesday, January 09, 2008 2:35 PM
To: Dan Karipides
Cc: 'Matplotlib Users'
Subject: Re: [Matplotlib-users] screen colors invert with matplotlib

I wonder if the problem exhibits itself in any other pyqt4 apps (such as
the demo apps)... In that case, I would take your question to the pyqt
list. Otherwise, we'll want to track down what specifically matplotlib
is doing that causes this.

Cheers,
Mike

Dan Karipides wrote:
> Thanks John.
>
> I did this test:
>
> python simple_plot.py -dTkAgg
>
> and it worked just fine. (The GTK backend won't compile for me, but that

is

> a topic for another email.)
>
> So you are correct, it seems to be a qt4 problem or a pyqt4 problem, I
> guess.
>
> At least I know where to look now.
>
> -Dan
>
> -----Original Message-----
> From: John Hunter [mailto:jdh2358@…287…]
> Sent: Wednesday, January 09, 2008 11:40 AM
> To: Dan Karipides
> Cc: Matplotlib Users
> Subject: Re: [Matplotlib-users] screen colors invert with matplotlib
>
> On Jan 9, 2008 10:14 AM, Dan Karipides <karipid@...1338...> wrote:
>> OS: Fedora Core 8
>>
>> Video Card: Nvidia GeForce 8800 Ultra
>>
>> Driver: Latest Unix driver from Nvidia (169.07, release date: Dec 20,
>
> 2007)
>
>> Matplotlib version: matplotlib-0.91.2.tar.gz (built from source)
>>
>> Backend chosen: qt4agg
>
> Hi Dan,
>
> No one has ever reported anything like this before as far as I know.
> Could you try running a simple test script with a different GUI
> backend, eg tkagg or gtkagg
>
> > python simple_plot.py -dTkAgg #or GTKAgg
>
> I assume this is a qt4 problem, but I'd just like to confirm before we
> proceed. Do you see it with qtagg or just qt4agg?
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.

http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplac
e

> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> matplotlib-users List Signup and Options

--
Darren S. Dale, Ph.D.
Staff Scientist
Cornell High Energy Synchrotron Source
Cornell University
275 Wilson Lab
Rt. 366 & Pine Tree Road
Ithaca, NY 14853

darren.dale@...163...
office: (607) 255-3819
fax: (607) 255-9001
http://www.chess.cornell.edu

Darren,

This is interesting. I tried to get a screenshot of the bad behavior for
you. My first attempt was to just hit "print screen". Under Fedora Core 8,
KDE window manager this brings up the application KSnapshot. When KSnapshot
gets focus, the bad behavior goes away and it was not captured in the
screenshot.

I did notice the KSnapshot app has a snapshot delay feature. I set it to 2
seconds, and clicked new snapshot. The KSnapshot window disappeared for 2
seconds; the bad behavior was back for that period of time. However, even
in this case, the behavior doesn't show up in the screenshot.

This makes me wonder if maybe it is a video driver problem. Linux has the
right colors in memory (which is I assume the level at which the snap shot
is taken), but the driver is wigging out when communicating the info to the
actual video card.

If I manage to get a SS I will post it.

-Dan

···

-----Original Message-----
From: Darren Dale [mailto:darren.dale@…163…]
Sent: Wednesday, January 09, 2008 3:08 PM
To: matplotlib-users@lists.sourceforge.net
Cc: Dan Karipides
Subject: Re: [Matplotlib-users] screen colors invert with matplotlib

Could you please post a screenshot of the bad behavior? I don't see anything

strange here, and I'm using qt-4.3.3, pyqt-4.3.3, and an nvidia GeForce
6600.

Darren

On Wednesday 09 January 2008 05:00:28 pm Dan Karipides wrote:

Do the demo apps come with the standard qt4/pyqt4 install? I just used

the

Fedora Core 8 package manager to install both of these packages.

I apologize that my knowledge of qt is limited. I'll do some

investigation

of qt4 / pyqt4 on my own before bothering the list further.

Thanks for the suggestion,

-Dan

-----Original Message-----
From: Michael Droettboom [mailto:mdroe@…86…]
Sent: Wednesday, January 09, 2008 2:35 PM
To: Dan Karipides
Cc: 'Matplotlib Users'
Subject: Re: [Matplotlib-users] screen colors invert with matplotlib

I wonder if the problem exhibits itself in any other pyqt4 apps (such as
the demo apps)... In that case, I would take your question to the pyqt
list. Otherwise, we'll want to track down what specifically matplotlib
is doing that causes this.

Cheers,
Mike

Just to follow up:

Mike was indeed correct. I never found the qt4 demos but I did find some
simple pyqt4 sample code.

http://zetcode.com/tutorials/pyqt4/firstprograms/

The first example on this page causes the same problem. It really isn't a
color inversion. It seems to be more of a messed up color palette. Some
colors remain unchanged, other colors are wildly different. White does go
to black though which is the most notable change.

So this is a PyQt (or Qt?) problem. As such, I'll stop cluttering this list
and move my investigation elsewhere.

Thanks for your help, all.

-Dan

···

-----Original Message-----
From: Michael Droettboom [mailto:mdroe@…86…]
Sent: Wednesday, January 09, 2008 2:35 PM
To: Dan Karipides
Cc: 'Matplotlib Users'
Subject: Re: [Matplotlib-users] screen colors invert with matplotlib

I wonder if the problem exhibits itself in any other pyqt4 apps (such as
the demo apps)... In that case, I would take your question to the pyqt
list. Otherwise, we'll want to track down what specifically matplotlib
is doing that causes this.

Cheers,
Mike

Now this is a totally shot in the dark, but I remember similar
'features' from good old unix times, where the X display was palette
instead of true-color, and you'd start some other app that forced its
own colors to the X display, thus changing the palette of other windows.
No idea though why it would happen with qt4, but not with other gui
libraries...

Cheers,
Vincent Schut.

Dan Karipides wrote:

···

Darren,

This is interesting. I tried to get a screenshot of the bad behavior for
you. My first attempt was to just hit "print screen". Under Fedora Core 8,
KDE window manager this brings up the application KSnapshot. When KSnapshot
gets focus, the bad behavior goes away and it was not captured in the
screenshot.

I did notice the KSnapshot app has a snapshot delay feature. I set it to 2
seconds, and clicked new snapshot. The KSnapshot window disappeared for 2
seconds; the bad behavior was back for that period of time. However, even
in this case, the behavior doesn't show up in the screenshot.

This makes me wonder if maybe it is a video driver problem. Linux has the
right colors in memory (which is I assume the level at which the snap shot
is taken), but the driver is wigging out when communicating the info to the
actual video card.

If I manage to get a SS I will post it.

-Dan

-----Original Message-----
From: Darren Dale [mailto:darren.dale@…163…]
Sent: Wednesday, January 09, 2008 3:08 PM
To: matplotlib-users@lists.sourceforge.net
Cc: Dan Karipides
Subject: Re: [Matplotlib-users] screen colors invert with matplotlib

Could you please post a screenshot of the bad behavior? I don't see anything

strange here, and I'm using qt-4.3.3, pyqt-4.3.3, and an nvidia GeForce
6600.

Darren

On Wednesday 09 January 2008 05:00:28 pm Dan Karipides wrote:

Do the demo apps come with the standard qt4/pyqt4 install? I just used

the

Fedora Core 8 package manager to install both of these packages.

I apologize that my knowledge of qt is limited. I'll do some

investigation

of qt4 / pyqt4 on my own before bothering the list further.

Thanks for the suggestion,

-Dan

-----Original Message-----
From: Michael Droettboom [mailto:mdroe@…86…]
Sent: Wednesday, January 09, 2008 2:35 PM
To: Dan Karipides
Cc: 'Matplotlib Users'
Subject: Re: [Matplotlib-users] screen colors invert with matplotlib

I wonder if the problem exhibits itself in any other pyqt4 apps (such as
the demo apps)... In that case, I would take your question to the pyqt
list. Otherwise, we'll want to track down what specifically matplotlib
is doing that causes this.

Cheers,
Mike

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace