Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify plots #2

Open
hilarych opened this issue Oct 19, 2021 · 4 comments
Open

Modify plots #2

hilarych opened this issue Oct 19, 2021 · 4 comments

Comments

@hilarych
Copy link
Collaborator

Hi Malcolm, is there a way to modify figures created by the .plot() function currently?
I just want to modify the title or add something to the plot.
I am wondering can the function return the created ax or fig instance so we can put it in another figure?

@malcolmw
Copy link
Owner

Hi, @hilarych, It currently returns the created Axes object. You can always get the Axes or Figure object using the plt.gca() and plt.gcf() functions, respectively.

We can also update the method to, for example, accept ax as a keyword argument and create the plot using the provided ax.

@malcolmw
Copy link
Owner

Once the Axes object is created, it is bound to the Figure that contains it; you can't add it to another Figure. So we would need to update the method if you want to use it to create subplots.

@hilarych
Copy link
Collaborator Author

I see! I was looking at the obspy trace plot function. It has an argument like ax=ax (or fig=fig) that plot the ax to the current figure. But it does not look like something that can be implemented very quickly. So I think I can just trim the data and plot it myself! Thanks. :)

@malcolmw
Copy link
Owner

I need to re-write some code to uniformly handle geophone and DAS data, and I will add this feature when I do that; it isn't too difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants