Hi again,
this is my second question related to the figure located at:
http://nicolasgirard.nerim.net/img/artifacts.png
The figure was generated using an instance of the following RunContour class:
class RunFigure:
""" Une figure relative à un unique run """
def __init__(self,run):
""" On spécifie le run, soit par son nombre nb, soit directement """
self.run = run
# pour fichier de sortie
self.plotname='fig'
self.dpi=150
self.orientation='portrait'
self.figsize=(5,3)
# Titre de la figure
self.figtitle="Run %04d - %s"%(self.run.nb,self.run.title)
def plot(self):
#gray()
self.fig=figure(figsize=self.figsize,dpi=self.dpi)
def filename(self):
return '/home/ngirard/out/%04d_%s.png'%(self.run.nb,self.plotname)
def save(self):
gray()
savefig(self.filename(),
dpi=self.dpi,orientation=self.orientation)
class RunContour(RunFigure):
def __init__(self,run,vals=['y1'],max=None,**kwargs):
RunFigure.__init__(self,run,**kwargs)
#self.max = max or self.run.iz
# pour fichier de sortie
self.plotname='cont'
self.orientation = 'landscape'
self.figsize=(11,7)
r = self.run
self.vals = [r.y[0],r.y[2],r.y[4],r.y[6],r.p,r.q,r.omega]
self.valnames = [r"\rho",r"v_z",r"B_z",r"I",r"P",r"Q",r"\Omega"]
def plot(self):
RunFigure.plot(self)
nbvals = len(self.vals)
plotLocations = ["1%d%d"%(nbvals,i+1) for i in range(nbvals)]
titles = [r"$%s$"%n for n in self.valnames]
first=True
for val in self.vals:
plotLocation = plotLocations.pop(0)
if first:
ax1=subplot(plotLocation)
ax1.xaxis.set_major_locator(LinearLocator(numticks=3))
first=False
else:
ax =subplot(plotLocation,sharex=ax1,sharey=ax1)
setp(ax.get_yticklabels(), visible=False)
setp(ax.get_xticklabels(), visible=False)
contourf(self.run.r,self.run.z,val,30)
title(titles.pop(0),fontproperties=small)
cb = colorbar(orientation='horizontal')
cb.xaxis.set_major_locator(LinearLocator(numticks=3))
On to my question:
Note that I specified a linear locator for the x axis of the 1st plot, and for
the x axis of the colorbars using the same code:
ooooooo.set_major_locator(LinearLocator(numticks=3))
However all colorbars ticks are formatted with a 2 digit precision whereas the
ticks of the 1st fig. xaxis are formatted with a 3 digit precision.
Why this discrepancy ?
PS: please don't hesitate to give me any advice to enhance the above code if
you wish !
Thanks in advance,
Nicolas