On 08/23/2013 10:43 AM, Benjamin Root wrote:
On Fri, Aug 23, 2013 at 9:57 AM, Peter Bloomfield
<peter.bloomfi...@camhpet.ca <mailto:peter.bloomfi...@camhpet.ca>> wrote:
Good morning,
I am running openSuSE 12.2, and this morning I upgraded matplotlib
to v1.3, and now I am having a problem with suptitle.
I use the following lines to put a title and legend onto a plot figure
import matplotlib.pyplot as plt
plt.figure(1)
plt.suptitle( "Study# : " + os.path.basename(
inImage_IO.IO_FileName ) + \
"\n" + "{ Acquired : " + \
AcqDateTime.strftime( "%b %d, %Y - $T_o$ @ %H:%M:%S" ) + " }", \
y=0.98, weight="roman", size="large" )
plt.suptitle( "{Creation Date : " + AnalysisTOD + "}",
x=0.86, y=0.03, weight="roman", size="x-small" )
Under v1.3, I only get the 'Creation Date : ...' text at the
bottom of the figure the 'Study# ...' string is not present at the
top. If I change
it to
import matplotlib.pyplot as plt
plt.figure(1)
plt.suptitle( "Study# : ", y=0.98, weight="roman", size="large" )
plt.suptitle( "{Creation Date : " + AnalysisTOD + "}",
x=0.86, y=0.03, weight="roman", size="x-small" )
the 'Creation Date : ...' text at the bottom of the figure the
'Study# : ' string is at the top.
So the problem is in the string construct in the first example.
Does anybody know of a way to get around this?
Thanks in advance
Peter
Oh, wow... we didn't think anybody was using that "misfeature". This
was a bug we fixed for 1.3, in that users complained that calling
plt.title() would update an existing title, but plt.suptitle() would
not (multiple calls would just result in text overlaid on top of each
other). We fixed this for 1.3 so that there is a single text object
that is kept and is revised in subsequent calls to suptitle(). To get
what you want, you will have to consolidate those strings into one.
Cheers!
Ben
Thanks for getting back to me, but I have tried to do as you suggest,
but to no avail, and here I apologise for my lack of knowledge of
python/matplotlib.
I consolidated the strings into one, titleStr
titleStr = "Study# : " + os.path.basename( inImage_IO.IO_FileName ) + \
"\n" + "{ Acquired : " + \
AcqDateTime.strftime( "%b %d, %Y - $T_o$ @ %H:%M:%S" )
+ " }"
plt.suptitle( titleStr, y=0.98, weight="roman", size="large" )
which should write the string
'Study# : Pos9.img\n{ Acquired : Feb 18, 2003 - $T_o$ @ 14:55:02 }'
at the top of the figure, but it did not, so I thought it is the "\n",
and tried
titleStr = "Study# : " + os.path.basename( inImage_IO.IO_FileName )
plt.suptitle( titleStr, y=0.98, weight="roman", size="large" )
which should write the string
'Study# : Pos9.img'
and this again failed to write the suptitle in the figure.
Am I being dumb (rhetorical)? What is the best way to consolidate the
strings to work with suptitle, many thanks in advance.
Cheers
Peter
--
Peter M. Bloomfield
Physicist,
PET Centre,
Centre for Addiction and Mental Health,
250 College St.,
Toronto, Ontario,
Canada M5T 1R8
Tel: 416 535 8501 Ext. 4243
------------------------------------------------------------------------------
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