[Matplotlib-users] (no subject)

Thomas Caswell tcaswell at gmail.com
Mon Aug 10 15:44:49 CEST 2015


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20150810/60094f6c/attachment.html>


More information about the Matplotlib-users mailing list