This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Saving plots remotely

+1 vote

Sorry, new to FEniCS and this forum, I hope this question is appropriate.
I am trying to run FEniCS remotely and save figures to view later (I don't want to use X11 forwarding). Right now I use the 'plot' command and then the 'write_pdf' command. Is there any way to save figures without FEniCS trying to open a plot window (because it seems like that's what's causing my problems and I don't need/want it to do that).
Thanks!

asked Mar 11, 2017 by sclay99 FEniCS Novice (210 points)

1 Answer

+2 votes

I recommend you do not use FEniCS for plotting. Rather, save your data to disk and visualise in another package such as paraview or visit.

answered Mar 13, 2017 by nate FEniCS Expert (17,050 points)
edited Mar 13, 2017 by nate

Thank you for the answer! I was actually looking into this after getting frustrated with FEniCS plotting (can't figure out how to turn off interactivity). What about using matplotlib to save pdfs?

Someone may be able to answer your question, but the plotting support built into FEniCS is limited. I believe that VTK support is scheduled for deprecation also (someone may correct me on this).

You can indeed use matplotlib to save pdfs,

import matplotlib.pyplot as plt
parameters['plotting_backend'] = 'matplotlib'

.... some fenics code

plt.savefig("myfig.pdf")
...