I have a very weird problem with matplotlib and reals. Before starting to
explain please let me apologize, I'm a newbie in Python and I suspect I'm
doing something horribly wrong.
I have exposed in Python a C++ class with Boost::Python (in the form of a
shared object). This class (among other things) reads from a file a list of
real numbers, and stores them internally as doubles.
What happens is that when using matplotlib my exposed class internally begins
to treat reals like they were integers. In other words, when reading reals
from a file they are stored as integers, as can be seen by printing the
contents of the class to screen: all decimal parts are truncated (i.e.,
3.85000E5 instead of 3.8500052719E5). This is _not_ some kind of
visualization bug, since my class discards reals whose absolute value is
(almost) zero and indeed when using matplotlib the class loads fewer "reals"
from the very same file (in other words, values whose abs is < 1 are seen as
zeroes and as such they get discarded: all reals whose abs is < 1 are missing
when using matplotlib).
This is extremely strange to me, since I really don't get how matplotlib can
influence the internal behaviour of my class. Is there somewhere some
directive in python that can setup the floating point unit?
The "bug" happens exactly after loading matplotlib, without it everything is
alright. The C++ code from which the class derives has been tested quite
thoroughly, so I don't think the problem stems from there.
Any pointer would be greatly appreciated :) Thanks very much,
Francesco (please CC as I'm not subscribed)
Thanks for your responses, David and Bill.
I'm quite busy at the moment to go into detail in this, but strangely enough
when I changed the backend from the default (GTK(Agg?) - I'm on linux) to
QtAgg the bug disappeared.
I think too that there could be an issue with numpy, so I just recompiled the
whole python-numpy-mpl toolchain using the latest versions of everything
available. I'll test ASAP if the problem under GTK persists, and then I'll