Note that there are some explanatory texts on larger screens.

plurals
  1. POMatplotlib suptitle printed over old suptitle
    primarykey
    data
    text
    <p>I am using matplotlib 1.2.1 in ubuntu 13.10 64bit</p> <p>I have a function that creates and saves a plot and I am calling that function several times. However in some cases the suptitle is drawned over the old one, making a mess. I think this is related to the following question, but I didn't manage to understand the reply in that question: <a href="https://stackoverflow.com/questions/10559144/matplotlib-suptitle-prints-over-old-title">Matplotlib suptitle prints over old title</a></p> <p>My code is as follow:</p> <pre><code># ======================================================================= def plotMultivariable(scenarios_h, variables_h, region, title, filename): nvar = len(variables_h) nscen = len(scenarios_h) plt.figure(1) maintitle = unicode(title, 'utf_8') plt.suptitle(maintitle, fontsize=16, ha='center') for i in range(nvar): plt.subplot(nvar,1,i) title = unicode(variables[variables_h[i]][0], 'utf_8') ylabel = unicode(variables[variables_h[i]][1], 'utf_8') plt.title(title) plt.ylabel(ylabel) for scenario in scenarios_h: for spGroup in spAggregates.keys(): serieName = unicode(spGroup + " - " + scenario, 'utf_8') serieColor = scenarios[scenario] serieLineType = spAggregates[spGroup][2] serieWidth = spAggregates[spGroup][3] key = region, variables_h[i], scenario, spGroup y = odata[key] plt.plot(x, y, serieLineType, label=serieName, linewidth=serieWidth, color=serieColor) plt.subplots_adjust(hspace=0.6) plt.savefig(chartoutdir+"/"+filename) #plt.show() </code></pre> <p>And I call this function with:</p> <pre><code>plotMultivariable(['reference','vRegEnd075','vRegFixed','vRegFromHr'],['expReturns','vReg','vol','hV'],'11000','Management effect','management.png') plotMultivariable(['reference','withRisk06','withRisk08','withRisk10'],['expReturns','vReg','vol','hV'],'11000','Risk effect','risk.png') plotMultivariable(['nonspatial','reference','withVariance'],['expReturns','vReg','vol','hV'],'11000','Spatial explicit simulations','space.png') </code></pre> <p>Here are the resulting plots. If I view them instead of saving they are fine. Any hint or help with understandingh the reply in the cited answer? Thank you..</p> <p><img src="https://i.stack.imgur.com/n63jj.png" alt="first image (ok)"> <img src="https://i.stack.imgur.com/SrBjI.png" alt="second plot (ok)"> <img src="https://i.stack.imgur.com/uiWAl.png" alt="third plot (title overdrawn)"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload