[Matplotlib-users] How to set axis limits with text objects ?

2010-11-07 Thread LB
Hi,

I'm trying to draw a bar chart according to
http://matplotlib.sourceforge.net/examples/api/barchart_demo.html, and I'm
having to difficulties :

 - when the first bar has a zero height, it is no taken into account during
the axis limits calculation and is not visible

 - texts objects can exceed chart area and collide with the chart title.

Is there a way to calculate the axis limit to use to include all texts
objects into the chart area ?

Here is the code I used :

[code]
#!/usr/bin/env python

import numpy as np
import matplotlib.pyplot as plt

menMeans = [0.,   998.,  1210.,  1449.   ,
1496.,  1493.,  1593.40002441,  1517.5   ]

ind = np.arange(len(menMeans))  # the x locations for the groups
width = 0.8# the width of the bars

fig = plt.figure()
ax = fig.add_subplot(111)
rects1 = ax.bar(ind, menMeans, width, color='r')

# add some
ax.set_ylabel('Scores')
ax.set_title('A very very long title for testing.')

def autolabel(rects):
# attach some text labels
for rect in rects:
height = rect.get_height()
ax.text(rect.get_x()+rect.get_width()/2., 1.05*height,
'%d'%int(height),
ha='center', va='bottom')

autolabel(rects1)

plt.show()
[/code]

Best regards,

-- 
LB
--
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Need help with a local install of matplotlib under Linux

2010-02-26 Thread LB
Hi,

I would like to make a local install of matplotlib under Linux, but I've got
2 problems :

1)  I didn't find how to setup the build to use the PGI C compiler.
I tried python setup buil --help-compiler but there seems to be no
preconfigured options for this compiler, and the default doesn't work (see
log2, below)
How should I configure this ?

2) I have a problem with the configuration of gtk dependencies.
Theses dependencies are also locally installed and the setup.py script
didn't find them (see log1 below)
But, the strange thing is that, if I modify the setup.py script and add
"import gtk" on the top of it, the configuration seems to run nicely (see
log2).
Indded, it seems that "import gtk" works in setup.py but doesn't in
setupext.py, which is very weird to me

Have you got any ideas on how to solve this ?

[ log1 ]
> python setup.py build

BUILDING MATPLOTLIB
matplotlib: 0.98.0
python: 2.5.2 |EPD Py25 4.1.30101| (r252:60911, Dec 19 2008,
17:15:55)  [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)]
  platform: linux2

REQUIRED DEPENDENCIES
 numpy: 1.1.1
 freetype2: 9.10.3

OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.10
   Tkinter: no
* Using default library and include directories for
* Tcl and Tk because a Tk window failed to open.
* You may need to define DISPLAY for Tk to work so
* that setup can determine where your libraries are
* located. Tkinter present, but header files are not
* found. You may need to install development
* packages.
  wxPython: 2.8.7.1
* WxAgg extension not required for wxPython >= 2.8
  Gtk+: no
* Building for Gtk+ requires pygtk; you must be able
* to "import gtk" in your build/install environment
Qt: no
   Qt4: no
 Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
  datetime: present, version unknown
  dateutil: 1.4
  pytz: 2008c

OPTIONAL USETEX DEPENDENCIES
dvipng: 1.5
   ghostscript: 8.15.2
 latex: 3.141592

EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES
 configobj: 4.5.3
  enthought.traits: 3.0.3

[Edit setup.cfg to suppress the above messages]

[/log1]



[log2]
> python setup.py build

BUILDING MATPLOTLIB
matplotlib: 0.98.0
python: 2.5.2 |EPD Py25 4.1.30101| (r252:60911, Dec 19 2008,
17:15:55)  [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)]
  platform: linux2

REQUIRED DEPENDENCIES
 numpy: 1.1.1
 freetype2: 9.10.3

OPTIONAL BACKEND DEPENDENCIES
libpng: 1.2.10
   Tkinter: no
* Using default library and include directories for
* Tcl and Tk because a Tk window failed to open.
* You may need to define DISPLAY for Tk to work so
* that setup can determine where your libraries are
* located. Tkinter present, but header files are not
* found. You may need to install development
* packages.
  wxPython: 2.8.7.1
* WxAgg extension not required for wxPython >= 2.8
  Gtk+: gtk+: 2.10.14, glib: 2.22.4, pygtk: 2.10.6,
pygobject: 2.12.3
Qt: no
   Qt4: no
 Cairo: 1.4.0

OPTIONAL DATE/TIMEZONE DEPENDENCIES
  datetime: present, version unknown
  dateutil: 1.4
  pytz: 2008c

OPTIONAL USETEX DEPENDENCIES
dvipng: 1.5
   ghostscript: 8.15.2
 latex: 3.141592

EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES
 configobj: 4.5.3
  enthought.traits: 3.0.3

[Edit setup.cfg to suppress the above messages]

running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc ->
build/lib.linux-x86_64-2.5/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf ->
build/lib.linux-x86_64-2.5/matplotlib/mpl-data
running build_ext
building 'matplotlib.ft2font' extension
pgcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
-fPIC -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I.
-I/OutilsGroupe/EPD/include/python2.5 -c src/ft2font.cpp -o
build/temp.linux-x8

Re: [Matplotlib-users] how to customize informations given by the navigation toolbar ?

2009-10-16 Thread LB
Seems that the following lines did the trick with matplotlib  0.91.2

   xy_pixel = self.a3.transData.xy_tup((x3,y3))
   x1, y1 = self.a1.transData.inverse_xy_tup(xy_pixel)

Thanks

2009/10/16 LB 

> It would be very fine to me, but unfortunately, I have to use matplotlib
> 0.91.2.
> Is there a way to adapt this to the old transform API ?
>
> Thanks
>
> --
> LB
>
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to customize informations given by the navigation toolbar ?

2009-10-16 Thread LB
It would be very fine to me, but unfortunately, I have to use matplotlib
0.91.2.
Is there a way to adapt this to the old transform API ?

Thanks

-- 
LB
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] how to customize informations given by the navigation toolbar ?

2009-10-15 Thread LB
   Hi,


I'm using the twiny fonction to plot two functions on the same axes.
I would like to have both informations displayed on the navigation bar.
Now, I have :
  pan/zoom : x=220, y=80

Is-it possible to customize the toolbar in order to have
  pan/zoom : x1=220, x2=300, y=80


-- 
LB
--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Missing files on the web documentation

2009-06-26 Thread LB
Hi,

The documentation presented on http://matplotlib.sourceforge.net/examples is
a very good source of information but on some pages it doesn't give all the
data needed to have the example running.

Indeed, some example needs external files and they are not given in the web
documentation, for example :

http://matplotlib.sourceforge.net/examples/user_interfaces/mpl_with_glade.html
needs   "mpl_with_glade.glade"
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx3.html
needs   "../data/embedding_in_wx3.xrc"

I thing there should be some links on the web pages to download theses
files.
At least, it should be said in the docstring where to find them, don't you
think ?

-- 
LB
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] segfault with Tkagg

2008-02-27 Thread LB
Packing (clientData=0x8c223d0) at
/home/loic/tmp/bluelagoon/src/tk8.5.1/unix/../generic/tkPack.c:820
#45 0xb6a2d483 in TclServiceIdle () at
/home/loic/tmp/bluelagoon/src/tcl8.5.1/unix/../generic/tclTimer.c:738
#46 0xb6a0aa69 in Tcl_DoOneEvent (flags=-3) at
/home/loic/tmp/bluelagoon/src/tcl8.5.1/unix/../generic/tclNotify.c:991
#47 0xb6cd6f1a in Tkapp_MainLoop (selfptr=0x8bc7348, args=0x8256dc4) at
/home/loic/tmp/bluelagoon/src/Python-2.5.2/Modules/_tkinter.c:2547
#48 0xb7df67c1 in PyCFunction_Call (func=0x8b943ec, arg=0x8256dc4, kw=0x0)
at Objects/methodobject.c:73
#49 0xb7e70fb3 in call_function (pp_stack=0xbfe6bb10, oparg=1) at
Python/ceval.c:3573
#50 0xb7e6c1c4 in PyEval_EvalFrameEx (f=0x8de9ffc, throwflag=0) at
Python/ceval.c:2272
#51 0xb7e6e880 in PyEval_EvalCodeEx (co=0x8adda48, globals=0x8ae8ad4,
locals=0x0, args=0x8de9288, argcount=0, kws=0x8de9288, kwcount=0,
defs=0x8b6e4a8, defcount=1, closure=0x0) at Python/ceval.c:2836
#52 0xb7e7154d in fast_function (func=0x8b6f034, pp_stack=0xbfe6c1f0, n=0,
na=0, nk=0) at Python/ceval.c:3669
#53 0xb7e71171 in call_function (pp_stack=0xbfe6c1f0, oparg=0) at
Python/ceval.c:3594
#54 0xb7e6c1c4 in PyEval_EvalFrameEx (f=0x8de913c, throwflag=0) at
Python/ceval.c:2272
#55 0xb7e6e880 in PyEval_EvalCodeEx (co=0x8ac8ce8, globals=0x8a5fdf4,
locals=0x0, args=0x8de9118, argcount=0, kws=0x8de9118, kwcount=0,
defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2836
#56 0xb7e7154d in fast_function (func=0x8bc3084, pp_stack=0xbfe6c8d0, n=0,
na=0, nk=0) at Python/ceval.c:3669
#57 0xb7e71171 in call_function (pp_stack=0xbfe6c8d0, oparg=0) at
Python/ceval.c:3594
#58 0xb7e6c1c4 in PyEval_EvalFrameEx (f=0x8de8fd4, throwflag=0) at
Python/ceval.c:2272
#59 0xb7e6e880 in PyEval_EvalCodeEx (co=0xb7bcc268, globals=0xb7bb9214,
locals=0xb7bb9214, args=0x0, argcount=0, kws=0x0, kwcount=0,
defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2836
#60 0xb7e6352c in PyEval_EvalCode (co=0xb7bcc268, globals=0xb7bb9214,
locals=0xb7bb9214) at Python/ceval.c:494
#61 0xb7e9c10b in run_mod (mod=0x80b80e0, filename=0xb7ee4b33 "",
globals=0xb7bb9214, locals=0xb7bb9214, flags=0xbfe6cc04,
arena=0x80589a8) at Python/pythonrun.c:1273
#62 0xb7e9a621 in PyRun_InteractiveOneFlags (fp=0xb7d1e440,
filename=0xb7ee4b33 "", flags=0xbfe6cc04) at Python/pythonrun.c:792
#63 0xb7e9a24a in PyRun_InteractiveLoopFlags (fp=0xb7d1e440,
filename=0xb7ee4b33 "", flags=0xbfe6cc04) at Python/pythonrun.c:723
#64 0xb7e9a076 in PyRun_AnyFileExFlags (fp=0xb7d1e440, filename=0xb7ee4b33
"", closeit=0, flags=0xbfe6cc04)
at Python/pythonrun.c:692
#65 0xb7eaa63b in Py_Main (argc=1, argv=0xbfe6cd14) at Modules/main.c:523
(gdb)


I'm not used to debugging C code or to cope with segmentation faults.
Do you see anything which could give me a clue for fixing this pb ?


Thanks for the reply,

-- 
LB
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] segfault with Tkagg

2008-02-26 Thread LB
 defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2836
#48 0xb7e9b7c3 in PyEval_EvalCode (co=0xb7c2e5c0, globals=0xb7c18acc,
locals=0xb7c18acc) at Python/ceval.c:494
#49 0xb7ebdf53 in PyRun_InteractiveOneFlags (fp=0xb7d8a440,
filename=0xb7ef36fc "", flags=0xbfd05ad8) at Python/pythonrun.c:1273
#50 0xb7ebe18b in PyRun_InteractiveLoopFlags (fp=0xb7d8a440,
filename=0xb7ef36fc "", flags=0xbfd05ad8) at Python/pythonrun.c:723
#51 0xb7ebe8d7 in PyRun_AnyFileExFlags (fp=0xb7d8a440, filename=0xb7ef36fc
"", closeit=0, flags=0xbfd05ad8)
at Python/pythonrun.c:692
#52 0xb7ec819f in Py_Main (argc=0, argv=0xbfd05ba4) at Modules/main.c:523
#53 0x080485b2 in main (argc=Cannot access memory at address 0x6
) at ./Modules/python.c:23

The local version of Python use the good version of Tcl/Tk.

   =
   TESTING Tkinter
   =
$ wget
http://academic.evergreen.edu/curricular/modelingmotion/ExampleCode/gui/hello2.py
--07:55:32--
http://academic.evergreen.edu/curricular/modelingmotion/ExampleCode/gui/hello2.py
   => `hello2.py.1'
Résolution de academic.evergreen.edu... 192.211.16.13
Connexion vers academic.evergreen.edu|192.211.16.13|:80...connecté.
requête HTTP transmise, en attente de la réponse...200 OK
Longueur: 613 [text/plain]

100%[=>] 613   --.--K/s

07:55:33 (80.95 MB/s) - « hello2.py » sauvegardé [613/613]

$ python2.5 hello2.py

=> works fine.

   ==
   TESTING MATPLOTLIB'MODULES IMPORTATION
   ==
I've seen oin the archive that there could be issue with pycxx and some
version
of gcc, and that trying to import matplotlib submodule could give some
clues  :
(cf.
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg02822.html
)

$ python2.5
Python 2.5.2 (r252:60911, Feb 26 2008, 22:21:12)
[GCC 4.2.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib._image
>>> import matplotlib._transforms
>>> import matplotlib.backends._ns_backend_agg
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named _ns_backend_agg
>>> import matplotlib.backends._tkagg
>>> import matplotlib._agg
>>>
>>>
>>> import matplotlib.backends
>>> dir(matplotlib.backends)
['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__path__',
'_tkagg', 'all_backends', 'backend', 'interactive_bk', 'matplotlib',
'non_interactive_bk', 'pylab_setup', 'sys', 'time']


Did this give you any information ?

   ==
   FINALLY...
   ==

Does anybody has a clue ?
I've tested to install others versions of gcc, tcl/tk or python, but it
didn't solve the problem.
I've tested to make a local installation pycxx-5.4.0, but this didn't work
either.

So, I'm suspecting a prroblem with the fact of making a local installation
of
these programs, but I don't see where.
I've added $INSTALL_DIR/lib to both $LD_LIBRARY_PATH and $LD_RUN_PATH, and
$INSTALL_DIR/bin is the first directory of my $PATH.


-- 
LB
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users