I want to add a matplotlib plot inside paraview. The minimal example would be this:
from paraview.simple import * myScript = """ from paraview import python_view def render(view, width, height): fig = python_view.matplotlib_figure(width, height) ax = fig.add_subplot(1,1,1) ax.set_title('Plot title') ax.set_xlabel('X label') ax.set_ylabel('Y label') return python_view.figure_to_image(fig) """ plotCurve = CreateView('PythonView') plotCurve.ViewSize = [3840, 2048] plotCurve.Script = myScript SaveScreenshot('test.png',plotCurve)
copying “myScript” into a python view inside paraview itself works but fails if i call the script above with pvbatch. Which is what i want to do. It saves a 400x400 image and seems to ignore ViewSize. Might someone know how to fix this?