# contour plot: clabel manual changes figure properties

Hi,

For a contour plot I use the option 'manual=True' in clabel
to set the location of the labels manually.

Before the plotting command I set some figure properties using
rcParams as explained on this site:

http://www.scipy.org/Cookbook/Matplotlib/LaTeX_Examples

My Problem is, that the manual-option changes the figure
properties and when I use savefig I get a very different result
compared to 'manual=False'.

Is there some way to prevent this or alternatively set the
properties after manually setting the labels?

Valentin

Here is an example.

···

=====================================

from math import pi
import numpy as np

import pylab as pl

#######################
fig_width_pt = 246.0 # Get this from LaTeX using \showthe\columnwidth
inches_per_pt = 1.0/72.27 # Convert pt to inch
golden_mean = 1 #(sqrt(5)-1.0)/2.0 # Aesthetic ratio
fig_width = fig_width_pt*inches_per_pt # width in inches
fig_height =fig_width*golden_mean # height in inches
fig_width = fig_width
fig_size = [fig_width,fig_height]
params = {'backend': 'ps',
'axes.labelsize': 10,
'text.fontsize': 10,
'legend.fontsize': 10,
'xtick.labelsize': 8,
'ytick.labelsize': 8,
'figure.figsize': fig_size}
pl.rcParams.update(params)

ax = pl.axes([0.15, 0.15, 0.8, 0.8])

dummy = np.linspace(0, 2*pi, 101)
s, t = np.meshgrid(dummy, dummy)

f = np.sin(2*s)**2* np.cos(t)
cs = pl.contour(s, t, f)
pl.clabel(cs, manual=True)

pl.xlim(0, 2*pi)
pl.ylim(0, 2*pi)
pl.savefig('test.png')

=====================================

Is there some way to prevent this or alternatively set the
properties after manually setting the labels?

Hi,

I just found out how to restore the old settings:

save = pl.rcParams.copy()
pl.clabel(cs, manual=True)
pl.rcParams.update(save)

Maybe this should be the default behaviour?

Regards,
Valentin