Updating winpython manually, in order to playing with ggplot

777 views
Skip to first unread message

stonebig

unread,
Oct 18, 2013, 3:48:32 PM10/18/13
to winp...@googlegroups.com
Hello all,

ggplot is a wrapper around matplotlib that mimics the way the R "ggplot" graphical module works.
It looks to duplicate "R" excellent "ggplot" graphic module into "matplotlib"
(see : http://blog.yhathq.com/posts/ggplot-for-python.html)


If I understood well, it is based on :
* the gammar of graphic (http://www.cs.uic.edu/~wilkinson/Publications/gpl.pdf)
* written by Leland Wilkinson http://www.cs.uic.edu/~wilkinson/
* and implemented in R by Hadley Wickham ( http://had.co.nz/)

==> I couldn't wait next winpython release to try it.

BUT, it requires the greatest and latest matplolib 1.3.1 (of october 10th, 2013)

==> as there is no new winpython official update since august 22nd, I made the effort to understand how to update myself.
It's dead simple indeed.

** Generic Procedure to update your winpython **
- for windows compiled modules, coming from "http://www.lfd.uci.edu/~gohlke/pythonlibs/" :
   * pick and download the module you want  (choose the version corresponding to your installation : python 2.7 or 3.3, 32bit or 64 bit),
   * launch "WinPython Control Panel.exe"
   * click on "add packages" and select the executable you just downloaded
   * click on the "install package(s)" button.
- for pure python modules :
   * launch "WinPython Command Prompt.exe",
   * type "pip install -U your_module"

** get ggplot procedure example  (you may wait seeing  ggplot version after 0.2.8 on pypi, if you're on python 3) ***
   * download  from "http://www.lfd.uci.edu/~gohlke/pythonlibs" the matplotlib you need
          (for example matplotlib-1.3.1.win32-py3.3.exe)
   * launch "WinPython Control Panel.exe"
   * click on "add packages" and select the executable you just downloaded
   * click on the "install package(s)" button.

   * launch "WinPython Command Prompt.exe",
   *      pip install ggplot
     (or pip install -U ggplot, if you have an older version)

after that, fire up a winpython notebook and try this

**(start of code)************************
from ggplot import *

print (ggplot(aes(x='date', y='beef'), data=meat) + \
    geom_point(alpha=0.3) + \
    stat_smooth(colour="black", se=True))

plt.show(1)
**(end of code) ***********************

It looks it may become much simpler to do program graphics with matplotlib soon.

ggplot_example.JPG

Fernando Saldanha

unread,
Oct 20, 2013, 7:50:48 PM10/20/13
to winp...@googlegroups.com
I followed the instructions below and installed matplotlib 1.3.1 on top of WinPython 3.3.2.3 and now I am getting the following message:

In [6]: import matplotlib
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-6-82be63b7783c> in <module>()
----> 1 import matplotlib

C:\WinPython-64bit-3.3.2.3\python-3.3.2.amd64\lib\site-packages\matplotlib\__init__.py in <module>()
    129 # definitions, so it is safe to import from it here.
    130 from matplotlib.cbook import is_string_like
--> 131 from matplotlib.compat import subprocess
    132 
    133 try:

ImportError: cannot import name subprocess

Can anyone help?

Thanks.

stonebig

unread,
Oct 21, 2013, 4:09:35 PM10/21/13
to winp...@googlegroups.com
Hello,

Did you choose the matplotlib version compatible with your winpython 3.3 amd64 ?  (matplotlib-1.3.1.win-amd64-py3.3.exe)
Indeed, the link in my example was for a x86 (not the amd64 you use)


Reply all
Reply to author
Forward
0 new messages