Skip to content

Commit

Permalink
save 3d plot as png
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinAchondo committed Jun 19, 2024
1 parent fcf49fe commit 5d5c878
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions xppbe/Post/Postcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def plot_phi_contour(self, N=100, x0=np.array([0,0,0]), n=np.array([1,0,0]), val
return fig,ax


def plot_interface_3D(self,variable='phi', value='phi', domain='interface', jupyter=False):
def plot_interface_3D(self,variable='phi', value='phi', domain='interface', jupyter=False, ext='html'):

vertices = self.mesh.mol_verts.astype(np.float32)
elements = self.mesh.mol_faces.astype(np.float32)
Expand Down Expand Up @@ -341,7 +341,10 @@ def plot_interface_3D(self,variable='phi', value='phi', domain='interface', jupy
fig.update_layout(scene=dict(aspectmode='data', xaxis_title='X [A]', yaxis_title='Y [A]', zaxis_title='Z [A]'),margin=dict(l=30, r=40, t=20, b=20))

if not jupyter and self.save:
fig.write_html(os.path.join(self.directory, self.path_plots_solution, f'Interface_{variable}_{value}_{domain}.html'))
if ext=='html':
fig.write_html(os.path.join(self.directory, self.path_plots_solution, f'Interface_{variable}_{value}_{domain}.html'))
elif ext=='png':
fig.write_image(os.path.join(self.directory, self.path_plots_solution, f'Interface_{variable}_{value}_{domain}.png'), scale=3)
elif jupyter:
fig.show()
return fig
Expand Down

0 comments on commit 5d5c878

Please sign in to comment.