Re: [Matplotlib-users] Example showing differences between Mac O$ and Windows use

2014-03-14 Thread Thøger Emil Rivera-Thorsen
I have used Anaconda with my students because it installs a standard 
environment on all platforms, it works very well and is easy to install.

I have also tried to Enthought Canopy but swicthed to Anaconda because 
Anaconda was as simple to use, came with hfewer restrictions and in my 
experience also fewer bugs and problems than Canopy.

Macorts also work very well, though. So that is a matter of taste, I 
guess. The upside to Anaconda is that I believe it runs the Qt4Agg 
backend by default for all platforms. Can anyone confirm this (I don't 
have access to a Mac at the moment)?

On Thu 13 Mar 2014 09:29:38 PM CET, Sterling Smith wrote:
> +1 for macports
> (I haven't used the others.)
>
> On Mar 13, 2014, at 10:12AM, Felix Patzelt wrote:
>
>> Are you sure that you want to use Python 3.3 on OSX 10.6??? Do you really 
>> still use 10.6? Do you want Python 3? I'm not sure on the current status, 
>> but many projects took quite a while to get ported over from Python 2. 
>> Furthermore, as often with free software, installation can be a bit tricky. 
>> It is certainly a very different experience than installing "normal" Mac 
>> applications.
>>
>> For a bit of context, most Linux distribution have some version of Python / 
>> Matplotlib in their respective package managers. These are easily installed 
>> if the particular package manager on your Linux offers the versions you 
>> want. Otherwise, you will have to do some work.
>>
>> OSX does not have an official package manager, but there are several 
>> inofficial options. I'm using http://www.macports.org which is slow because 
>> it installs its own private versions for everything, but it works very well. 
>> This is probably the easiest way to get all the open source stuff you want 
>> on your Mac and I use it a lot. Another popular and more lightweight package 
>> manager is homebrew, which relies more on the system libraries from Apple.
>>
>> The minimal installation instructions without a package manager seem to be 
>> these: 
>> https://github.com/rueckstiess/mtools/wiki/matplotlib-Installation-Guide If 
>> you're a real unix hacker, you can install everything from source. I did 
>> that before, and it takes a lot of time and in-depth knowledge.
>>
>> Finally, there are several pre-packaged distributions like 
>> https://www.enthought.com or  https://store.continuum.io/cshop/anaconda/ 
>> (see http://penandpants.com/install-python/). They might come with a normal 
>> OSX installer. Maybe https://code.google.com/p/spyderlib/ does the trick for 
>> you?
>>
>> Anyway, these are just some suggestions. Maybe you want to start a separate 
>> thread on the mailing list about the best way to install matplotlib on a 
>> mac. Please note that I cannot comment in detail on any of the installation 
>> methods that I didn't use myself.
>>
>>
>>
>>
>> Am 13.03.2014 um 17:36 schrieb Christophe Bal :
>>
>>> I've tested a more simpler Python code.
>>>
>>> from pylab import *
>>> plot([1,2,3])
>>> show()
>>>
>>> This gives me a scary backend MacOSX version unknown. I've used the 
>>> official DMG installer matplotlib-1.3.1-py3.3-python.org-macosx10.6.dmg.
>>>
>>> This seems to be a big problem. No ?
>>>
>>>
>>> $HOME=/Users/
>>> matplotlib data path 
>>> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib/mpl-data
>>> loaded rc file 
>>> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib/mpl-data/matplotlibrc
>>> matplotlib version 1.3.1
>>> verbose.level helpful
>>> interactive is False
>>> platform is darwin
>>> CACHEDIR=/Users//.matplotlib
>>> Using fontManager instance from /Users//.matplotlib/fontList.py3k.cache
>>> backend MacOSX version unknown
>>>
>>>
>>> 2014-03-13 17:31 GMT+01:00 Felix Patzelt :
>>> Well, there is a list in ~/.matplotlib/matplotlibrc (see 
>>> http://matplotlib.org/users/customizing.html)
>>>
  CONFIGURATION BEGINS HERE

 # the default backend; one of GTK GTKAgg GTKCairo CocoaAgg FltkAgg
 # MacOSX QtAgg Qt4Agg TkAgg WX WXAgg Agg Cairo GDK PS PDF SVG Template
 # You can also deploy your own backend outside of matplotlib by
 # referring to the module name (which must be in the PYTHONPATH) as
 # 'module://my_backend'
 backend  : Qt4Agg
>>>
>>> see also: 
>>> http://stackoverflow.com/questions/5091993/list-of-all-available-matplotlib-backends
>>>
>>> I'm not sure about the dependencies, I guess you have to check out each one 
>>> of them. If you don't use a package manager, resolving all dependency 
>>> issues might be quite painful.
>>>
>>> Best,
>>> Felix Patzelt
>>>
>>> Am 13.03.2014 um 17:18 schrieb Christophe Bal :
>>>
 Thanks a lot for this big hint but neither TkAgg works nor Qt4Agg can work 
 (because I do not have PyQt).

 Is there a complete list of all the backends ?

 Christophe BAL

>>>
>>>
>>
>> --
>> Lear

Re: [Matplotlib-users] Example showing differences between Mac O$ and Windows use

2014-03-13 Thread Sterling Smith
+1 for macports
(I haven't used the others.)

On Mar 13, 2014, at 10:12AM, Felix Patzelt wrote:

> Are you sure that you want to use Python 3.3 on OSX 10.6??? Do you really 
> still use 10.6? Do you want Python 3? I'm not sure on the current status, but 
> many projects took quite a while to get ported over from Python 2. 
> Furthermore, as often with free software, installation can be a bit tricky. 
> It is certainly a very different experience than installing "normal" Mac 
> applications. 
> 
> For a bit of context, most Linux distribution have some version of Python / 
> Matplotlib in their respective package managers. These are easily installed 
> if the particular package manager on your Linux offers the versions you want. 
> Otherwise, you will have to do some work. 
> 
> OSX does not have an official package manager, but there are several 
> inofficial options. I'm using http://www.macports.org which is slow because 
> it installs its own private versions for everything, but it works very well. 
> This is probably the easiest way to get all the open source stuff you want on 
> your Mac and I use it a lot. Another popular and more lightweight package 
> manager is homebrew, which relies more on the system libraries from Apple.
> 
> The minimal installation instructions without a package manager seem to be 
> these: 
> https://github.com/rueckstiess/mtools/wiki/matplotlib-Installation-Guide If 
> you're a real unix hacker, you can install everything from source. I did that 
> before, and it takes a lot of time and in-depth knowledge. 
> 
> Finally, there are several pre-packaged distributions like 
> https://www.enthought.com or  https://store.continuum.io/cshop/anaconda/ (see 
> http://penandpants.com/install-python/). They might come with a normal OSX 
> installer. Maybe https://code.google.com/p/spyderlib/ does the trick for you? 
> 
> Anyway, these are just some suggestions. Maybe you want to start a separate 
> thread on the mailing list about the best way to install matplotlib on a mac. 
> Please note that I cannot comment in detail on any of the installation 
> methods that I didn't use myself.
> 
> 
> 
> 
> Am 13.03.2014 um 17:36 schrieb Christophe Bal :
> 
>> I've tested a more simpler Python code.
>> 
>> from pylab import *
>> plot([1,2,3])
>> show()
>> 
>> This gives me a scary backend MacOSX version unknown. I've used the official 
>> DMG installer matplotlib-1.3.1-py3.3-python.org-macosx10.6.dmg. 
>> 
>> This seems to be a big problem. No ?
>> 
>> 
>> $HOME=/Users/
>> matplotlib data path 
>> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib/mpl-data
>> loaded rc file 
>> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib/mpl-data/matplotlibrc
>> matplotlib version 1.3.1
>> verbose.level helpful
>> interactive is False
>> platform is darwin
>> CACHEDIR=/Users//.matplotlib
>> Using fontManager instance from /Users//.matplotlib/fontList.py3k.cache
>> backend MacOSX version unknown
>> 
>> 
>> 2014-03-13 17:31 GMT+01:00 Felix Patzelt :
>> Well, there is a list in ~/.matplotlib/matplotlibrc (see 
>> http://matplotlib.org/users/customizing.html)
>> 
>>>  CONFIGURATION BEGINS HERE
>>> 
>>> # the default backend; one of GTK GTKAgg GTKCairo CocoaAgg FltkAgg
>>> # MacOSX QtAgg Qt4Agg TkAgg WX WXAgg Agg Cairo GDK PS PDF SVG Template
>>> # You can also deploy your own backend outside of matplotlib by
>>> # referring to the module name (which must be in the PYTHONPATH) as
>>> # 'module://my_backend'
>>> backend  : Qt4Agg
>> 
>> see also: 
>> http://stackoverflow.com/questions/5091993/list-of-all-available-matplotlib-backends
>> 
>> I'm not sure about the dependencies, I guess you have to check out each one 
>> of them. If you don't use a package manager, resolving all dependency issues 
>> might be quite painful.
>> 
>> Best,
>> Felix Patzelt
>> 
>> Am 13.03.2014 um 17:18 schrieb Christophe Bal :
>> 
>>> Thanks a lot for this big hint but neither TkAgg works nor Qt4Agg can work 
>>> (because I do not have PyQt). 
>>> 
>>> Is there a complete list of all the backends ?
>>> 
>>> Christophe BAL
>>> 
>> 
>> 
> 
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaime

Re: [Matplotlib-users] Example showing differences between Mac O$ and Windows use

2014-03-13 Thread Felix Patzelt
Are you sure that you want to use Python 3.3 on OSX 10.6??? Do you really still 
use 10.6? Do you want Python 3? I'm not sure on the current status, but many 
projects took quite a while to get ported over from Python 2. Furthermore, as 
often with free software, installation can be a bit tricky. It is certainly a 
very different experience than installing "normal" Mac applications. 

For a bit of context, most Linux distribution have some version of Python / 
Matplotlib in their respective package managers. These are easily installed if 
the particular package manager on your Linux offers the versions you want. 
Otherwise, you will have to do some work. 

OSX does not have an official package manager, but there are several inofficial 
options. I'm using http://www.macports.org which is slow because it installs 
its own private versions for everything, but it works very well. This is 
probably the easiest way to get all the open source stuff you want on your Mac 
and I use it a lot. Another popular and more lightweight package manager is 
homebrew, which relies more on the system libraries from Apple.

The minimal installation instructions without a package manager seem to be 
these: https://github.com/rueckstiess/mtools/wiki/matplotlib-Installation-Guide 
If you're a real unix hacker, you can install everything from source. I did 
that before, and it takes a lot of time and in-depth knowledge. 

Finally, there are several pre-packaged distributions like 
https://www.enthought.com or  https://store.continuum.io/cshop/anaconda/ (see 
http://penandpants.com/install-python/). They might come with a normal OSX 
installer. Maybe https://code.google.com/p/spyderlib/ does the trick for you? 

Anyway, these are just some suggestions. Maybe you want to start a separate 
thread on the mailing list about the best way to install matplotlib on a mac. 
Please note that I cannot comment in detail on any of the installation methods 
that I didn't use myself.




Am 13.03.2014 um 17:36 schrieb Christophe Bal :

> I've tested a more simpler Python code.
> 
> from pylab import *
> plot([1,2,3])
> show()
> 
> This gives me a scary backend MacOSX version unknown. I've used the official 
> DMG installer matplotlib-1.3.1-py3.3-python.org-macosx10.6.dmg. 
> 
> This seems to be a big problem. No ?
> 
> 
> $HOME=/Users/
> matplotlib data path 
> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib/mpl-data
> loaded rc file 
> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib/mpl-data/matplotlibrc
> matplotlib version 1.3.1
> verbose.level helpful
> interactive is False
> platform is darwin
> CACHEDIR=/Users//.matplotlib
> Using fontManager instance from /Users//.matplotlib/fontList.py3k.cache
> backend MacOSX version unknown
> 
> 
> 2014-03-13 17:31 GMT+01:00 Felix Patzelt :
> Well, there is a list in ~/.matplotlib/matplotlibrc (see 
> http://matplotlib.org/users/customizing.html)
> 
>>  CONFIGURATION BEGINS HERE
>> 
>> # the default backend; one of GTK GTKAgg GTKCairo CocoaAgg FltkAgg
>> # MacOSX QtAgg Qt4Agg TkAgg WX WXAgg Agg Cairo GDK PS PDF SVG Template
>> # You can also deploy your own backend outside of matplotlib by
>> # referring to the module name (which must be in the PYTHONPATH) as
>> # 'module://my_backend'
>> backend  : Qt4Agg
> 
> see also: 
> http://stackoverflow.com/questions/5091993/list-of-all-available-matplotlib-backends
> 
> I'm not sure about the dependencies, I guess you have to check out each one 
> of them. If you don't use a package manager, resolving all dependency issues 
> might be quite painful.
> 
> Best,
> Felix Patzelt
> 
> Am 13.03.2014 um 17:18 schrieb Christophe Bal :
> 
>> Thanks a lot for this big hint but neither TkAgg works nor Qt4Agg can work 
>> (because I do not have PyQt). 
>> 
>> Is there a complete list of all the backends ?
>> 
>> Christophe BAL
>> 
> 
> 

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Example showing differences between Mac O$ and Windows use

2014-03-13 Thread Felix Patzelt
Well, there is a list in ~/.matplotlib/matplotlibrc (see 
http://matplotlib.org/users/customizing.html)

>  CONFIGURATION BEGINS HERE
> 
> # the default backend; one of GTK GTKAgg GTKCairo CocoaAgg FltkAgg
> # MacOSX QtAgg Qt4Agg TkAgg WX WXAgg Agg Cairo GDK PS PDF SVG Template
> # You can also deploy your own backend outside of matplotlib by
> # referring to the module name (which must be in the PYTHONPATH) as
> # 'module://my_backend'
> backend  : Qt4Agg

see also: 
http://stackoverflow.com/questions/5091993/list-of-all-available-matplotlib-backends

I'm not sure about the dependencies, I guess you have to check out each one of 
them. If you don't use a package manager, resolving all dependency issues might 
be quite painful.

Best,
Felix Patzelt

Am 13.03.2014 um 17:18 schrieb Christophe Bal :

> Thanks a lot for this big hint but neither TkAgg works nor Qt4Agg can work 
> (because I do not have PyQt). 
> 
> Is there a complete list of all the backends ?
> 
> Christophe BAL
> 

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Example showing differences between Mac O$ and Windows use

2014-03-13 Thread Jeroen Hegeman
Oops, you are correct. Copy-paste error. I did actually see the blinking boxes 
with the TkAgg backend.

Jeroen




On 13 Mar 2014, at 16:08, Joe Kington  wrote:

> That should be `matplotlib.use('TkAgg')`, not "Agg". Agg is a non-interactive 
> backend, while TkAgg is an interactive Tkinter wrapper around the Agg backend.
> 
> 
> On Thu, Mar 13, 2014 at 9:53 AM, Jeroen Hegeman  
> wrote:
> Hi Christophe,
> 
> This is (I think) a known limitation of the OS X backend. One way around this 
> is to use another backend. Which backends are available depends on how your 
> matplotlib was built. (And unfortunately I don’t know how to figure out which 
> ones are available, apart from trying.) In my case (matplotlib from homebrew 
> on OS X 10.9.2) the TkAgg backend works.
> 
> To use the TkAgg backend insert these two lines:
>  import matplotlib
>  matplotlib.use('Agg’)
> before the line
>  import matplotlib.pyplot as plt
> 
> I hope that helps.
> 
> Best regards,
> Jeroen
> 
> 
> On 13 Mar 2014, at 15:33, Christophe Bal  wrote:
> 
> > Hello,
> > I'm a little disappointed by the following test program coming from this 
> > post.
> >
> > What are the technical reasons that make fail the following code under Mac 
> > O$ ?
> >
> > Best regards.
> > Christophe BAL
> >
> >  TEST ---
> >
> > from random import randint,
> > choice
> >
> > import
> > time
> >
> > import matplotlib.pyplot as
> > plt
> >
> > import matplotlib.patches as
> > mpatches
> >
> > back_color
> > = "black"
> >
> > colors
> > = ['red', 'green', 'cyan', 'yellow']
> >
> > width
> > , height = 16, 16
> >
> >
> > fig
> > , ax = plt.subplots()
> >
> > ax
> > .set(xlim=[0, width], ylim=[0, height]) # Or use "ax.axis([x0,x1,y0,y1])"
> >
> >
> >
> > # Be sure to draw the canvas once before we start blitting. Otherwise
> > # a) the renderer doesn't exist yet, and b) there's noting to blit onto
> >
> > fig
> > .canvas.draw()
> >
> >
> >
> > def update():
> >
> >x
> > = randint(0, width - 1)
> >
> >y
> > = randint(0, height - 1)
> >
> >
> >rect
> > = mpatches.Rectangle(
> >
> >
> > (x, y), 1, 1,
> >
> >facecolor
> > = choice(colors),
> >
> >edgecolor
> > =
> > back_color
> >
> > )
> >
> >ax
> > .add_artist(rect)
> >
> >
> >start
> > = time.time()
> >
> >ax
> > .draw_artist(rect)
> >
> >fig
> > .canvas.blit(ax.bbox)
> >
> >
> > print("draw >>>", time.time() - start)
> >
> >
> > timer
> > = fig.canvas.new_timer(interval=1)
> >
> > timer
> > .add_callback(update)
> >
> > timer
> > .start()
> >
> >
> > plt
> > .show()
> > --
> > Learn Graph Databases - Download FREE O'Reilly Book
> > "Graph Databases" is the definitive new guide to graph databases and their
> > applications. Written by three acclaimed leaders in the field,
> > this first edition is now available. Download your free book today!
> > http://p.sf.net/sfu/13534_NeoTech___
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 

-- 

Jeroen Hegeman
jeroen DOT hegeman AT gmail DOT com

WARNING: This message may contain classified information. Immediately burn this 
message after reading.





--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Example showing differences between Mac O$ and Windows use

2014-03-13 Thread Felix Patzelt
Jeroen seems to be right. The example runs fine in on my Mac when using the 
Qt4Agg backend (which is the default in my matplotlibrc file), but crashes when 
switching to the MacOSX backend. Tested on OS X 10.8.5., Matplotlib from 
MacPorts.

Best,
Felix

Am 13.03.2014 um 15:53 schrieb Jeroen Hegeman :

> Hi Christophe,
> 
> This is (I think) a known limitation of the OS X backend. One way around this 
> is to use another backend. Which backends are available depends on how your 
> matplotlib was built. (And unfortunately I don’t know how to figure out which 
> ones are available, apart from trying.) In my case (matplotlib from homebrew 
> on OS X 10.9.2) the TkAgg backend works.
> 
> To use the TkAgg backend insert these two lines:
> import matplotlib
> matplotlib.use('Agg’)
> before the line
> import matplotlib.pyplot as plt
> 
> I hope that helps.
> 
> Best regards,
> Jeroen
> 
> 
> On 13 Mar 2014, at 15:33, Christophe Bal  wrote:
> 
>> Hello,
>> I'm a little disappointed by the following test program coming from this 
>> post.
>> 
>> What are the technical reasons that make fail the following code under Mac 
>> O$ ?
>> 
>> Best regards.
>> Christophe BAL
>> 
>>  TEST ---
>> 
>> from random import randint,
>> choice
>> 
>> import
>> time
>> 
>> import matplotlib.pyplot as
>> plt
>> 
>> import matplotlib.patches as
>> mpatches
>> 
>> back_color 
>> = "black"
>> 
>> colors 
>> = ['red', 'green', 'cyan', 'yellow']
>> 
>> width
>> , height = 16, 16
>> 
>> 
>> fig
>> , ax = plt.subplots()
>> 
>> ax
>> .set(xlim=[0, width], ylim=[0, height]) # Or use "ax.axis([x0,x1,y0,y1])"
>> 
>> 
>> 
>> # Be sure to draw the canvas once before we start blitting. Otherwise
>> # a) the renderer doesn't exist yet, and b) there's noting to blit onto
>> 
>> fig
>> .canvas.draw()
>> 
>> 
>> 
>> def update():
>> 
>>   x 
>> = randint(0, width - 1)
>> 
>>   y 
>> = randint(0, height - 1)
>> 
>> 
>>   rect 
>> = mpatches.Rectangle(
>> 
>> 
>> (x, y), 1, 1,
>> 
>>   facecolor 
>> = choice(colors),
>> 
>>   edgecolor 
>> =
>> back_color
>> 
>> )
>> 
>>   ax
>> .add_artist(rect)
>> 
>> 
>>   start 
>> = time.time()
>> 
>>   ax
>> .draw_artist(rect)
>> 
>>   fig
>> .canvas.blit(ax.bbox)
>> 
>> 
>> print("draw >>>", time.time() - start)
>> 
>> 
>> timer 
>> = fig.canvas.new_timer(interval=1)
>> 
>> timer
>> .add_callback(update)
>> 
>> timer
>> .start()
>> 
>> 
>> plt
>> .show()
>> --
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and their
>> applications. Written by three acclaimed leaders in the field,
>> this first edition is now available. Download your free book today!
>> http://p.sf.net/sfu/13534_NeoTech___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Example showing differences between Mac O$ and Windows use

2014-03-13 Thread Joe Kington
That should be `matplotlib.use('TkAgg')`, not "Agg". Agg is a
non-interactive backend, while TkAgg is an interactive Tkinter wrapper
around the Agg backend.


On Thu, Mar 13, 2014 at 9:53 AM, Jeroen Hegeman wrote:

> Hi Christophe,
>
> This is (I think) a known limitation of the OS X backend. One way around
> this is to use another backend. Which backends are available depends on how
> your matplotlib was built. (And unfortunately I don't know how to figure
> out which ones are available, apart from trying.) In my case (matplotlib
> from homebrew on OS X 10.9.2) the TkAgg backend works.
>
> To use the TkAgg backend insert these two lines:
>  import matplotlib
>  matplotlib.use('Agg')
> before the line
>  import matplotlib.pyplot as plt
>
> I hope that helps.
>
> Best regards,
> Jeroen
>
>
> On 13 Mar 2014, at 15:33, Christophe Bal  wrote:
>
> > Hello,
> > I'm a little disappointed by the following test program coming from this
> post.
> >
> > What are the technical reasons that make fail the following code under
> Mac O$ ?
> >
> > Best regards.
> > Christophe BAL
> >
> >  TEST ---
> >
> > from random import randint,
> > choice
> >
> > import
> > time
> >
> > import matplotlib.pyplot as
> > plt
> >
> > import matplotlib.patches as
> > mpatches
> >
> > back_color
> > = "black"
> >
> > colors
> > = ['red', 'green', 'cyan', 'yellow']
> >
> > width
> > , height = 16, 16
> >
> >
> > fig
> > , ax = plt.subplots()
> >
> > ax
> > .set(xlim=[0, width], ylim=[0, height]) # Or use "ax.axis([x0,x1,y0,y1])"
> >
> >
> >
> > # Be sure to draw the canvas once before we start blitting. Otherwise
> > # a) the renderer doesn't exist yet, and b) there's noting to blit onto
> >
> > fig
> > .canvas.draw()
> >
> >
> >
> > def update():
> >
> >x
> > = randint(0, width - 1)
> >
> >y
> > = randint(0, height - 1)
> >
> >
> >rect
> > = mpatches.Rectangle(
> >
> >
> > (x, y), 1, 1,
> >
> >facecolor
> > = choice(colors),
> >
> >edgecolor
> > =
> > back_color
> >
> > )
> >
> >ax
> > .add_artist(rect)
> >
> >
> >start
> > = time.time()
> >
> >ax
> > .draw_artist(rect)
> >
> >fig
> > .canvas.blit(ax.bbox)
> >
> >
> > print("draw >>>", time.time() - start)
> >
> >
> > timer
> > = fig.canvas.new_timer(interval=1)
> >
> > timer
> > .add_callback(update)
> >
> > timer
> > .start()
> >
> >
> > plt
> > .show()
> >
> --
> > Learn Graph Databases - Download FREE O'Reilly Book
> > "Graph Databases" is the definitive new guide to graph databases and
> their
> > applications. Written by three acclaimed leaders in the field,
> > this first edition is now available. Download your free book today!
> >
> http://p.sf.net/sfu/13534_NeoTech___
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Example showing differences between Mac O$ and Windows use

2014-03-13 Thread Jeroen Hegeman
Hi Christophe,

This is (I think) a known limitation of the OS X backend. One way around this 
is to use another backend. Which backends are available depends on how your 
matplotlib was built. (And unfortunately I don’t know how to figure out which 
ones are available, apart from trying.) In my case (matplotlib from homebrew on 
OS X 10.9.2) the TkAgg backend works.

To use the TkAgg backend insert these two lines:
 import matplotlib
 matplotlib.use('Agg’)
before the line
 import matplotlib.pyplot as plt

I hope that helps.

Best regards,
Jeroen


On 13 Mar 2014, at 15:33, Christophe Bal  wrote:

> Hello,
> I'm a little disappointed by the following test program coming from this post.
> 
> What are the technical reasons that make fail the following code under Mac O$ 
> ?
> 
> Best regards.
> Christophe BAL
> 
>  TEST ---
> 
> from random import randint,
> choice
> 
> import
> time
> 
> import matplotlib.pyplot as
> plt
> 
> import matplotlib.patches as
> mpatches
> 
> back_color 
> = "black"
> 
> colors 
> = ['red', 'green', 'cyan', 'yellow']
> 
> width
> , height = 16, 16
> 
> 
> fig
> , ax = plt.subplots()
> 
> ax
> .set(xlim=[0, width], ylim=[0, height]) # Or use "ax.axis([x0,x1,y0,y1])"
> 
> 
> 
> # Be sure to draw the canvas once before we start blitting. Otherwise
> # a) the renderer doesn't exist yet, and b) there's noting to blit onto
> 
> fig
> .canvas.draw()
> 
> 
> 
> def update():
> 
>x 
> = randint(0, width - 1)
> 
>y 
> = randint(0, height - 1)
> 
> 
>rect 
> = mpatches.Rectangle(
> 
> 
> (x, y), 1, 1,
> 
>facecolor 
> = choice(colors),
> 
>edgecolor 
> =
> back_color
> 
> )
> 
>ax
> .add_artist(rect)
> 
> 
>start 
> = time.time()
> 
>ax
> .draw_artist(rect)
> 
>fig
> .canvas.blit(ax.bbox)
> 
> 
> print("draw >>>", time.time() - start)
> 
> 
> timer 
> = fig.canvas.new_timer(interval=1)
> 
> timer
> .add_callback(update)
> 
> timer
> .start()
> 
> 
> plt
> .show()
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Example showing differences between Mac O$ and Windows use

2014-03-13 Thread Christophe Bal
Hello,
I'm a little disappointed by the following test program coming from this
post .

What are the technical reasons that make fail the following code under Mac
O$ ?

Best regards.
Christophe BAL

 TEST ---

from random import randint, choiceimport timeimport matplotlib.pyplot
as pltimport matplotlib.patches as mpatches

back_color = "black"
colors = ['red', 'green', 'cyan', 'yellow']
width, height = 16, 16

fig, ax = plt.subplots()
ax.set(xlim=[0, width], ylim=[0, height]) # Or use "ax.axis([x0,x1,y0,y1])"
# Be sure to draw the canvas once before we start blitting. Otherwise#
a) the renderer doesn't exist yet, and b) there's noting to blit onto
fig.canvas.draw()
def update():
x = randint(0, width - 1)
y = randint(0, height - 1)

rect = mpatches.Rectangle(
(x, y), 1, 1,
facecolor = choice(colors),
edgecolor = back_color
)
ax.add_artist(rect)

start = time.time()
ax.draw_artist(rect)
fig.canvas.blit(ax.bbox)
print("draw >>>", time.time() - start)

timer = fig.canvas.new_timer(interval=1)
timer.add_callback(update)
timer.start()

plt.show()
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users