Re: [Matplotlib-users] How to remove x axis in a subplotted graph

2012-03-15 Thread kususe



On Wed, Mar 14, 2012 at 2:38 PM, kususe kus...@interfree.it wrote:


 I got an error using the first subplot function because I have to specify
 3
 parameters.
 If i do it, I get that AxesSubplot' object is not iterable
 I coded using 3 subplot functions, getting the same error.

 Thanks
 K.


Note that I wrote `subplots` with an s, which is a different command than
`subplot`. (You're really having problems with ss today :)

BTW, would you mind interleaving or bottom-posting
replieshttp://en.wikipedia.org/wiki/Posting_style#Placement_of_replies.
It's a bit easier to follow the conversation that way.

-Tony


Yes, for sure I coded: 

fig, axes = plt.subplot(3,1,1)
ax1, ax2, ax3 = axes
p1, = ax1.plot(self.data0,self.data1)

plt.subplot(3,1,2)
p2, = ax2.plot(self.data0,self.data2)
...
plt.subplot(3,1,3)
p3, = ax3.plot(self.data0,self.data4)

for ax in axes:
ax.set_xticks([])

but I got the error which said you. 
-- 
View this message in context: 
http://old.nabble.com/How-to-remove-x-axis-in-a-subplotted-graph-tp33500598p33507959.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How to remove the black border in a Matplotlib figure

2012-03-15 Thread kususe

Hi folks, 
I'd like to remove the black border which is created when I save the image,
letting just the white background and the graph. 
Is there a solution??
Thanks, 
K.
-- 
View this message in context: 
http://old.nabble.com/How-to-remove-the-black-border-in-a-Matplotlib-figure-tp33508568p33508568.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Figure save hack

2012-03-15 Thread Sebastian Berg
Hey,

last weekend I wrote a hook which can track figure creation. Basically
it takes care of creating the new figure and wraps it to track all
changes to it. Its a hack, and the code is not cleaned up or tested
much, but I like to do scripts that I run with many parameters to create
plots and it works well to allow me to open the figures in a way that I
can zoom, etc. and would allow editing (a bit) later on too. So while I
doubt the approach can be made something serious, and there are probably
things that don't work (right now 3D Axis can be done with a bit extra
but mouse zooming does not work inside a 3D Axis, though I think its
likely not difficult to change), I thought I would put it online because
I am not aware of any way to save matplotlib figures:

https://github.com/seberg/haunter-for-matplotlib-figures

Maybe someone finds it useful or interesting :)

Regards,

Sebastian Berg


--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Bus error related to ft2font on Mac OS X (10.6), gcc-4.2, apparently 0.99 branch related

2012-03-15 Thread Friedrich Romstedt
Hi,

Am 14. November 2011 15:04 schrieb Friedrich Romstedt
friedrichromst...@gmail.com:
 2011/11/14 Michael Droettboom md...@stsci.edu:
 Thanks for all the time you've devoted to this.  It does look like possibly
 some kind of compiler bug.  The font loads and renders fine on Linux, for
 what it's worth (just as a data point).

 To confirm this theory: if you move NISC1803.ttf somewhere temporary, delete
 ~/.matplotlibrc/fontList.cache and then import matplotlib, do you get the
 crash?  That at least confirms that loading this font file triggers the bug
 (wherever the bug may be).  Test with matplotlib 1.1.0 or git master so we
 have a sense of the current behavior.

 Hi Mike,

 the following fonts on my system are offending:

 /Library/Fonts/NISC18030.ttf
 /Library/Fonts/AppleMyungjo.ttf
 /Library/Fonts/Gungseouche.ttf

 With these fonts made unfindable by matplotlib (:file:`*.ttf_`) it
 exits cleanly.

 I will provide with a patch to matplotlib for an rc setting
 fonts.bus-error : ..., e.g. ``fonts.bus-error : NISC18030.ttf,
 AppleMyungjo.ttf, Gungseouche.ttf`` in the next days.

I just took the time to recompile the whole thingy, including
supporting libraries.  I used:

–  libfreetype-2.4.9
–  matplotlib-1.1.0
–  MACOSX_DEPLOYMENT_TARGET=10.5
–  The files noted in the citation above are in place (i.e.,
accessible as .ttf files)

My theory was that a compiler error triggers the error with the font
files in question.  Because recompiling ft2font.so with a different
MACOSX_DEPLOYMENT_TARGET made the crash disappear I supposed that
ft2font would trigger that compiler error.  It needed to be a compiler
error because that environment variable was the only change that made
the crash disappear.  Now it is the question if with more recent
software that error still persists.  I have found that this is not the
case.  I recompiled with the libraries noted above (all compiled from
source), and I can successfully import matplotlib.figure.  This import
previously provoked the crash.  So I believe that either I was wrong
in some respect, or the more recent software toolchain no longer
provokes the crash, because its code changed.  Since it works just
flawlessly on my system now, I see little need to implement the
mechanism for excluding font files from being loaded – if it is not
needed I will not code it.

Friedrich

P.S.: Of course I moved the font cache before, so that it is recreated
when importing matplotlib.figure for the first time.
P.P.S.: One more difference is that the current Python is not a
framework Python anymore, but a regular Python.

 It was clear from the beginning (well, from the point I got a handle
 on it), that loading the font makes the 2009 matplotlib crash.  The
 only question unanswered is where the codepath is that triggers this
 compiler bug (I think the compiler but hypothesis is not disproven and
 works well atm).  If the code path is in ft2font.cpp, we could (you
 could) reformulate ft2font.cpp in an equivalent way with the exception
 that it is not equivalent in crashing.  You might want to augment
 ft2font.cpp by printf() or something to see if the crash appears
 inside a call to libfreetype or if all those calls return cleanly.

 To my understanding, since recompiling ft2font.so without
 MACOSX_DEPLOYMENT_TARGET different from 10.6 helps, ft2font.cpp should
 be the culprit resp. victim.  The only alternative I'm seeing would be
 that it has to to do with the load mechanism of the dylib, but I deem
 this rather unlikely.  Well, unlikely is not the best word in this
 context, since all this things here were pretty unlikely.

 If the codepath is in libfreetype this would be an issue for their list. ...

 Friedrich

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 2D plots in mplot3d

2012-03-15 Thread Thøger Rivera-Thorsen
Hello list;

I have some data that I would like to display a bit like it is done in 
this example:

  
http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html#d-plots-in-3d

Only, instead of the line plot in the z=0 plane, I would like to 
represent my data as a pcolormesh (and instead of the scatter I would 
like to do a line plot of the levels at chosen y-values, bu that is not 
the problem now).

However, when I try to do a ax.pcolormesh() - which should be inherited 
- it creates the object just fine, but when I write 'draw()', I get the 
error message:

 AttributeError: 'QuadMesh' object has no attribute 
'do_3d_projection'

Is there a different way to obtain what I wanbt - that is, an image plot 
with customizeable coordinate axes, in a given plane (here z=0) of the 
Axes3D?

Cheers;

Emil


--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] matplotlib.sankey: boxes spliced into flow?

2012-03-15 Thread Kevin Hunter
Hullo matplotlib list,

I've discovered (with pleasure!) that matplotlib has recently learned 
how to create Sankey diagrams.  Thank you Kevin and Yannick!

One of my less-technically inclined fellow graduate students is 
searching for his toolset of choice for generating these suckers, and is 
currently looking at Stan.  As I'm an open-source advocate I'd love to 
be able to say, you can do this with X, where X in this case is 
clearly matplotlib.

Specifically, I've not heavily used matplotlib before, and from the 
given examples I see on matplotlib.sf.net, I'm not clear on exactly the 
capabilities of this recently-added code.  What my fellow grad student 
has opined would be nice for his uses would be boxes that are built into 
the flows, rather than just used as labels.  Something like:

Page Load
http://modernl.com/images/diagrams/web-traffic-sankey-diagram.png

Input, Gas Turbine, HRSG, Waste, BP Turbine, Output
http://www.bucknell.edu/images/Depts/Facilities/sankeythumb.jpg

Is this currently possible, /without/ manually adjusting the graphic?

Thanks!

Kevin

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to remove the black border in a Matplotlib figure

2012-03-15 Thread Tony Yu
On Thu, Mar 15, 2012 at 6:01 AM, kususe kus...@interfree.it wrote:


 Hi folks,
 I'd like to remove the black border which is created when I save the image,
 letting just the white background and the graph.
 Is there a solution??
 Thanks,
 K.
 --


Matplotlib provides a function that *almost* does this: `plt.axis('off')`
or `ax.set_axis_off()`, but these functions clear the white background as
well (along with the ticks, spines, and axis labels).

The following snippet clears only the spines and ticks:

ax.xaxis.set_ticks([])
ax.yaxis.set_ticks([])
for spine in ax.spines.itervalues():
spine.set_visible(False)

I've wrapped this up into a utility function:
https://github.com/tonysyu/mpltools/blob/master/mpltools/layout.py

-Tony
--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] (Lack of) hidden surfaces - mplot3d bug?

2012-03-15 Thread Benjamin Root
On Thu, Mar 15, 2012 at 12:31 PM, Thøger Rivera-Thorsen 
thoger.e...@gmail.com wrote:

 Hello people,

 I am trying to do a surface plot of some data, with some line plots
 marking some lines of special interest - see attachment.

 It would be really nice if the surface plot would hide the lines that are
 behind the surface, but every single line piece is clearly visible, which
 makes the picture a good deal more messy than I'd like it to be. Is this a
 bug, and/or is there a way to fix it?


This is a common problem and is partly addressed here in the mplot3d FAQ:

http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/faq.html#my-3d-plot-doesn-t-look-right-at-certain-viewing-angles

For your particular situation, the surface plot is represented by a single
z value (z in the viewing coordinates, not the graph coordinates).
Depending on how your lines are being done, the group of lines may each be
represented by their own z values or there is a single z-value for all of
the lines (again, depending on how you are plotting).  For your kind of
scene, there are some work-arounds.  Specifically, I might try modifying
the surface object itself.  It is pretty much just a PolyCollection.  You
can get/set the edgecolors, specifically modifying the elements that
correspond to the lines you want to color.  Note that it is a bit tricky in
that you have to also modify the collection's _edgecolors3d attribute as
it is what stores the original colors (the colors that are displayed gets
shaded with user-interaction, so we have to store the original colors
there).

I hope this rambling makes some sense.  Let me know if you have questions.

Ben Root
--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] open ascii grid data and plot

2012-03-15 Thread Goyo
El día 15 de marzo de 2012 05:14, questions anon
questions.a...@gmail.com escribió:
 I think my error is from the np.genfromtxt because I just checked the size
 of my data and it appears in 1D rather than 2D.

This is unsurprising since your file has just one row of data. I
overlooked that because the weird error message drove all my attention
to it. You can reshape the resulting array to (691, 886). Still that
error message should not be there in any case.

 I don't really understand what np.logical_or is or how to use it?
 I have tried just calling it at the beginning of the script

np.logical_or computes the logical out of two boolean arrays. It's
called internally by countourf and that's triggering the exception:

AttributeError: logical_or

Which makes no sense at all because:
1. np is expected to be an alias for numpy and numpy *does* have an
attribute called logical_or.
2. In case np didn't have an attribute called logical_or (for whatever
reason) it would cause an exception but the error message should be
something like AttributeError: 'module' object has no attribute
'logical_or'.

You where asked to call np.logical_or at the beginning of the script
in order to know if it triggers the exception in that context.

 [...] but I still end up with the same error.

So the call at the beginning didn't trigger the error?

Regards

Goyo

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] matplotlib compiled fine, but plot doesn't pop up in interactive mode

2012-03-15 Thread Yi Shang
Dear all,
I tried to search through the mailinglist archive first, but couldn't (
http://sourceforge.net/mailarchive/forum.php?forum_name=matplotlib-users).
Is the mailinglist only for browsing by date?

I did a clean install of matplotlib (following the installation webpage) on
Linux machine (x86_64 GNU/Linux), from source file matplotlib-1.1.0.tar.

the building log is as follow, you could see that I did change the basedir
list in setupext.py. I didn't change the matplotlibrc file. (I installed
ActiveTcl and ActivePython trying to solve the problem, but the
installation seems unchanged.)

tabasco:~/software/matplotlib-1.1.0 python setup.py build
basedirlist is: ['/usr/local', '/usr',
'/mnt/raidc/mshang/software/libpng-1.5.9',
'/mnt/raidc/mshang/software/ActiveTcl',
'/mnt/raidc/mshang/software/ActivePython',
'/mnt/raidc/mshang/software/freetype-2.4.9',
'/mnt/raidc/mshang/software/zlib-1.2.6']

BUILDING MATPLOTLIB
matplotlib: 1.1.0
python: 2.7.2 (default, Mar  3 2012, 11:39:51)  [GCC 4.1.2
20061115 (prerelease) (Debian 4.1.1-21)]
  platform: linux2

REQUIRED DEPENDENCIES
 numpy: 1.6.1
 freetype2: found, but unknown version (no pkg-config)

OPTIONAL BACKEND DEPENDENCIES
libpng: found, but unknown version (no pkg-config)
   Tkinter: no
* TKAgg requires Tkinter
  Gtk+: no
* Building for Gtk+ requires pygtk; you must be able
* to import gtk in your build/install environment
   Mac OS X native: no
Qt: no
   Qt4: no
 Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
  datetime: present, version unknown
  dateutil: 1.5
  pytz: 2011c

OPTIONAL USETEX DEPENDENCIES
dvipng: no
   ghostscript: /bin/sh: gs: command not found
 latex: no

[Edit setup.cfg to suppress the above messages]

.

After compilation, I can generate plots using script as blow:

cat test.py
from matplotlib import pyplot as plt
plt.plot([1,2],[2,3])
plt.savefig(test.png)
plt.savefig(test.eps)
plt.savefig(test.pdf)

But the problem I have now is that: I get no pop-up window when I type
pylab.show() in interactive mode. And below is the output of simple_plot:

 cat simple_plot.py
from pylab import *
plot([1,2,3])
show()

 python simple_plot.py --verbose-helpful
$HOME=/mnt/raidc/mshang
CONFIGDIR=/mnt/raidc/mshang/.matplotlib
matplotlib data path
/mnt/raidc/mshang/software/Python-2.7.2/lib/python2.7/site-packages/matplotlib/mpl-data
loaded rc file
/mnt/raidc/mshang/software/Python-2.7.2/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 1.1.0
verbose.level helpful
interactive is False
platform is linux2
Using fontManager instance from /mnt/raidc/mshang/.matplotlib/fontList.cache
backend agg version v2.2

Does anyone have any idea what's going wrong here? I can run gnuplot and
get pop-up windows fine, but I guess matplotlib doesn't use Xming...

Thank you all for reading this post!!

-- 
Miranda
--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib compiled fine, but plot doesn't pop up in interactive mode

2012-03-15 Thread Benjamin Root
On Thursday, March 15, 2012, Yi Shang mirandaisb...@gmail.com wrote:
 Dear all,
 I tried to search through the mailinglist archive first, but couldn't (
http://sourceforge.net/mailarchive/forum.php?forum_name=matplotlib-users).
Is the mailinglist only for browsing by date?

 I did a clean install of matplotlib (following the installation webpage)
on Linux machine (x86_64 GNU/Linux), from source file matplotlib-1.1.0.tar.

 the building log is as follow, you could see that I did change the
basedir list in setupext.py. I didn't change the matplotlibrc file. (I
installed ActiveTcl and ActivePython trying to solve the problem, but the
installation seems unchanged.)

 tabasco:~/software/matplotlib-1.1.0 python setup.py build
 basedirlist is: ['/usr/local', '/usr',
'/mnt/raidc/mshang/software/libpng-1.5.9',
'/mnt/raidc/mshang/software/ActiveTcl',
'/mnt/raidc/mshang/software/ActivePython',
'/mnt/raidc/mshang/software/freetype-2.4.9',
'/mnt/raidc/mshang/software/zlib-1.2.6']


 BUILDING MATPLOTLIB
 matplotlib: 1.1.0
 python: 2.7.2 (default, Mar  3 2012, 11:39:51)  [GCC 4.1.2
 20061115 (prerelease) (Debian 4.1.1-21)]
   platform: linux2

 REQUIRED DEPENDENCIES
  numpy: 1.6.1
  freetype2: found, but unknown version (no pkg-config)

 OPTIONAL BACKEND DEPENDENCIES
 libpng: found, but unknown version (no pkg-config)
Tkinter: no
 * TKAgg requires Tkinter
   Gtk+: no
 * Building for Gtk+ requires pygtk; you must be
able
 * to import gtk in your build/install
environment
Mac OS X native: no
 Qt: no
Qt4: no
  Cairo: no

 OPTIONAL DATE/TIMEZONE DEPENDENCIES
   datetime: present, version unknown
   dateutil: 1.5
   pytz: 2011c

 OPTIONAL USETEX DEPENDENCIES
 dvipng: no
ghostscript: /bin/sh: gs: command not found
  latex: no

 [Edit setup.cfg to suppress the above messages]


 .

 After compilation, I can generate plots using script as blow:

cat test.py
 from matplotlib import pyplot as plt
 plt.plot([1,2],[2,3])
 plt.savefig(test.png)
 plt.savefig(test.eps)
 plt.savefig(test.pdf)

 But the problem I have now is that: I get no pop-up window when I type
pylab.show() in interactive mode. And below is the output of simple_plot:

 cat simple_plot.py
 from pylab import *
 plot([1,2,3])
 show()

 python simple_plot.py --verbose-helpful
 $HOME=/mnt/raidc/mshang
 CONFIGDIR=/mnt/raidc/mshang/.matplotlib
 matplotlib data path
/mnt/raidc/mshang/software/Python-2.7.2/lib/python2.7/site-packages/matplotlib/mpl-data
 loaded rc file
/mnt/raidc/mshang/software/Python-2.7.2/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc
 matplotlib version 1.1.0
 verbose.level helpful
 interactive is False
 platform is linux2
 Using fontManager instance from
/mnt/raidc/mshang/.matplotlib/fontList.cache
 backend agg version v2.2

 Does anyone have any idea what's going wrong here? I can run gnuplot and
get pop-up windows fine, but I guess matplotlib doesn't use Xming...

 Thank you all for reading this post!!

 --
 Miranda


The build can't find the build dependencies.  At the very least, install
the tkinter-devel packages.  These dependencies are needed to make mpl
interactive, but are not required for a successful build.  The instructions
on the page for how to install from source explains how to determine all
your build requirements from the command-line.

I hope that helps!
Ben Root
--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users