Re: [Matplotlib-users] Trying to migrate to Python 3.2, Matplotlib 1.2.1

2013-04-18 Thread Sterling Smith
I have used the TkAgg backend in python2, installing the dependencies by hand.  
Is this backend not available for python3?

-Sterling

On Apr 18, 2013, at 8:03PM, John Ladasky wrote:

> Thanks to both Francesco Montesano and Benjamin Root.  I have done some 
> reading.  And I have made some progress, though I am not quite where I 
> want to be yet.
> 
> So the problem appears to be that the only backend for which I had 
> suitable Python 3 libraries was agg.  It only requires libpng, which I 
> have.  I can render a Matplotlib canvas, but it appears that the only 
> output that agg offers is in the form of PNG files to disk.  I cannot 
> create a live window on the screen.
> 
> Reading more, I realize that the way I was getting GUI output previously 
> (with Python 2.7 and Matplotlib 1.1) was through wxPython.  
> Unfortunately, it appears that wxPython's star is fading, and a Python 
> 3-compatible version will not be written.  In fact, wxPython hasn't 
> released a new version in nine months.
> 
> The other choices for Matplotlib GUI output on Linux appear to be 
> through GTK, PySide, and PyQt.  I am not familiar with GTK, but I know 
> that it is widely-used.  Also, GTK appears to be Python 3-compatible, 
> and so that is where I need to go.
> 
> I'm going through a trial and error process.  Unfortunately, the names 
> of the repositories in Ubuntu are not very helpful.  I installed a few 
> GTK and python-gtk related packages that I thought were relevant.  On my 
> first build attempt I got no errors, but also, I didn't get a GTKAgg 
> backend.  Upon re-reading, I saw that I should modify matplotlib's 
> setup.cfg file to force a GTK build attempt, and to report errors if it 
> fails. That's what it does.  In the "optional backend dependencies" 
> section I am not seeing any GTK libraries listed, even though I have 
> installed python-gtk2-dev (2.24.0), python-gobject-2-dev (2.28.6), 
> libgtk2.0-dev (2.24.10), libglib2.0-dev (2.32.3), python-gi-dev (3.2.2), 
> python-gobject-dev (3.2.2), python3-gi (3.2.2), and a few DOZEN packages 
> on which these depend.
> 
> If anyone knows the way forward from here, I would appreciate your 
> advice.  Thanks again.
> 
> --
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Trying to migrate to Python 3.2, Matplotlib 1.2.1

2013-04-18 Thread C M
On Thu, Apr 18, 2013 at 11:03 PM, John Ladasky
wrote:

> .
> Reading more, I realize that the way I was getting GUI output previously
> (with Python 2.7 and Matplotlib 1.1) was through wxPython.
> Unfortunately, it appears that wxPython's star is fading, and a Python
> 3-compatible version will not be written.  In fact, wxPython hasn't
> released a new version in nine months.
>

wxPython is alive and well and the newest developmental version of it
("Phoenix") runs on Python 3. It should be released fairly soon.  One of
the wxPython list regulars mentioned getting his software to run with it,
with a few minor issues, just six days ago.  So you might want to give
Phoenix a try.

Che
--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Trying to migrate to Python 3.2, Matplotlib 1.2.1

2013-04-18 Thread John Ladasky
Thanks to both Francesco Montesano and Benjamin Root.  I have done some 
reading.  And I have made some progress, though I am not quite where I 
want to be yet.

So the problem appears to be that the only backend for which I had 
suitable Python 3 libraries was agg.  It only requires libpng, which I 
have.  I can render a Matplotlib canvas, but it appears that the only 
output that agg offers is in the form of PNG files to disk.  I cannot 
create a live window on the screen.

Reading more, I realize that the way I was getting GUI output previously 
(with Python 2.7 and Matplotlib 1.1) was through wxPython.  
Unfortunately, it appears that wxPython's star is fading, and a Python 
3-compatible version will not be written.  In fact, wxPython hasn't 
released a new version in nine months.

The other choices for Matplotlib GUI output on Linux appear to be 
through GTK, PySide, and PyQt.  I am not familiar with GTK, but I know 
that it is widely-used.  Also, GTK appears to be Python 3-compatible, 
and so that is where I need to go.

I'm going through a trial and error process.  Unfortunately, the names 
of the repositories in Ubuntu are not very helpful.  I installed a few 
GTK and python-gtk related packages that I thought were relevant.  On my 
first build attempt I got no errors, but also, I didn't get a GTKAgg 
backend.  Upon re-reading, I saw that I should modify matplotlib's 
setup.cfg file to force a GTK build attempt, and to report errors if it 
fails. That's what it does.  In the "optional backend dependencies" 
section I am not seeing any GTK libraries listed, even though I have 
installed python-gtk2-dev (2.24.0), python-gobject-2-dev (2.28.6), 
libgtk2.0-dev (2.24.10), libglib2.0-dev (2.32.3), python-gi-dev (3.2.2), 
python-gobject-dev (3.2.2), python3-gi (3.2.2), and a few DOZEN packages 
on which these depend.

If anyone knows the way forward from here, I would appreciate your 
advice.  Thanks again.

--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] TypeError: unsupported operand type(s) for +: 'NoneType' and 'float' on 1.2.1

2013-04-18 Thread Michael Droettboom
Can you please provide a complete, minimal and self-contained script 
that reproduces the error?  The example below has many undefined 
variables etc.

Cheers,
Mike

On 04/16/2013 07:09 PM, Christophe Pettus wrote:
> # preamble code collecting data
>
>  ind = np.arange(len(table_name))
>  
>  width = 0.35
>  
>  fig = plot.figure(figsize=DEFAULT_FIGURE_SIZE)
>  ax = fig.add_subplot(111, axisbg='#fafafa', alpha=0.9)
>  
>  ax.set_title('Largest Tables')
>  
>  ax.set_xlabel('Size (log scale)')
>  
>  ax.set_xscale('log')
>  ax.grid(True)
>  
>  ax.xaxis.set_major_formatter(FuncFormatter(magnitude_ticks))
>
>  dbar = ax.barh(ind, data_size, width, linewidth=0, color='blue', 
> label='Main Data')  # exception here
>  ibar = ax.barh(ind, index_toast_size, width, left=data_size, 
> linewidth=0, color='red', label='Toast/Indexes')
>  ax.set_yticks(ind + width/2)
>  ax.set_yticklabels(table_name, fontproperties=xx_small_font)
>
>  ax.legend(loc='lower right', prop=x_small_font)
>
>  plot.tight_layout()
>  
>  plot.savefig(REPORT_DIR_PATH + '/table_sizes.pdf')
>
>  plot.close()


--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Trying to migrate to Python 3.2, Matplotlib 1.2.1

2013-04-18 Thread Benjamin Root
On Thu, Apr 18, 2013 at 3:34 AM, John Ladasky wrote:

> Hello everyone,
>
> After not using Matplotlib for over a year, I'm returning to it.
> Meanwhile, I have upgraded from Python 2.7 to Python 3.2, and I want to
> do all of my software development in Python 3 from now on.
>
> My OS is Ubuntu 12.04.1.  Python 2.7 is still the default Python for
> Ubuntu, and many of the Python 3 packages are not offered as official
> repositories yet. I downloaded Matplotlib 1.2.1, then built it using
> Python 3.  Eventually, I got no build error messages, and proceeded to
> install. (I always have to pick through dependency problems one error
> message at a time.  I wish there was a better way.  The Matplotlib docs
> could be a little better in this respect.)
>
> When I open a Python3 interpreter, I can import matplotlib.  But I am
> not seeing ANYTHING with commands like plt.show().  It executes, and
> then returns.  No output is generated.
>
> This very short and simple test program of mine used to produce output
> with Python 2.7 and Matplotlib 1.1.0.  But with Python 3 and Matplolib
> 1.2.1, I am getting nothing...
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> x = np.arange(0, 5, 0.1);
> y = np.sin(x)
> plt.plot(x, y)
> plt.show()
>
> It runs.  No error messages are generated.  But I don't get a graph. I
> don't even see a graph flicker on to the screen and disappear an instant
> later.
>
> Any advice will be appreciated!
>
>
You will need to make sure you install the gtk packages (both the libraries
and the dev packages) *before* building from source.  If it can't find the
dev packages, then it won't build the interactive backend for it.  I can't
remember if there are python3 specific packages for gtk (or any other gui
for that matter).
--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Trying to migrate to Python 3.2, Matplotlib 1.2.1

2013-04-18 Thread Francesco Montesano
Hi John,

2013/4/18 John Ladasky 

> On 04/18/2013 01:01 AM, Francesco Montesano wrote:
>
>> does plt.savefig('test.png') work?
>>
> Yes, it does!  Thank you, that was a useful hint.


Good, than I would say that is a clear sign that you have a non interactive
backend.
Can you please give use the output of plt.get_backend() ?


>
>  If the figure get saved, it can be that you are using a non interactive
>> backend
>>
> Ugh, the one thing that I never understood about Matplotlib was backends.
>  So, what am I missing?  (Whatever I am missing now, I had it working a
> year ago when I was using matplotlib 1.1.0 on Python 2.7.)
>

This link http://matplotlib.org/faq/usage_faq.html#what-is-a-backend should
explain you what a backend is.

If you want to use always a specific backend, you should select it in the
matplotlibrc file

You should have a line like this
#backend  : TkAgg
Just uncomment it and put the backend that you want to use


> I have also just tried ipython3.  Nothing that I do in the live
> interpreter displays any graphs.
>
>
That is not surprising: if matplotlib doesn't use an interactive backend,
you can't show the figures, whatever interpreter you use.

I hope that now is clearer,

Fra

ps: try to remember to reply to the list :D
--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Trying to migrate to Python 3.2, Matplotlib 1.2.1

2013-04-18 Thread Francesco Montesano
Hi John,

does plt.savefig('test.png') work?

If the figure get saved, it can be that you are using a non interactive
backend

Cheers
Fra


2013/4/18 John Ladasky 

> Hello everyone,
>
> After not using Matplotlib for over a year, I'm returning to it.
> Meanwhile, I have upgraded from Python 2.7 to Python 3.2, and I want to
> do all of my software development in Python 3 from now on.
>
> My OS is Ubuntu 12.04.1.  Python 2.7 is still the default Python for
> Ubuntu, and many of the Python 3 packages are not offered as official
> repositories yet. I downloaded Matplotlib 1.2.1, then built it using
> Python 3.  Eventually, I got no build error messages, and proceeded to
> install. (I always have to pick through dependency problems one error
> message at a time.  I wish there was a better way.  The Matplotlib docs
> could be a little better in this respect.)
>
> When I open a Python3 interpreter, I can import matplotlib.  But I am
> not seeing ANYTHING with commands like plt.show().  It executes, and
> then returns.  No output is generated.
>
> This very short and simple test program of mine used to produce output
> with Python 2.7 and Matplotlib 1.1.0.  But with Python 3 and Matplolib
> 1.2.1, I am getting nothing...
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> x = np.arange(0, 5, 0.1);
> y = np.sin(x)
> plt.plot(x, y)
> plt.show()
>
> It runs.  No error messages are generated.  But I don't get a graph. I
> don't even see a graph flicker on to the screen and disappear an instant
> later.
>
> Any advice will be appreciated!
>
>
>
> --
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Trying to migrate to Python 3.2, Matplotlib 1.2.1

2013-04-18 Thread John Ladasky
Hello everyone,

After not using Matplotlib for over a year, I'm returning to it. 
Meanwhile, I have upgraded from Python 2.7 to Python 3.2, and I want to 
do all of my software development in Python 3 from now on.

My OS is Ubuntu 12.04.1.  Python 2.7 is still the default Python for 
Ubuntu, and many of the Python 3 packages are not offered as official 
repositories yet. I downloaded Matplotlib 1.2.1, then built it using 
Python 3.  Eventually, I got no build error messages, and proceeded to 
install. (I always have to pick through dependency problems one error 
message at a time.  I wish there was a better way.  The Matplotlib docs 
could be a little better in this respect.)

When I open a Python3 interpreter, I can import matplotlib.  But I am 
not seeing ANYTHING with commands like plt.show().  It executes, and 
then returns.  No output is generated.

This very short and simple test program of mine used to produce output 
with Python 2.7 and Matplotlib 1.1.0.  But with Python 3 and Matplolib 
1.2.1, I am getting nothing...

import numpy as np
import matplotlib.pyplot as plt

x = np.arange(0, 5, 0.1);
y = np.sin(x)
plt.plot(x, y)
plt.show()

It runs.  No error messages are generated.  But I don't get a graph. I 
don't even see a graph flicker on to the screen and disappear an instant 
later.

Any advice will be appreciated!


--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users