Can I fd.tripcolor a part of the data in pressure field function? #3720
Replies: 4 comments 1 reply
-
I think ParaView will simplify the section crop for you. Just write the following code:
|
Beta Was this translation helpful? Give feedback.
-
Firedrake plotting uses
You can find many use cases in the notebooks: notebooks |
Beta Was this translation helpful? Give feedback.
-
many thanks!!!🙏
Sent from Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: ksagiyam ***@***.***>
Sent: Friday, August 2, 2024 3:30:17 PM
To: firedrakeproject/firedrake ***@***.***>
Cc: Wu, Yifan ***@***.***>; Author ***@***.***>
Subject: Re: [firedrakeproject/firedrake] Can I fd.tripcolor a part of the data in pressure field function? (Discussion #3720)
This email from ***@***.*** originates from outside Imperial. Do not click on links and attachments unless you recognise the sender. If you trust the sender, add them to your safe senders list<https://spam.ic.ac.uk/SpamConsole/Senders.aspx> to disable email stamping for this address.
Firedrake plotting uses matplotlib, so you can do everything that matplotlib allows you to do. Something like the following should work:
import matplotlib.pyplot as plt
fig, axes = plt.subplots()
tripcolor(p_field_00[1000], axes=axes)
axes.set_xlim(left=-1.0, right=0.0)
You can find many use cases in the notebooks: notebooks<https://www.firedrakeproject.org/notebooks.html>
—
Reply to this email directly, view it on GitHub<#3720 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BDENNF4FJIW26FKBV4LNYC3ZPOJXTAVCNFSM6AAAAABL4P3GAGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAMRSGQ2TMNQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I found that the output of print(p_field_1[1000].dat.data) is a 1D array. However, we can only plot the graph using fd.tripcolor. Is there any way to convert it to a 2D array so that I can plot the graph using imshow or other methods? Many thanks! |
Beta Was this translation helpful? Give feedback.
-
Hello, I am struggling ploting the pressure field. I have my model code as below:
and I want to plot the p-field using:
The picture looks like the following:
. However, I only want to display a part of this image, specifically the region from 0 to -1 instead of the entire range from 0 to -1.75. How can I use fd.tripcolor to crop this section of the graph?
Many thanks for the help!!!!
Beta Was this translation helpful? Give feedback.
All reactions