# Error when i run plot example

**URL:** <https://discourse.slicer.org/t/error-when-i-run-plot-example/5928>\
**Category:** Support\
**Created:** [February 26, 2019, 11:59am UTC](https://discourse.slicer.org/t/error-when-i-run-plot-example/5928 "2019-02-26T11:59:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dp1991](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dp1991/32/3142_2.png) [@dp1991](https://discourse.slicer.org/u/dp1991)\
**Post date:** [February 26, 2019, 11:59am UTC](https://discourse.slicer.org/t/error-when-i-run-plot-example/5928/1 "2019-02-26T11:59:50Z")

</div>

hi friends  
i run this example [https://vtk.org/Wiki/VTK/Examples/Cxx/Plotting/ScatterPlot](https://vtk.org/Wiki/VTK/Examples/Cxx/Plotting/ScatterPlot)  
but i receive error  
i attach images that show program and error  
how can i resolve it ??

---

<div class="post-metadata">

**Author:** ![dp1991](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dp1991/32/3142_2.png) [@dp1991](https://discourse.slicer.org/u/dp1991)\
**Post date:** [February 26, 2019, 12:02pm UTC](https://discourse.slicer.org/t/error-when-i-run-plot-example/5928/2 "2019-02-26T12:02:33Z")

</div>

![Untitled](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/c/1c4e256be688fd52fc92148d9c3418a6f3aa92bc.png)

---

<div class="post-metadata">

**Author:** ![dp1991](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dp1991/32/3142_2.png) [@dp1991](https://discourse.slicer.org/u/dp1991)\
**Post date:** [February 26, 2019, 12:04pm UTC](https://discourse.slicer.org/t/error-when-i-run-plot-example/5928/3 "2019-02-26T12:04:15Z")

</div>

![Untitled3](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/a/fa33f6c9041067a993493d3955bd2036587d321d.png)

---

<div class="post-metadata">

**Author:** ![dp1991](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dp1991/32/3142_2.png) [@dp1991](https://discourse.slicer.org/u/dp1991)\
**Post date:** [February 26, 2019, 12:24pm UTC](https://discourse.slicer.org/t/error-when-i-run-plot-example/5928/4 "2019-02-26T12:24:04Z")

</div>

i resolve it by adding  
#include “vtkAutoInit.h”  
VTK\_MODULE\_INIT(vtkRenderingOpenGL2); // VTK was built withvtkRenderingOpenGL2  
VTK\_MODULE\_INIT(vtkInteractionStyle);  
VTK\_MODULE\_INIT(vtkRenderingVolumeOpenGL2);

#pragma warning(disable : 4996)  
before main function  
but i have new error  
“vtkContextDevice2D”  
how to resolve new error ??

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 26, 2019, 12:52pm UTC](https://discourse.slicer.org/t/error-when-i-run-plot-example/5928/5 "2019-02-26T12:52:06Z")

</div>

Hi @dp1991 -

That topic would be better for the VTK discourse:

> **[VTK](https://discourse.vtk.org/)**
>
> A place to discuss VTK development

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [February 26, 2019, 2:57pm UTC](https://discourse.slicer.org/t/error-when-i-run-plot-example/5928/6 "2019-02-26T14:57:19Z")

</div>

Note that you can display plots (line, bar, scatter) in Slicer from Table nodes using Plots module. You can also create a plot from Python as shown in [this example](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Plotting).

---

<div class="post-metadata">

**Author:** ![dp1991](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dp1991/32/3142_2.png) [@dp1991](https://discourse.slicer.org/u/dp1991)\
**Post date:** [February 27, 2019, 5:14am UTC](https://discourse.slicer.org/t/error-when-i-run-plot-example/5928/7 "2019-02-27T05:14:12Z")

</div>

thanks  
i can solve it 🙂
