Re: [Matplotlib-users] Axes3D depth problem

2010-07-27 Thread copyrights
Hallo Ben Root,

I put together some snippets 

#CODE
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
import mpl_toolkits.mplot3d.art3d as art3d
from mpl_toolkits.mplot3d import Axes3D
import numpy
import matplotlib

step = 0.04
maxval = 1.0

fig = plt.figure()
ax = Axes3D(fig,aspect='equal')

ri = 0.625
rj = 1.25
l = 5

##CONE
r = numpy.linspace(rj,rj,6)
r[0]= numpy.zeros(r[0].shape)
r[1] *= ri/rj
r[5] *= ri/rj
r[3]= numpy.zeros(r[3].shape)

p = numpy.linspace(0,2*numpy.pi,50)
R,P = numpy.meshgrid(r,p)

X,Y = R*numpy.cos(P),R*numpy.sin(P)

tmp=list()
for i in range(50):
  tmp.append([0,0,l,l,l,0])
Z = numpy.array(tmp)
ax.plot_surface(X, Z,Y, rstride=1, cstride=1, color="b")

##CIRCLES
p=Circle((0,0),rj,color="red")
ax.add_patch(p)
art3d.patch_2d_to_3d(p, z=l, zdir="y")

p=Circle((0,0),ri,color="red")
ax.add_patch(p)
art3d.patch_2d_to_3d(p, z=0, zdir="y")

ax.set_ylim3d(-0.5, l+.5)
ax.set_xlim3d(-l*0.5-0.5, l*0.5+0.5)
ax.set_zlim3d(-l*0.5-0.5, l*0.5+0.5)

plt.show()
#CODE

greetz

Frank
Am 27.07.2010 21:36, schrieb Benjamin Root:
> On Tue, Jul 27, 2010 at 2:25 PM,  > wrote:
> 
> Hallo,
> 
> I got a depth problem with Axes3D. I made a plot_surface and add 2
> Circle object with add_patch and
> mpl_toolkits.mplot3d.art3d.patch_2d_to_3d.
> 
> The problem is that the circles are always in front. I upload a
> picture here http://yfrog.com/nd3dproblemp . The gui is rotatable,
> so I can't just remove the second Circle (like I did for the
> screenshot).
> 
> How to get right order to the object?
> 
> greetz
> 
> Frank
> 
> 
> Frank,
> 
> Could you please include a script that reproduces this?  There have been
> some issues like this reported before, but it would only occur at
> certain viewing angles.  Is this problem occurring regardless of what
> viewing angle you are looking at the plot?  It would be useful to have
> an example that *always* looks bad for fixing purposes.
> 
> Ben Root

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Axes3D depth problem

2010-07-27 Thread copyrights
Hallo,

I got a depth problem with Axes3D. I made a plot_surface and add 2 Circle 
object with add_patch and mpl_toolkits.mplot3d.art3d.patch_2d_to_3d.

The problem is that the circles are always in front. I upload a picture here 
http://yfrog.com/nd3dproblemp . The gui is rotatable, so I can't just remove 
the second Circle (like I did for the screenshot).  

How to get right order to the object?

greetz

Frank

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] matplotlib font in cairo

2010-05-17 Thread copyrights
Hallo,

I'm try to use MathTextParser output for cairo in my wxpython gui. Works well 
under ubunutu linux (maybe dublicated font) but fails under windows 
(screenshot: http://www.ubuntu-pics.de/bild/62985/auswahl_017_RC86gk.png ).

How to tell cairo to use the font file from mpl-data?

Here some code:

from matplotlib.mathtext import MathTextParser
from matplotlib.font_manager import ttfFontProperty
import wx
import wx.lib.wxcairo
import cairo

#...
MPC = MathTextParser("Cairo")
dc = wx.BufferedPaintDC(self)
ctx = wx.lib.wxcairo.ContextFromDC(dc)
#...
width, height, descent, glyphs, rects = 
self.mathtext_parser.parse(r"$a_0+a_1\xi+a_2\xi^2+a_3\xi^3$",dpi,prop)
#...

for font, fontsize, s, ox, oy in glyphs:
   #...
   fontProp = ttfFontProperty(font)
   #...
   ctx.select_font_face (fontProp.name,
 self.fontangles [fontProp.style],
 self.fontweights[fontProp.weight])

   #...
   ctx.show_text(s.encode("utf-8"))
   #...
#...

greetz

Frank

--

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