Change title of st.plot

Is it possible to change the title included when I plot a stream with st.plot?

If I use

this = st.plot(…)

I get a figure object, when I think I need an axes object in order to change the title.

I’ll try to post fewer questions from now on.

You can access the Axes in a Figure with fig.axes[0] etc, its a list of Axes objects, so you might want the first one, very likely. The title displayed could be the figure title though, not sure. That or the first Axes.

Thanks. You are a star.

If anyone else is interested, fig.axes[0].set_title() adds a new title below the usual one.

That’s good enough for me.

We use fig.suptitle() to set that title, so it seems you’d have to look in fig.texts if you want to change the original title:

In [1]: fig, ax = plt.subplots()

In [2]: fig.suptitle("blap")
Out[2]: Text(0.5, 0.98, 'blap')

In [3]: fig.texts
Out[3]: [Text(0.5, 0.98, 'blap')]

In [4]: fig.texts[0].set_text('heya')

In [5]: fig.texts
Out[5]: [Text(0.5, 0.98, 'heya')]
1 Like