Bug in vtkAxisActor2D::SetTitle()?

I’m running VTK-9.2 for C++.
My code creates a vtkCubeAxesActor2D, and sets data range and title for x, y, and z axes. The ranges are displayed properly, but titles display as ‘X’, ‘Y’, and ‘Z’ (defaults?) instead of ‘Longitude’, ‘Latitude’, and ‘Depth’. Here is the code:

  xUnits = "Longitude";
  yUnits = "Latitude";
  zUnits = "Depth";
  qDebug() << "set x-axis label to " << xUnits;
  qDebug() << "set y-axis label to " << yUnits;  
  qDebug() << "set z-axis label to " << zUnits;    

  qDebug() << "actual x-axis label now is " <<

The output is:

set x-axis label to  Longitude
set y-axis label to  Latitude
set z-axis label to  Depth
actual x-axis label now is  Longitude

But the display shows axes labeled as “X”, “Y”, and “Z”.
Anyone know what I am doing wrong? Or is there a bug in vtkAxisActor2D::SetTitle()?


Try calling RenderOpaqueGeometry( vtkViewport* ) on each of your vtkAxisActor2D objects after setting the title strings. After studying the source code of vtkAxisActor2D it seems to me that changing the title doesn’t trigger an update.

take care,


1 Like

Calling RenderOpaqueGeometry() didn’t fix the problem, but I might be using that function incorrectly. What do I pass as an argument to RenderOpaqueGeometry() in this case? My pipeline includes a single vtkRenderer instance, and I am passing that as the argument for each vtkAxisActor2D.

Try passing your vtkRenderer. vtkRenderer is a vtkViewport subclass.

Yes I am passing my vtkRenderer instance but the problem persists.

Try calling the Set[X|Y|Z]Label() methods of the vtkCubeAxesActor2D itself.

1 Like

Yes, calling vtkCubeAxesActor2D::Set[X][Y][Z]Label() methods works, with no need to force an update. Thanks!
So is there a bug in vtkAxisActor2D::SetTitle()?

My tests also seem to indicate that vtkAxisActor2D::SetRange(min, max) also has no effect. Can you verify? Thanks!

Possibly, but that’s not the way supposed to change the axes titles, so I wouldn’t call it a bug.

1 Like

Please, start another thread for that. Thanks.

1 Like