Is the list of return values from the clabel() function supposed to 
represent the position and orientation of the contour labels?  I have a 
script below where I try to re-draw the contour labels using the Text 
objects in the list returned from clabel(), and they do not line up in 
my output.  I'm using Matplotlib version 0.98.5.1, revision 6622.

If this is intentional, is there some way of retrieving the actual 
position/orientation of the contour labels?  I'm trying to make a 
drop-shadow effect for those labels, and I need to know where they are 
exactly for my code to work.

Sample script:
#!/usr/bin/env python
import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import math

matplotlib.rcParams['xtick.direction'] = 'out'
matplotlib.rcParams['ytick.direction'] = 'out'

delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
# difference of Gaussians
Z = 10.0 * (Z2 - Z1)

f=plt.figure(facecolor='g')
ax = plt.gca()
ax.set_axis_bgcolor('g')
CS = plt.contour(X, Y, Z)
xt = plt.xticks()
yt = plt.yticks()

fontsize = 10
fontdict2 = {'fontweight':'light',
             'color': 'r',
             'fontsize':fontsize}
labels = plt.clabel(CS, inline=1, fontsize=fontsize,colors='k')
for label in labels:
    ltext = label.get_text()
    lrot = label.get_rotation()
    lx,ly = label.get_position()
    plt.text(lx,ly,ltext,fontdict2,rotation=lrot)

plt.savefig('output.png')


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

Reply via email to