Skip to content

Conversation

@prmukherj
Copy link
Collaborator

"save_graphic" for matplotlib windows was producing erroneous results. The behavior has been corrected now.

Sample usage:
From the example script generate two pyvista and two matplotlib plots and display them:

graphics = Graphics(session=solver_session)
mesh1 = graphics.Meshes["mesh-1"]
mesh1.show_edges = True
mesh1.surfaces_list = ["in1", "in2", "in3", "out1", "solid_up:1", "solid_up:1:830", "solid_up:1:830-shadow"]
mesh1.display("window-1")
mesh1.show_edges = False
mesh1.display("window-2")

and

plots_session_1 = Plots(solver_session)
xy_plot = plots_session_1.XYPlots["xy-plot"]
xy_plot.surfaces_list = ["outlet"]
xy_plot.y_axis_function = "temperature"
xy_plot.plot("window-9")
matplotlib_plots1 = Plots(solver_session)
residual = matplotlib_plots1.Monitors["residual"]
residual.monitor_set_name = "residual"
residual.plot("window-10")

Now try:
(for saving matplotlib figures):

from ansys.fluent.visualization.matplotlib import matplot_windows_manager
matplot_windows_manager.save_graphic(window_id="window-9",format="PNG")
matplot_windows_manager.save_graphic(window_id="window-10",format="PNG")

(for saving pyvista figures):

from ansys.fluent.visualization.pyvista import pyvista_windows_manager
pyvista_windows_manager.save_graphic(window_id="window-1",format="pdf")
pyvista_windows_manager.save_graphic(window_id="window-2",format="pdf")

@prmukherj prmukherj merged commit c61ca46 into main Aug 23, 2024
@prmukherj prmukherj deleted the fix/save_graphic_for_matplotlib branch August 23, 2024 07:39
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

Successfully merging this pull request may close these issues.

Problem located in ... saving multiple plot objects by using "save_graphic"

4 participants