how do I set the order of layers?

Hello,

In the attached example I would like to have the wedges under the
arrows. Can someone tell me how do this? I tried to follow the tutorial
from http://matplotlib.org/users/artists.html but I didn't really get
it all.

Thank you

from pylab import *
from numpy import ma
import math
import matplotlib.pyplot as plt
from matplotlib.patches import Wedge

X,Y = meshgrid( arange(0,2*pi,1),arange(0,2*pi,1) )
U = cos(X)
V = sin(Y)

def draw_w(x, y, p1, v, ax=None, **kwargs):
    if ax is None:
        ax = plt.gca()
    p1*=180/math.pi
    t1= (p1-v)
    t2= (p1+v)
    c=(x,y)
    radius=0.5
    w1 = Wedge(c, radius, t1, t2, fc='0.0', ec='None', alpha=1.0, **kwargs)
    ax.add_artist(w1)

fig, ax = plt.subplots()
Q = plt.quiver( U, V, color='LightSalmon', edgecolors='LightSalmon')
(a,b)=shape(X)
for i in range(a):
    for j in range(b):
        draw_w(X[i,j],Y[i,j],X[i,j], 25, ax=ax)
plt.show()

use the “zorder” keyword. higher zorder stay above lower values.

cheers
Francesco

···

Il giorno 24/ago/2013 11:27, “vwf” <vwf@…4426…> ha scritto:

Hello,

In the attached example I would like to have the wedges under the

arrows. Can someone tell me how do this? I tried to follow the tutorial

from http://matplotlib.org/users/artists.html but I didn’t really get

it all.

Thank you

from pylab import *

from numpy import ma

import math

import matplotlib.pyplot as plt

from matplotlib.patches import Wedge

X,Y = meshgrid( arange(0,2pi,1),arange(0,2pi,1) )

U = cos(X)

V = sin(Y)

def draw_w(x, y, p1, v, ax=None, **kwargs):

if ax is None:

    ax = plt.gca()

p1*=180/math.pi

t1= (p1-v)

t2= (p1+v)

c=(x,y)

radius=0.5

w1 = Wedge(c, radius, t1, t2, fc='0.0', ec='None', alpha=1.0, **kwargs)

ax.add_artist(w1)

fig, ax = plt.subplots()

Q = plt.quiver( U, V, color=‘LightSalmon’, edgecolors=‘LightSalmon’)

(a,b)=shape(X)

for i in range(a):

for j in range(b):

    draw_w(X[i,j],Y[i,j],X[i,j], 25, ax=ax)

plt.show()


Introducing Performance Central, a new site from SourceForge and

AppDynamics. Performance Central is your source for news, insights,

analysis and resources for efficient Application Performance Management.

Visit us today!

http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users