-
Notifications
You must be signed in to change notification settings - Fork 38
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
How to plot contour lines on top of animation #114
Comments
Hey @holivarez, sorry for the late reply. And thanks for using the package. I think you are very close to what you want. Generally all you have to do is to wrap your plot into a function with the following signature: func(ds, fig, tt, *args, **kwargs) where Similar to this example. Let me know if this helps |
Hello and thank you for your reply.
I am afraid I am not skilled enough to define the custom_plotfunc in a way that works for my project. I will look for someone to help walk me through this. The example is helpful and I am sure someone will be able to assist me using it.
Thanks again for your time and attention.
Take care,
Holly
Holly Olivarez (she/her)
NSF Graduate Research Fellow
Department of Environmental Studies
Institute of Arctic and Alpine Research (INSTAAR)
University of Colorado Boulder
instaar.colorado.edu/people/holly-olivarez<https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Finstaar.colorado.edu%2Fpeople%2Fholly-olivarez%2F&data=01%7C01%7Ciceleste%40nmsu.edu%7Cc334f0e0680b495e4f3008d73c744f33%7Ca3ec87a89fb84158ba8ff11bace1ebaa%7C1&sdata=al3Yq0xvgDxlnaLBASzEYJ7QC%2BwYaxTJ5FmIASPR3q0%3D&reserved=0>
@holivarez19
From: Julius Busecke ***@***.***>
Date: Tuesday, September 6, 2022 at 4:26 PM
To: jbusecke/xmovie ***@***.***>
Cc: Holly Olivarez ***@***.***>, Mention ***@***.***>
Subject: Re: [jbusecke/xmovie] How to plot contour lines on top of animation (Issue #114)
Hey @holivarez<https://github.com/holivarez>, sorry for the late reply. And thanks for using the package.
I think you are very close to what you want. Generally all you have to do is to wrap your plot into a function with the following signature:
func(ds, fig, tt, *args, **kwargs)
where ds is a dataset or dataarray, fig is a matplotlib.Figure, and tt is a logical timestep.
Similar to this example<https://xmovie.readthedocs.io/en/latest/examples/quickstart.html>.
Let me know if this helps
—
Reply to this email directly, view it on GitHub<#114 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AJOLXOVUWJICQH46EP5VDTTV47AI7ANCNFSM6AAAAAAQBVNIOU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
If you have a fully reproducible example (e.g. a notebook with synthetic data that I can execute on my end), Id be happy to check it out and maybe have a quick zoom call if that helps. |
Thank you for your gracious offer! I’ve set up an example notebook with accompanying netcdf files in Google Colab here: https://colab.research.google.com/drive/18u80C8f4KBEnW4cr5cwG79KJaUGrU9zO?usp=sharing
As I am also new to Google Colab, I’ve also placed a notebook and accompanying netcdf files into my Dropbox account and you may access them here: https://www.dropbox.com/scl/fo/zujivkr7eaowyds9jx6v6/h?dl=0&rlkey=3tnyfybd4uqhecvmwrro2rbhf
Please let me know if you encounter any issues. I welcome a quick Zoom call if it is easier on your time. Thank you for spending time on this.
Thanks again, Julius!
Holly
…--
Holly Olivarez (she/her)
NSF Graduate Research Fellow
Department of Environmental Studies
Institute of Arctic and Alpine Research (INSTAAR)
University of Colorado Boulder
instaar.colorado.edu/people/holly-olivarez<https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Finstaar.colorado.edu%2Fpeople%2Fholly-olivarez%2F&data=01%7C01%7Ciceleste%40nmsu.edu%7Cc334f0e0680b495e4f3008d73c744f33%7Ca3ec87a89fb84158ba8ff11bace1ebaa%7C1&sdata=al3Yq0xvgDxlnaLBASzEYJ7QC%2BwYaxTJ5FmIASPR3q0%3D&reserved=0>
@holivarez19
From: Julius Busecke ***@***.***>
Date: Monday, September 26, 2022 at 6:57 AM
To: jbusecke/xmovie ***@***.***>
Cc: Holly Olivarez ***@***.***>, Mention ***@***.***>
Subject: Re: [jbusecke/xmovie] How to plot contour lines on top of animation (Issue #114)
If you have a fully reproducible example (e.g. a notebook with synthetic data that I can execute on my end), Id be happy to check it out and maybe have a quick zoom call if that helps.
—
Reply to this email directly, view it on GitHub<#114 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AJOLXOUVYCQMLQJ5HFQQAILWAGMUNANCNFSM6AAAAAAQBVNIOU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hello! I have successfully made animations (thank you!) but now am interested in making the animations look like the still figures I create. At the very least, how can I plot contour lines on top of the animations? See below for how I plot a still figure with contours for the top 300m of the ocean. Below the script is the resulting figure (top 300m and 300-6000m). Thank you!
fig,axs = plt.subplots(1,1,figsize=(15,2))
i = plt.pcolor(TLAT_A16, da.z_t, sDIC_NP_A16_plot.sel(time=slice(date1_1,date2_1)).mean('time'), cmap='plasma', vmin=1950, vmax=2450)
j = plt.contour(TLAT_A16, da.z_t, NP_pd_A16.sel(time=slice(date1_1,date2_1)).mean('time'), levels, colors='w', linewidth=2)
plt.clabel(j, fmt='%2.1f', colors='w', fontsize=28)
plt.title('')
plt.xlabel('')
plt.ylabel('')
plt.ylim(300,0) # reverse y-axis
plt.gca().invert_xaxis() # reverse x-axis for Atlantic
plt.tick_params(labelsize=15, length=15, direction='out', tick1On=True, labelbottom=True, labelleft=False)
plt.tick_params(axis='y', left=False)
cb = plt.colorbar()
cb.remove();
The text was updated successfully, but these errors were encountered: