I fail to set different label format for each axis in vtkCubeAxesActor2D.
When I run CubeAxesActor2D example and replace line
axes2->SetLabelFormat("%6.4g");
by
axes2->GetXAxisActor2D()->SetLabelFormat("%3.1f");
format for the X axis is not changed but all axes share the same default format i.e. “6.3g”.
I had the same problem and resorted to subclassing vtkCubeAxisActor2D. This is the code I used to obtain a specific label format only for the Z axis. This was back with VTK 7.0 and I can’t say if the current version provides an easier way to achieve this.
// Extends vtkCubeAxesActor2D to allow separated adjustment in the number of decimal places along the Z axis.
class vtkFormatZLabelCubeAxesActor2D : public vtkCubeAxesActor2D
{
public:
static vtkFormatZLabelCubeAxesActor2D *New()
{
return new vtkFormatZLabelCubeAxesActor2D;
}