[Matplotlib-users] Compiler error on OS X 10.5.2 in agg

2008-03-09 Thread Zachary Pincus
Hello,

I just tried to compile the SVN head of matplotlib (r4994) from source  
on OS X 10.5.2 (with source builds of python 2.5.2 and the SVN head of  
numpy), and ran into an "internal compiler error" in the agg code.  
(pkgconfig 0.23 and wxPython 2.8.7.1 also present and accounted for.)

Here's the compile line and error:
> building 'matplotlib.backends._backend_agg' extension
> gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused- 
> madd -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict- 
> prototypes -I/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> python2.5/site-packages/numpy/core/include -I/usr/X11/include/ 
> libpng12 -I/usr/local/include -I/usr/include -I/usr/X11R6/include - 
> I. -I/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ 
> site-packages/numpy/core/include -Isrc -Iagg24/include -I. -I/usr/ 
> X11/include/freetype2 -I/usr/X11/include -I/usr/local/include -I/usr/ 
> include -I/usr/X11R6/include -I. -I/Library/Frameworks/ 
> Python.framework/Versions/2.5/include/python2.5 -c src/_image.cpp -o  
> build/temp.macosx-10.4-i386-2.5/src/_image.o
> cc1plus: warning: command line option "-Wstrict-prototypes" is valid  
> for C/ObjC but not for C++
> src/_image.cpp: In member function ‘Py::Object  
> _image_module::from_images(const Py::Tuple&)’:
> src/_image.cpp:842: error: insn does not satisfy its constraints:
> (insn 2573 1070 2574 126 agg24/include/agg_color_rgba.h:268 (set  
> (mem:QI (plus:SI (reg/f:SI 6 bp)
>(const_int -280 [0xfee8])) [0 SR.2969+0  
> S1 A8])
>(reg:QI 5 di)) 56 {*movqi_1} (nil)
>(nil))
> src/_image.cpp:842: internal compiler error: in  
> reload_cse_simplify_operands, at postreload.c:391
> Please submit a full bug report, with preprocessed source if  
> appropriate.
> See http://developer.apple.com/bugreporter> for instructions.

This seems to be an agg and OS X error; it's cropped up here:
http://trac.osgeo.org/mapserver/ticket/2368
and John Hunter reported it on the agg list here:
http://article.gmane.org/gmane.comp.graphics.agg/3963

Unfortunately, the error appears to either not have been fixed by the  
10.5.1 update, as suggested in the email thread cited above, or the  
error re-appeared in 10.5.2.

Changing the optimization flag from -O3 to -Os and compiling  
_image.cpp manually (along with copying src/_image.cpp to src/ 
image.cpp and compiling that manually in the same way) allowed me to  
finish building matplotlib, but clearly an optimized agg image library  
is pretty important... (-O2 didn't work...)

Anyone have any idea at all about this error? Or is just turning off - 
O3 for this file the best thing to do until Apple fixes the compiler  
bug? Does anyone who knows more about agg than I want to try to reduce  
this to a test case?


Zach Pincus

Postdoctoral Fellow
Molecular, Cellular, and Developmental Biology
Yale University


-
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] colorbar problem

2008-03-09 Thread Eric Firing
[EMAIL PROTECTED] wrote:
>   Hello,
> 
> I have some stupid questions about how to use colorbar.
> 
> 1) I would like to be able to put the colorbar where I went: top, bottom, 
> left, right. For what I see I can do only a vertical left and horizontal 
> bottom ones (with a simple use of the function).
> I know that it's possible to do a colorbar only but it's difficult to place 
> them a little bit automatically and that bring my second question.

This looks like a feature request: instead of specifying "horizontal" or 
"vertical", be able to specify "top", "bottom", "left", or "right". 
This is fairly easy in principle, but there are some wrinkles such that 
I am not sure it would be satisfactory in practice--some custom 
adjustments might usually be needed depending on whether the main axes 
have a title (in the case of "top") or an xlabel (in the case of 
"left").  You may be better off simply figuring out what main and 
colorbar axes positions work best for your particular case and then 
making those axes explicitly.

> 
> 2) I would like that the colorbar with exactly the same size than the image I 
> plot with pcolor. It's working when I'm not using the aspect='equal' in the 
> subplot but not with this option. Naturally I want to not change the aspect 
> of my image and so it's a big problem for me. The only solution I found is to 
> manipulate the colorbar with the shrink valu but it's a little bit painfull 
> especially the value change for each pcolor image (they doesn't have always 
> the same size).

This is a common request, and a reasonable one, but unfortunately it is 
not straightforward to implement automatically given mpl's internal 
structure.  Again, however, you get the desired result quite easily by 
creating your own axes explicitly.

> 
> 3) I would like to give a label to the colorbar (ie if the colorbar is at the 
> bottom a label under the colorbar etc). To tell people what means the colors 
> but I didn't find anyway to do it. xlabel work for the pcolor object (as 
> expected) and there are no colorbar.xlabel function.

Use the set_label() method.
...
cbar = fig1.colorbar(im,orientation='horizontal')
cbar.set_label('label')
...

Eric

-
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


[Matplotlib-users] colorbar problem

2008-03-09 Thread humufr
Hello,

I have some stupid questions about how to use colorbar.

1) I would like to be able to put the colorbar where I went: top, bottom, 
left, right. For what I see I can do only a vertical left and horizontal 
bottom ones (with a simple use of the function).
I know that it's possible to do a colorbar only but it's difficult to place 
them a little bit automatically and that bring my second question.

2) I would like that the colorbar with exactly the same size than the image I 
plot with pcolor. It's working when I'm not using the aspect='equal' in the 
subplot but not with this option. Naturally I want to not change the aspect 
of my image and so it's a big problem for me. The only solution I found is to 
manipulate the colorbar with the shrink valu but it's a little bit painfull 
especially the value change for each pcolor image (they doesn't have always 
the same size).

3) I would like to give a label to the colorbar (ie if the colorbar is at the 
bottom a label under the colorbar etc). To tell people what means the colors 
but I didn't find anyway to do it. xlabel work for the pcolor object (as 
expected) and there are no colorbar.xlabel function.

Thank you for any help.

N.

ps: i join a simple script to show my problem

#!/usr/bin/env python

import pylab
import numpy

a = numpy.arange(100).reshape((10,10))

fig1 = pylab.figure()

ax = fig1.add_subplot(141)
im = ax.pcolor(a)
fig1.colorbar(im,orientation='horizontal') 
pylab.xlabel('label')

ax = fig1.add_subplot(142)
im = ax.pcolor(a)
fig1.colorbar(im,orientation='vertical')
pylab.xlabel('label')

ax = fig1.add_subplot(143,aspect='equal')
im = ax.pcolor(a)
fig1.colorbar(im,orientation='vertical')
pylab.xlabel('label')

ax = fig1.add_subplot(144,aspect='equal')
im = ax.pcolor(a)
fig1.colorbar(im,orientation='horizontal')
pylab.xlabel('label')


pylab.show()


-
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] wx backend scaling problem

2008-03-09 Thread Gary Ruben

Gary Ruben wrote:

The attached test.py

Oops. Here it is.
Gary R.
import matplotlib as mpl
#~ mpl.use('PDF')
#~ mpl.use('Agg')
#~ mpl.use('TkAgg')
mpl.use('WXAgg')
#~ mpl.use('SVG')
#~ mpl.use('PS')
from pylab import *

pts = 128
rcFig = {'figsize': (2,1),
 'dpi': pts,
 'subplot.hspace': 0.0,
 'subplot.wspace': 0.0,
 'subplot.bottom': 0.0,
 'subplot.left':   0.0,
 'subplot.right':  1.0,
 'subplot.top':1.0,
 }
rc('figure', **rcFig)

subplot(121)
axis('off')
imshow(rand(pts,pts))

subplot(122)
axis('off')
imshow(tri(pts))

savefig('test',dpi=pts)
-
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