# MatplotlibDeprecationWarning when render math equation

**URL:** https://discourse.vtk.org/t/matplotlibdeprecationwarning-when-render-math-equation/8288
**Category:** Support
**Created:** [April 13, 2022, 2:07am UTC](https://discourse.vtk.org/t/matplotlibdeprecationwarning-when-render-math-equation/8288 "2022-04-13T02:07:53Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhang-qiang-github/32/2519_2.png) [@zhang-qiang-github](https://discourse.vtk.org/u/zhang-qiang-github)
#### Post date: [April 13, 2022, 2:07am UTC](https://discourse.vtk.org/t/matplotlibdeprecationwarning-when-render-math-equation/8288/1 "2022-04-13T02:07:53Z")

</div>

I want to render math equation in my application. The minimal code is:

```auto
import vtkmodules.all as vtk

text = vtk.vtkTextActor()
text.SetInput('Cell1 | Cell2 | $\\sum_{i=0}^\\infty x_i$\n12 | $\\sum_{i=0}^\\infty x_i$ | 2345')
text.SetDisplayPosition(100, 100)
property = text.GetTextProperty()
property.SetFontSize(20)

render = vtk.vtkRenderer()
render.AddActor(text)
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(render)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
iren.Initialize()
iren.Start()

```

It can correctly render the math equation as following:

![image](https://discourse.vtk.org/uploads/default/original/2X/8/84023e3ebd1c166b63ec61e27aed16e7d124dd66.png)

However, it also report a warning:

```auto
MatplotlibDeprecationWarning: 
The MathtextBackendBitmap class was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use mathtext.math_to_image instead.
  iren.Start()

```

Why this warning is reported?

The environment is:

```auto
win 10
python 3.9.12
vtk 9.1.0 
matplotlib 3.5.1

```

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.vtk.org/user_avatar/discourse.vtk.org/danlipsa/32/390_2.png) [@danlipsa](https://discourse.vtk.org/u/danlipsa)
#### Post date: [April 13, 2022, 2:26pm UTC](https://discourse.vtk.org/t/matplotlibdeprecationwarning-when-render-math-equation/8288/2 "2022-04-13T14:26:05Z")

</div>

It seems that VTK implementation uses a deprecated matplotlib function. The warning tells us where the problem is and how to fix it. Please file a bug report with this warning  
[https://gitlab.kitware.com/vtk/vtk/-/issues](https://gitlab.kitware.com/vtk/vtk/-/issues)

Dan
