# matplotlib plot inside pvbatch

**URL:** https://discourse.paraview.org/t/matplotlib-plot-inside-pvbatch/7632
**Category:** ParaView Support
**Created:** [July 17, 2021, 8:22pm UTC](https://discourse.paraview.org/t/matplotlib-plot-inside-pvbatch/7632 "2021-07-17T20:22:45Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![bloerp](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/bc79bd/32.png) [@bloerp](https://discourse.paraview.org/u/bloerp)
#### Post date: [July 17, 2021, 8:22pm UTC](https://discourse.paraview.org/t/matplotlib-plot-inside-pvbatch/7632/1 "2021-07-17T20:22:45Z")

</div>

I want to add a matplotlib plot inside paraview. The minimal example would be this:

```auto
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?

---

<div class="post-metadata">

### Author: ![bloerp](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/bc79bd/32.png) [@bloerp](https://discourse.paraview.org/u/bloerp)
#### Post date: [July 22, 2021, 4:17pm UTC](https://discourse.paraview.org/t/matplotlib-plot-inside-pvbatch/7632/2 "2021-07-22T16:17:22Z")

</div>

solved it myself. The code works, but not in 5.6. The Upate to 5.9 did the trick
