# Plot's axes not shown in Slicer 4.13 (but works with 4.11)

**URL:** <https://discourse.slicer.org/t/plots-axes-not-shown-in-slicer-4-13-but-works-with-4-11/21486>\
**Category:** Development\
**Created:** [January 16, 2022, 6:27pm UTC](https://discourse.slicer.org/t/plots-axes-not-shown-in-slicer-4-13-but-works-with-4-11/21486 "2022-01-16T18:27:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [January 16, 2022, 6:27pm UTC](https://discourse.slicer.org/t/plots-axes-not-shown-in-slicer-4-13-but-works-with-4-11/21486/1 "2022-01-16T18:27:30Z")

</div>

Hi,

I wanted to report that in **Slicer 4.13.0-2021-08-27** plot’s axes are not visible but in the same time **Slicer 4.11.20210226** (stable release as I remember) works fine:  
The code I have used is [from the documentation](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Plots#Constructing_a_plot)  
**Ubuntu 20.04**

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/e/ce60f3619d8dba96606918cc1f916cc8d6b156d2.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/2/42d42e50251190b42972c6b19f4391d810a7aa20.png)

---

<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:** [January 16, 2022, 9:15pm UTC](https://discourse.slicer.org/t/plots-axes-not-shown-in-slicer-4-13-but-works-with-4-11/21486/2 "2022-01-16T21:15:52Z")

</div>

Thanks for reporting 👍

The axes are visible in a recent preview on mac.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/5/759184b146d5cab3c517204031f6909f66bddb30.png)

But on my ubuntu 20.04 with a current build I get the missing axes and this message:

```auto
Generic Warning: In /home/pieper/slicer4/latest/Slicer-superbuild/VTK/Rendering/OpenGL2/vtkOpenGLFramebufferObject.cxx, line 1390
failed at glBlitFramebuffer 1 OpenGL errors detected
  0 : (1282) Invalid operation

Generic Warning: In /home/pieper/slicer4/latest/Slicer-superbuild/VTK/Rendering/OpenGL2/vtkOpenGLFramebufferObject.cxx, line 1390
failed at glBlitFramebuffer 1 OpenGL errors detected
  0 : (1282) Invalid operation

```

This looks like a VTK incompatibility of some kind. It would be good to check if it can be reproduced in pure VTK and reported there.

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [January 16, 2022, 9:43pm UTC](https://discourse.slicer.org/t/plots-axes-not-shown-in-slicer-4-13-but-works-with-4-11/21486/3 "2022-01-16T21:43:04Z")

</div>

Forget to mention that I also get this error.

> [@pieper](#):
>
> This looks like a VTK incompatibility of some kind. It would be good to check if it can be reproduced in pure VTK and reported there.

To clarify a little: you mean to build Slicer with [VTK from original git repository](https://github.com/Kitware/VTK) tagged under `v9.1.0`? If so I think I could do that.  
As I can see Slicer uses custom VTK from Slicer’s repo

---

<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:** [January 16, 2022, 10:39pm UTC](https://discourse.slicer.org/t/plots-axes-not-shown-in-slicer-4-13-but-works-with-4-11/21486/4 "2022-01-16T22:39:42Z")

</div>

I meant it would be good to know if this is an issue with VTK itself, or something related to Slicer’s edits or the way we build it. You could try starting with a pure VTK example to see if you get the same issues.

[https://kitware.github.io/vtk-examples/site/Cxx/Plotting/LinePlot/](https://kitware.github.io/vtk-examples/site/Cxx/Plotting/LinePlot/)

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [January 16, 2022, 11:10pm UTC](https://discourse.slicer.org/t/plots-axes-not-shown-in-slicer-4-13-but-works-with-4-11/21486/5 "2022-01-16T23:10:19Z")

</div>

It seems that VTK 9 which is used by [Slicer](https://github.com/slicer/VTK.git) under git tag `98d686bb509f46543ebe04fdd5d120fdab87893b` (slicer-v9.0.20201111-733234c785-v3) works fine with the given example:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/f/dff9c079f13dc33c3cdd7c50b111eb4cd9eb1472.png)

I should mention that the script given by VTK is in fact needed as without it the app breaks at start:

```cmake
  # vtk_module_autoinit is needed
  vtk_module_autoinit(
    TARGETS LinePlot
    MODULES ${VTK_LIBRARIES}
    )

```

the error without `vtk_module_autoinit`:  
**2022-01-17 02:04:48.988 ( 0.051s) [5E1A0940] vtkContextDevice2D.cxx:32 WARN| Error: no override found for ‘vtkContextDevice2D’.  
Segmentation fault (core dumped)**

---

<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:** [January 17, 2022, 1:42pm UTC](https://discourse.slicer.org/t/plots-axes-not-shown-in-slicer-4-13-but-works-with-4-11/21486/6 "2022-01-17T13:42:40Z")

</div>

Thanks for checking - this suggests maybe it’s something about VTK and Qt at the OpenGL level. If you have more time to look at this you might explore porting that example to CTK or ideally a native VTK/Qt example to see what exactly is broken.

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [January 17, 2022, 4:26pm UTC](https://discourse.slicer.org/t/plots-axes-not-shown-in-slicer-4-13-but-works-with-4-11/21486/7 "2022-01-17T16:26:33Z")

</div>

Hi,

I just downloaded the [VTK Qt BarChartQt example](https://kitware.github.io/vtk-examples/site/Cxx/Qt/BarChartQt/) and build it preliminary added `find_package(Slicer REQUIRED)` to the `CMakeLists.txt`. This allows to find VTK and Qt that were used to compile Slicer (Slicer’s custom VTK).  
The example works fine:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/a/eaaffdd24d7a230817e8f00f7936237ae75e709f.png)

The example uses `QVTKOpenGLNativeWidget` and sets `QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());`  
I don’t know how excatly OpenGL related staff works but here are my thoughts (I write this maybe because probably I will refer to this later):

- [qMRMLWidget](https://github.com/Slicer/Slicer/blob/cb3a1ff14fac3419f3e3f08632a6cac6bedb52ca/Libs/MRML/Widgets/qMRMLWidget.cxx#L89-L129) set some `QSurfaceFormat` property and it differs for Windows;

- Slicer uses `QVTKOpenGLNativeWidget` through `ctkVTKOpenGLNativeWidget` (inherits `QVTKOpenGLNativeWidget`) wich in concluded in macros and in my case it looks this way:  

- `ctkVTKChartView` inherits from `ctkVTKOpenGLNativeWidget`

- `qMRMLPlotView` inherits from `ctkVTKChartView`

I have tested all of these VTK OpenGL widgets (`QVTKOpenGLNativeWidget`, `ctkVTKOpenGLNativeWidget`, `ctkVTKChartView`, `qMRMLPlotView`) and all of them work.

I uploaded this slightly modified [BarChartQt\_Slicer](https://drive.google.com/file/d/1rsf60p6llagFHoN-ECHLlgA_vdO2EPSd/view?usp=sharing) example so you can try to configure and build it using `cmake .. -DSlicer_DIR=/path/to/Slicer-build` and the application should be run from Slicer environment `./Slicer --launch BarChartQt` (I usually laucn vscode this way `./Slicer --launch code` and then I can simply run the app using `./BarChartQt` from the build folder)

The modifications are made in `CMakeLists.txt` aimed to find Slicer and CTK and link them.  
And in `BarChartQt` where I do `include <>` and delete `QVTKOpenGLNativeWidget` and create any derived widget (code lines 50-107).

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [March 15, 2022, 11:42pm UTC](https://discourse.slicer.org/t/plots-axes-not-shown-in-slicer-4-13-but-works-with-4-11/21486/8 "2022-03-15T23:42:31Z")

</div>

I just rebuilt Slicer with the newest commit [d14f18f386f83943d6717cedb5d18f1ce423cada](https://github.com/Slicer/Slicer/commit/d14f18f386f83943d6717cedb5d18f1ce423cada) and noticed the problem seems to be solved.

Thank you

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [March 17, 2022, 1:20pm UTC](https://discourse.slicer.org/t/plots-axes-not-shown-in-slicer-4-13-but-works-with-4-11/21486/9 "2022-03-17T13:20:45Z")

</div>

Oh, it seems I simply didn’t notice the warnings even though the axes are shown:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/f/4f0295eec67dbddf96e99fa5038439b24cdcf146.png)

```auto
Generic Warning: In /home/kerim/Documents/Colada/d/VTK/Rendering/OpenGL2/vtkOpenGLState.cxx, line 1069
Error glEnable/Disable1 OpenGL errors detected
  0 : (1282) Invalid operation

 with stack trace of
0x7f7d4638400c : ??? [(???) ???:-1]
0x7f7d4637e921 : vtksys::SystemInformation::GetProgramStack[abi:cxx11](int, int) [(libvtksys-9.1.so.1) ???:-1]
0x7f7d50c7a03a : ??? [(???) ???:-1]
0x7f7d50c7ddb2 : vtkOpenGLState::SetEnumState(unsigned int, bool) [(libvtkOpenGL-9.1.so.1) ???:-1]
0x7f7d50b02707 : ??? [(???) ???:-1]
0x7f7d50c812d3 : vtkOpenGLState::vtkglBlitFramebuffer(int, int, int, int, int, int, int, int, unsigned int, unsigned int) [(libvtkOpenGL-9.1.so.1) ???:-1]
0x7f7d50d19897 : vtkTextureObject::CopyFromFrameBuffer(int, int, int, int, int, int) [(libvtkOpenGL-9.1.so.1) ???:-1]
0x7f7d50b946c0 : vtkOpenGLFXAAFilter::LoadInput() [(libvtkOpenGL-9.1.so.1) ???:-1]
0x7f7d50b939c3 : vtkOpenGLFXAAFilter::Execute(vtkOpenGLRenderer*) [(libvtkOpenGL-9.1.so.1) ???:-1]
0x7f7d50c5689c : vtkOpenGLRenderer::UpdateGeometry(vtkFrameBufferObjectBase*) [(libvtkOpenGL-9.1.so.1) ???:-1]
0x7f7d50c55a51 : vtkOpenGLRenderer::DeviceRender() [(libvtkOpenGL-9.1.so.1) ???:-1]

and it continues for many many lines

```

---

<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:** [March 17, 2022, 3:39pm UTC](https://discourse.slicer.org/t/plots-axes-not-shown-in-slicer-4-13-but-works-with-4-11/21486/10 "2022-03-17T15:39:23Z")

</div>

You can try disabling FXAA anti-aliasing and see if the messages go away. It is turned on in Slicer or CTK, you should be able to find it by searching for FXAA.
