[Matplotlib-users] (no subject)
garyr
garyr at fidalgo.net
Tue Aug 11 04:24:20 CEST 2015
Calling remove() on the Text artist does the job, I finally discovered. I
didn't initially understand what you were telling me in your post. Thanks again.
Gary
----- Original Message -----
From: "Thomas Caswell" <tcaswell at gmail.com>
To: "Benjamin Root" <ben.root at ou.edu>; "garyr" <garyr at fidalgo.net>
Cc: <matplotlib-users at python.org>
Sent: Monday, August 10, 2015 6:44 AM
Subject: Re: [Matplotlib-users] (no subject)
> Also remember that you can update the text with `txt.set_text()`
>
> Tom
>
> On Mon, Aug 10, 2015 at 9:18 AM Benjamin Root <ben.root at ou.edu> wrote:
>
>> The "fig.text()" call returns a Text artist. You can remove it later if
>> you like by calling its "remove()" method. If your concern is mostly that
>> the subsequent plots are appearing on top of it, and you would like the
>> text to always be on top, you can set its "zorder" value to be something
>> large, like 10:
>>
>> text = fig.text(0.13, 0.85, "Now is the time", fontsize=10, zorder=10)
>>
>> As for grids, you can turn that on with "ax.grid(True)".
>>
>> Cheers!
>> Ben Root
>>
>>
>> On Mon, Aug 10, 2015 at 5:59 AM, garyr <garyr at fidalgo.net> wrote:
>>
>>> I have a PyQt4 program that has matplotlib imbedded. I followed the
>>> example code
>>> in embedding_in_qt4.py and the plotting works very well but I have a
>>> couple of questions.
>>>
>>> I would like to display some text in the plot area. I can do that but the
>>> text is overwritten by subsequent plots. Is there a way to clear the text
>>> between plots? I would also like to display a grid. Is that possible?
>>>
>>> Below is an outline of my plotting code.
>>>
>>> =========================================
>>> from embedding_in_qt4 import MyMplCanvas
>>>
>>> self.mplEmbed = MyMplCanvas()
>>>
>>> def test(self):
>>> t = arange(0.0, 3.0, 0.01)
>>> s = sin(2*pi*t)
>>> ax = self.mplEmbed.axes
>>> fig = self.mplEmbed.fig
>>> fig.text(0.13, 0.85, "Now is the time", fontsize=10)
>>> fig.suptitle("The quick brown fox")
>>> ax.plot(t, s)
>>> self.mplEmbed.draw()
>>>
>>>
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Matplotlib-users at python.org
>>> https://mail.python.org/mailman/listinfo/matplotlib-users
>>>
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users at python.org
>> https://mail.python.org/mailman/listinfo/matplotlib-users
>>
>
More information about the Matplotlib-users
mailing list