Display problem on CentOS

Thanks again, Eric.

I had been trying, and finally got a good result.
My answer is installing PyQt4 for newer Python (v2.7.2) from sources.

Here is the successful steps:

1. Install SIP from source (sip-4.13.2.tar.gz) at default directory

2. Install QtSDK from .run file (Qt_SDK_Lin64_online_v1_2_en.run)
   at /usr/local/QtSDK
   * To install Qt from source, we have to get additional libraries.
     It was very bothersome, so I used official .run file.

3. Install PyQt4 from source (PyQt-x11-gpl-4.9.1.tar.gz)
   When I did ./configure, I set these options:
      python ./configure.py -g -q /usr/local/QtSDK/Desktop/Qt/4.8.0/gcc/bin/qmake
   If not setting -q option, pre-installed Qt may be selected,
   and we may get DBusPendingCall errors.

After above, I set backend and plotted line as below:

import matplotlib
matplotlib.use("Qt4Agg")
import matplotlib.pyplot as plt
plt.plot([1,2,4,3])
plt.show()

Then I got plot window from PyQt4! :slight_smile:

Magician

···

On 2012/04/01, at 19:42, matplotlib-users-request@lists.sourceforge.net wrote:

Date: Sat, 31 Mar 2012 07:53:21 -1000
From: Eric Firing <efiring@...202...>
Subject: Re: [Matplotlib-users] Display problem on CentOS
To: matplotlib-users@lists.sourceforge.net
Message-ID: <4F774491.5070305@...202...>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 03/31/2012 04:02 AM, Magician wrote:

Alexis& Eric

Thanks for your advices.
I've been trying, but I still have some problems.

I tried matplotlib.matplotlib_fname() and I found my silly mistake.
Python answered '/usr/local/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc'
My RC file was named ".matplotlibrc".
When the prefixed dot removed, it works perfectly.

And I found to change the backends by using matplotlib.use() command.
I tried all of them, but nothing worked (with errors).

When using matplotlib.get_backend() on pre-installed python2.6,
it said 'GTKAgg' and matplotlib.pyplot.show() exactly worked.
So I tried to install PyGTK from source code, but it's fairly complicated.

Is there an easy way to install backends for additionally installed Python?
My python is v2.7.2.

Can you find CentOS packages for any of the gui toolkits for your python
version? pygtk, pyqt4, tkinter, wxpython--any of them? If so, you
should be just about set. Only pygtk and tkinter would even require
rebuilding mpl; pyqt4 and wxpython don't require any mpl extension code.

Eric

Magician

On 2012/03/27, at 23:04, Alexis Praga wrote:

You can check you are editing the correct configuration file with (in
the Python shell) :

import matplotlib
matplotlib.matplotlib_fname()

You can also try other backends. For a list, see :
http://matplotlib.sourceforge.net/faq/usage_faq.html#what-is-a-backend

On Tue, Mar 27, 2012 at 2:46 PM, Magician<f_magician@...935...> wrote:

Thank you, Alexis.

I try to install PyQt4 and set Qt4Agg just now, but nothing displayed.
Ummm...what's wrong...??

Magician

On 2012/03/27, at 17:05, Alexis Praga wrote:

I had the same problem on Debian.
Editing the matplotlibrc (should be installed somewhere in your
systeme) and changing the "backend" variable to Qt4Agg did the trick.

On Tue, Mar 27, 2012 at 12:14 AM, Magician<f_magician@...935...> wrote:

Hi.

I want to install Matplotlib from source code on CentOS.
I've been using Matplotlib for a year.
But this is the first time for me to install CentOS by myself.

I installed CentOS 6.2 in basic install option.
Next, I installed NumPy and Matplotlib.
.matplotlibrc isn't set.

It looks successfully installed, but when I type show() command,
nothing appears.
I can export PNG image by using savefig() command, so maybe
I'm using invalid backend.

How can I display plots with show() command?

Magician