Re: [Matplotlib-users] mplot3d and plot_surface: How to 'hide' objects inside the surface

2011-05-06 Thread Alexander Dietz
Hi Benjamin,

thanks for your answer - I feared you would reply as you did. I will have a
look at mayavi then.

Thanks
  Alex


On Fri, May 6, 2011 at 00:24, Benjamin Root ben.r...@ou.edu wrote:

 On Thursday, May 5, 2011, Alexander Dietz
 alexanderdie...@googlemail.com wrote:
  Hi,
 
  I have the following situation. I have been following the example to
 create a 3d surface, as explained here:
 
  http://matplotlib.sourceforge.net/examples/mplot3d/surface3d_demo2.html
 
  and I have altered the code slightly to plot a straight red line from the
 center outside of the sphere (see code at the end of this email). As one can
 see, the whole line is visible always, no matter how the sphere is turned.
 Is there a way to 'hide' those parts of the red line, which are 'behind' the
 blue surface? Like you stick a pencil into an apple and turn the apple, so
 you can see parts of the pencil, depending on how the apple is rotated
 (except the part of the pencil inside the apple)?
 
  If someone can help me with that problem that would be great.
 
 
  Thanks
Alex
 
 
 
 
 
 
  from mpl_toolkits.mplot3d import Axes3D
  import matplotlib.pyplot as plt
  import numpy as np
 
  fig = plt.figure()
  #ax = fig.add_subplot(111, projection='3d')
  ax = Axes3D(fig)
 
  u = np.linspace(0, 2 * np.pi, 100)
  v = np.linspace(0, np.pi, 100)
 
  x = 10 * np.outer(np.cos(u), np.sin(v))
  y = 10 * np.outer(np.sin(u), np.sin(v))
  z = 10 * np.outer(np.ones(np.size(u)), np.cos(v))
 
  ax.plot([0,15],[0.0,0.0],'r', lw=4)
 
  ax.plot_surface(x, y, z,  rstride=4, cstride=4, color='b')
 
  plt.show()
 

 Mplot3d is not a true 3d plotting system.  I would recommend mayavi
 for that.  Because mplot3d is a hack to render 3d objects with a 2d
 rendering system, matplotlib can't get the the layering right.  Maybe
 in the far future this will be changed, but for now, it is a design
 limitation.

 Ben

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] fill with a semilogy axis?

2011-05-06 Thread Francesco Montesano
Hi Michael,

I use fill_between() and log axis without problems in the following way (it's 
by memory, I hope the sintax is correct)

fig = plt.figure()
spl = fig.add_subplot(111)

spl.fill_between(x,y1,y2)

spl.set_yscale(log)

plt.show()

Cheers,

Fra

Il giorno 06/mag/2011, alle ore 01.34, Benjamin Root ha scritto:

 
 
 On Tue, May 3, 2011 at 3:40 AM, K.-Michael Aye kmichael@gmail.com wrote:
 A colleague posed an interesting challenge:
 How to do a filled plot having the y-axis in logarithm?
 I think I can do it with creating patches myself an adding it to the
 axis, but isn't there anything built-in?
 
 Best regards,
 Michael
 
 
 
 Does fill_between() not work for you?  Note, I have never tried it on a log 
 scale plot.
 
 Ben Root
 
 --
 WhatsUp Gold - Download Free Network Management Software
 The most intuitive, comprehensive, and cost-effective network 
 management toolset available today.  Delivers lowest initial 
 acquisition cost and overall TCO of any competing solution.
 http://p.sf.net/sfu/whatsupgold-sd___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Save or pickle pyplot object

2011-05-06 Thread Andreas Reisinger
Hi Ben,

Thanks anyway for your answer!

Aki

Benjamin Root wrote:
 
 
 On Tue, Mar 29, 2011 at 8:35 AM, Andreas Reisinger
 andreas.reisin...@tuwien.ac.at mailto:andreas.reisin...@tuwien.ac.at
 wrote:
 
 Hi!
 
 I would like to save a pyplot object as it is, including axes, lines,
 text, etc.   into a file.
 When opening it again, I want to be able to add additional axes, lines
 and so on.
 
 Unfortunately pickle does not handle the pyplot object and gives me an
 error.
 
 Anyone knows a solution?
 
 All the best
 Aki
 
 
 This has been an often requested feature, but much harder to implement
 than expected.  There is currently no known solution to this problem,
 but I certainly would hope that it becomes possible.
 
 Sorry I could not be of more help.
 Ben Root
 
 
 
 
 --
 WhatsUp Gold - Download Free Network Management Software
 The most intuitive, comprehensive, and cost-effective network 
 management toolset available today.  Delivers lowest initial 
 acquisition cost and overall TCO of any competing solution.
 http://p.sf.net/sfu/whatsupgold-sd
 
 
 
 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Feature request: automatic scaling of subplots, margins, etc

2011-05-06 Thread Daniel Mader
Hi,

almost every time I create a somewhat more complex figure I have to
fight with the not too smart positioning of the plots and the size of
margins around the axes. From many postings here I have learned that
this is the absolute intention, i.e. it is broken by design unless the
programmer takes care about this.

I have to admin that I do not really get this idea. I am aware that
the defaults will not change anytime soon and so I'd like to ask for
an idiot-proof mode: this could be enabled by an rcParam and take
care of proper dimensions, scale axis labels, titles, margins etc so
that they don't cover.

Here's an example for a matplotlib script which is a simple as it can
get and demonstrates the broken layout which a user gets by default.

import scipy
import pylab

x = scipy.linspace(-50,50, 100)
y1 = scipy.rand(100)
y2 = scipy.sin(x)
y3 = y1 + y2

fig = pylab.figure()
ax1 = fig.add_subplot(311)
ax2 = fig.add_subplot(312)
ax3 = fig.add_subplot(313)

ax1.plot(x, y1)
ax2.plot(x, y2)
ax3.plot(x, y3)

ax1.set_title('some title')
ax2.set_title('some title')
ax3.set_title('some title')

pylab.show()

Of course, one can adjust the figsize but the results are still far
from being adorable. The spacing around the sublplots increases for no
apparent reason while the spacing between the subplot remains the same
so that everything looks cramped...


Thank you many times in advance,
best regards,

Daniel

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Feature request: automatic scaling of subplots, margins, etc

2011-05-06 Thread Chris Rodgers
Since I just posted an almost-identical question, it's no surprise
that I agree this would be a useful feature.
Reason #1) I create hundreds of quick throwaway figures every day,
often in an automated way, and don't have time to fine-tune them.
Reason #2) a newbie to matplotlib might be turned off by one ugly
figure, when in fact matplotlib is capable of producing beautiful
figures.

The previous suggestion I received was to create a convenience wrapper
for the subplot function with some idiot-proof defaults. Can you
propose a set of rcParams that satisfies this criterion? This one
fixes the specific issue you raise:
matplotlib.rcParams['figure.subplot.hspace'] = .5

Although it will rear its ugly head again once the number of subplots
reaches 5 or 6. Personally I rarely use more than 4x4, and if I did I
would certainly increase the figsize.

I find that setting all text sizes to be as small as possible also
helps. My most commonly encountered issue is overlapping x-tick
labels, because most of my plots have samples on the x-axis and
therefore hundreds of thousands of points.

The real solution of course is to calculate exactly where every piece
of text actually is, detect overlaps, and adjust. That is certainly
beyond my ability or inclination to implement. In the mean time, it
would be nice to have a simple idiot-proof flag that blindly fixes
some common problems.

On Fri, May 6, 2011 at 1:20 AM, Daniel Mader
danielstefanma...@googlemail.com wrote:
 Hi,

 almost every time I create a somewhat more complex figure I have to
 fight with the not too smart positioning of the plots and the size of
 margins around the axes. From many postings here I have learned that
 this is the absolute intention, i.e. it is broken by design unless the
 programmer takes care about this.

 I have to admin that I do not really get this idea. I am aware that
 the defaults will not change anytime soon and so I'd like to ask for
 an idiot-proof mode: this could be enabled by an rcParam and take
 care of proper dimensions, scale axis labels, titles, margins etc so
 that they don't cover.

 Here's an example for a matplotlib script which is a simple as it can
 get and demonstrates the broken layout which a user gets by default.

 import scipy
 import pylab

 x = scipy.linspace(-50,50, 100)
 y1 = scipy.rand(100)
 y2 = scipy.sin(x)
 y3 = y1 + y2

 fig = pylab.figure()
 ax1 = fig.add_subplot(311)
 ax2 = fig.add_subplot(312)
 ax3 = fig.add_subplot(313)

 ax1.plot(x, y1)
 ax2.plot(x, y2)
 ax3.plot(x, y3)

 ax1.set_title('some title')
 ax2.set_title('some title')
 ax3.set_title('some title')

 pylab.show()

 Of course, one can adjust the figsize but the results are still far
 from being adorable. The spacing around the sublplots increases for no
 apparent reason while the spacing between the subplot remains the same
 so that everything looks cramped...


 Thank you many times in advance,
 best regards,

 Daniel

 --
 WhatsUp Gold - Download Free Network Management Software
 The most intuitive, comprehensive, and cost-effective network
 management toolset available today.  Delivers lowest initial
 acquisition cost and overall TCO of any competing solution.
 http://p.sf.net/sfu/whatsupgold-sd
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Missing some islands in basemap?

2011-05-06 Thread Francesco Benincasa
Hi all,
I've noticed that there are some islands missing from the basemap,
such as Balearic Islands and Canary Islands.

Any suggestion to fix it?

Thank you very much in advance.

-- 
--
Francesco Benincasa
Research Support Engineer - Earth Sciences Department
Barcelona Supercomputing Center - Centro Nacional de Supercomputación
Edificio Nexus II
c/ Jordi Girona 29, 08034 Barcelona, Spain
phone +34 934137612
fax +34 934137721
mailto: francesco.beninc...@bsc.es
BSC web page: http://www.bsc.es/
--

WARNING / LEGAL TEXT: This message is intended only for the use of the
individual or entity to which it is addressed and may contain
information which is privileged, confidential, proprietary, or exempt
from disclosure under applicable law. If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, you are strictly prohibited from disclosing,
distributing, copying, or in any way using this message. If you have
received this communication in error, please notify the sender and
destroy and delete any copies you may have received.

http://www.bsc.es/disclaimer.htm

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Venn diagram for five events

2011-05-06 Thread Vikram K
I wish to draw a Venn diagram depicting five events and their intersections.
I came across some code for three events--could someone please direct me
about how i could modify it for five events.

from matplotlib import pyplot as plt
from matplotlib.patches import Circle

f = plt.figure()
ax = f.gca()
rad = 1.4
c1 = Circle((-1,0),rad, alpha=.2, fc ='red')
c2 = Circle((1,0),rad, alpha=.2, fc ='blue')
c3 = Circle((0,1),rad, alpha=.2, fc ='green')
ax.add_patch(c1)
ax.add_patch(c2)
ax.add_patch(c3)
ax.set_xlim(-3,3)
ax.set_ylim(-3,3)
plt.show()
--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Fwd: Venn diagram for five events

2011-05-06 Thread Vikram K
This works for four events and their intersections but how do i add the
fifth event along with all intersections?

from matplotlib import pyplot as plt
from matplotlib.patches import Circle

f = plt.figure()
ax = f.gca()
rad = 1.4
c1 = Circle((-1,0),rad, alpha=.2, fc ='red')
c2 = Circle((1,0),rad, alpha=.2, fc ='blue')
c3 = Circle((0,1),rad, alpha=.2, fc ='green')
c4 = Circle((0,-1),rad, alpha=.2, fc ='yellow')
ax.add_patch(c1)
ax.add_patch(c2)
ax.add_patch(c3)
ax.add_patch(c4)
ax.set_xlim(-3,3)
ax.set_ylim(-3,3)
plt.show()


-- Forwarded message --
From: Vikram K kpguy1...@gmail.com
Date: Fri, May 6, 2011 at 7:43 AM
Subject: Venn diagram for five events
To: matplotlib-users@lists.sourceforge.net


I wish to draw a Venn diagram depicting five events and their intersections.
I came across some code for three events--could someone please direct me
about how i could modify it for five events.

from matplotlib import pyplot as plt
from matplotlib.patches import Circle

f = plt.figure()
ax = f.gca()
rad = 1.4
c1 = Circle((-1,0),rad, alpha=.2, fc ='red')
c2 = Circle((1,0),rad, alpha=.2, fc ='blue')
c3 = Circle((0,1),rad, alpha=.2, fc ='green')
ax.add_patch(c1)
ax.add_patch(c2)
ax.add_patch(c3)
ax.set_xlim(-3,3)
ax.set_ylim(-3,3)
plt.show()
--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fwd: Venn diagram for five events

2011-05-06 Thread Alan G Isaac
On 5/6/2011 7:57 AM, Vikram K wrote:

 I wish to draw a Venn diagram depicting five events and their intersections.


Can't be done:
http://www.brynmawr.edu/math/people/anmyers/PAPERS/Venn.pdf

hth,
Alan Isaac


--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] fill with a semilogy axis?

2011-05-06 Thread Johann Goetz
 Hi Michael,

 I use fill_between() and log axis without problems in the following way (it's 
 by memory, I hope the sintax is correct)

 fig = plt.figure()
 spl = fig.add_subplot(111)

 spl.fill_between(x,y1,y2)

 spl.set_yscale(log)

 plt.show()

 Cheers,

 Fra

 Il giorno 06/mag/2011, alle ore 01.34, Benjamin Root ha scritto:

 
 
  On Tue, May 3, 2011 at 3:40 AM, K.-Michael Aye kmichael@gmail.com 
  wrote:
  A colleague posed an interesting challenge:
  How to do a filled plot having the y-axis in logarithm?
  I think I can do it with creating patches myself an adding it to the
  axis, but isn't there anything built-in?
 
  Best regards,
  Michael
 
 
 
  Does fill_between() not work for you?  Note, I have never tried it on a log 
  scale plot.
 
  Ben Root
 


Another couple things you may find useful as I did:

fig = pyplot.figure()
spl = fig.add_subplot(111)

to properly clip the plot in case you are using polygons or similar,
you can use the nonposy option:

spl.set_yscale('log', nonposy='clip')

Here is my hand made formula for setting reasonable limits on the
y-axis, given a numpy.array yarr as the list of y-values. The ymin
gets the minimum value that's not zero since you can't plot zero on a
log scale (negative numbers may cause a whole other problem):

spl.set_ylim(
ymin = 10**(int(math.log(min(yarr[numpy.where(yarr0)]), 10))-1),
ymax = 10**(int(math.log(max(yarr), 10)+0.2)+1)  )

--Johann

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] UserWarning: Attempting to set identical bottom==top

2011-05-06 Thread Benjamin Root
On Thu, May 5, 2011 at 10:01 PM, C M cmpyt...@gmail.com wrote:

  Because you have a py2exe'ed program, I suspect that whoever packaged the
  program should be the one to modify that program to choose its axes
 limits
  more robustly in order to avoid the warning message.

 Maybe I have been unclear.  I am the sole developer of this
 application, and I occasionally test it as a py2exe'd app in
 anticipation of delivering it in that form at some point.  I would be
 happy to modify the program to choose its axes limits more
 robustly--if I only knew how to do that.  That is what I am asking.
 How should I do that?

 The data to be plotted is a very simple date plot with dates on the x
 axis and values (formatted as time) on the y axis.

 Che


Most likely, somewhere in your code, you have a call to set_ylim(), and are
likely setting it to the minimum and maximum values of the data you are
plotting.  This is where the problem comes in.  There are several options to
go about avoiding the problem here.  One is to not call set_ylim() at all if
you have only one data point, and just let matplotlib figure out the
y-limits automatically.  Another approach is to call set_ylim() with
parameters that have an explicit amount of padding, like the following:

ax.set_ylim(y.min() - 0.5, y.max() + 0.5)

This way, you are guaranteed that the top and bottom limits will never be
the same.  The best approach is up to you.

I hope that helps!
Ben Root
--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Missing some islands in basemap?

2011-05-06 Thread Francesco Benincasa
 Hi all,
 I've noticed that there are some islands missing from the basemap,
 such as Balearic Islands and Canary Islands.
 
I've fixed,
the problem was that I'm using the python wrapper for grads, that set the
default area threshold to 1 km ...

I hope this can help someone else,
bye.

-- 
--
Francesco Benincasa
Research Support Engineer - Earth Sciences Department
Barcelona Supercomputing Center - Centro Nacional de Supercomputación
Edificio Nexus II
c/ Jordi Girona 29, 08034 Barcelona, Spain
phone +34 934137612
fax +34 934137721
mailto: francesco.beninc...@bsc.es
BSC web page: http://www.bsc.es/
--

WARNING / LEGAL TEXT: This message is intended only for the use of the
individual or entity to which it is addressed and may contain
information which is privileged, confidential, proprietary, or exempt
from disclosure under applicable law. If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, you are strictly prohibited from disclosing,
distributing, copying, or in any way using this message. If you have
received this communication in error, please notify the sender and
destroy and delete any copies you may have received.

http://www.bsc.es/disclaimer.htm

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Feature request: automatic scaling of subplots, margins, etc

2011-05-06 Thread Tony Yu
On Fri, May 6, 2011 at 5:55 AM, Chris Rodgers chris.rodg...@berkeley.eduwrote:

 The real solution of course is to calculate exactly where every piece
 of text actually is, detect overlaps, and adjust. That is certainly
 beyond my ability or inclination to implement. In the mean time, it
 would be nice to have a simple idiot-proof flag that blindly fixes
 some common problems.


I wrote a helper script awhile back to adjust spacing automatically.

Code can be found here:
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg18107.html

You can simply copy the code into a module (e.g. layout.py) that lives in
your python path, and then call layout.tight_layout() *right before* your
call to plt.show() (or plt.savefig()).

It's pretty inefficient though because it has to draw the figure 3 different
times (once to calculate the size of subplots and again to calculate the
size of the figure, and then the final draw). There are some other issues,
which prevent inclusion in matplotlib (see discussion in link below), but it
works well for my purposes.

Best,
-Tony

Original post, with some discussion, can be found here:
http://www.mail-archive.com/matplotlib-devel@lists.sourceforge.net/msg06896.html

Note the code from the original post didn't work on some backends, so it's
probably best to use the code from the first link.
--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Feature request: automatic scaling of subplots, margins, etc

2011-05-06 Thread Daniel Mader
Very nice, will try this asap!

Many thanks!

2011/5/6 Tony Yu tsy...@gmail.com:

 On Fri, May 6, 2011 at 5:55 AM, Chris Rodgers chris.rodg...@berkeley.edu
 wrote:

 The real solution of course is to calculate exactly where every piece
 of text actually is, detect overlaps, and adjust. That is certainly
 beyond my ability or inclination to implement. In the mean time, it
 would be nice to have a simple idiot-proof flag that blindly fixes
 some common problems.

 I wrote a helper script awhile back to adjust spacing automatically.

 Code can be found here:
 http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg18107.html

 You can simply copy the code into a module (e.g. layout.py) that lives in
 your python path, and then call layout.tight_layout() *right before* your
 call to plt.show() (or plt.savefig()).

 It's pretty inefficient though because it has to draw the figure 3 different
 times (once to calculate the size of subplots and again to calculate the
 size of the figure, and then the final draw). There are some other issues,
 which prevent inclusion in matplotlib (see discussion in link below), but it
 works well for my purposes.

 Best,
 -Tony

 Original post, with some discussion, can be found here:
 http://www.mail-archive.com/matplotlib-devel@lists.sourceforge.net/msg06896.html

 Note the code from the original post didn't work on some backends, so it's
 probably best to use the code from the first link.

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] incremental colors for lines

2011-05-06 Thread Pythonified

I have been trying to assign different colors for each line I plot, where the
colors are incrementally darkened (or lightened), or selected from a
colorbar (e.g. rainbow).

Any ideas?
-- 
View this message in context: 
http://old.nabble.com/incremental-colors-for-lines-tp31546719p31546719.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Subplot x-tick labels overlap with each other and with titles

2011-05-06 Thread Chris Rodgers
Hi

Whenever I create figures with at least 3x3 subplots, the x-tick
labels overlap with each other and they also overlap with the title of
the adjacent subplot, rendering the entire figure illegible. I know
that I can fine-tune the plot to look exactly the way I want with
wspace and hspace for instance, but I don't understand why this is
the default behavior. I wonder if I have a system font issue, such
that matplotlib thinks the fonts are smaller than they really are.

My questions:
1) Is this the intended behavior of matplotlib, or is there something
wrong with my installation?
2) Assuming I don't have an installation issue, is there a very
general parameter I can change so that the overlap doesn't occur,
rather than manually adjusting every figure?


Minimal code to reproduce the problem:

import numpy as np
import matplotlib.pyplot as plt
plt.figure()
plt.subplot(331)
plt.subplot(334)
plt.plot(np.arange(1))
plt.title('Title')
plt.show()


I'm attaching the output figure, although I'm not sure if the list
accepts attachments. The x-tick labels on subplot 334 overlap each
other, and the title of subplot 334 overlaps with the x-tick labels in
subplot 331.


System:
Ubuntu 10.04 x64
All packages are the stable versions from Synaptic, including ipython,
python, numpy, matplotlib 0.99.1.1
I've also tried the Enthought distribution with matplotlib 1.0.1 and
the results are the same
I've tried both Wx and Tk backends and the results are the same
I've tried `matplotlib.rcParams['xtick.labelsize'] = 'x-small'`, and
this does make the labels smaller, but for sufficiently large numbers
the overlap still occurs.

Thanks for any help!
Chris
attachment: output.png--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] UserWarning: Attempting to set identical bottom==top

2011-05-06 Thread C M
On Fri, May 6, 2011 at 10:33 AM, Benjamin Root ben.r...@ou.edu wrote:
 On Thu, May 5, 2011 at 10:01 PM, C M cmpyt...@gmail.com wrote:

  Because you have a py2exe'ed program, I suspect that whoever packaged
  the
  program should be the one to modify that program to choose its axes
  limits
  more robustly in order to avoid the warning message.

 Maybe I have been unclear.  I am the sole developer of this
 application, and I occasionally test it as a py2exe'd app in
 anticipation of delivering it in that form at some point.  I would be
 happy to modify the program to choose its axes limits more
 robustly--if I only knew how to do that.  That is what I am asking.
 How should I do that?

 The data to be plotted is a very simple date plot with dates on the x
 axis and values (formatted as time) on the y axis.

 Che

 Most likely, somewhere in your code, you have a call to set_ylim(), and are
 likely setting it to the minimum and maximum values of the data you are
 plotting.  This is where the problem comes in.  There are several options to
 go about avoiding the problem here.  One is to not call set_ylim() at all if
 you have only one data point, and just let matplotlib figure out the
 y-limits automatically.  Another approach is to call set_ylim() with
 parameters that have an explicit amount of padding, like the following:

 ax.set_ylim(y.min() - 0.5, y.max() + 0.5)

 This way, you are guaranteed that the top and bottom limits will never be
 the same.  The best approach is up to you.

 I hope that helps!
 Ben Root

Thank you, Ben!  That helps a lot.  Adding some padding myself seems
to fix it.  And it's good to understand what was occurring.

-Che

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Display dynamic plots within wx GUI

2011-05-06 Thread Steve Kacenjar
Hello,

I am trying to embed a dynamic figure within a GUI generated WX 
interface but it only displays the last evaluation.  I have tried 
embedding the animated examples as provided by the animated link,  
www.scipy.org/Cookbook/Matplotlib/Animations  but it only shows the last 
result in the frame.  When calling these example outside the GUI, they 
produce the dynamic visualizations and expected.

Can anyone provide me with guidance in generalizing the animated 
examples within embedded GUIs.

Thanks

Steve

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Radar and/or lidar data visualization

2011-05-06 Thread Gökhan Sever
Hello,

Anyone on the list works with radar and/or lidar data for atmospheric
phenomenon visualisation? I am wondering if there is any 2D specific
analysis and visualisation package out in the web.

Thanks.

-- 
Gökhan

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fwd: Venn diagram for five events

2011-05-06 Thread Alan G Isaac
 On 5/6/2011 7:57 AM, Vikram K wrote:
 I wish to draw a Venn diagram depicting five events and
 their intersections.

On 5/6/2011 8:07 AM, Alan G Isaac wrote:
 Can't be done:
 http://www.brynmawr.edu/math/people/anmyers/PAPERS/Venn.pdf


More precisely: it cannot be done with circles.

Cheers,
Alan Isaac


--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users