[vtkusers] How do I change color of vtkCubeAxesActor2D axes

jean-michel.rouet at philips.com jean-michel.rouet at philips.com
Thu Sep 30 09:29:12 EDT 2004


This works well for setting all of the axis and labels and titles with the 
same common color.
Unfortunately, the implementation of the vtkCubeAxesActor2D does not allow 
setting different color for each axis.
I tried using 
axesActor->GetXAxisActor2D->GetProperty()->SetColor(1,0,0);
axesActor->GetYAxisActor2D->GetProperty()->SetColor(0,1,0);
axesActor->GetZAxisActor2D->GetProperty()->SetColor(0,0,1);
but this does not work. 
The vtkCubeAxisActor2D class always copies the properties from the 
axesActor object the the 3 different axis during the rendering process.

Is there a way to avoid that ?

Regards,
JM

On Jan 6 2004, Christopher M. Navarro wrote:
> Hi Maynard,
>
> The vtkCubeAxesActor provides some methods to get at the pieces 
> controlling the properties of the object.  For instance, you can change 
> the color of the axes by doing:
> 
> axesActor->GetProperty()->SetColor(0.0, 0.0, 0.0);
> 
> You can access the text properties similarly with:
> 
> axesActor->GetAxisLabelTextProperty()->SetColor(...);
> 
> You will need to look at the vtk documentation to see what methods are 
> available and then look at the returned objects documentation...for 
> instance the GetAxisLabelTextProperty returns a vtkTextProperty so you 
> will need to find out what methods that object has available, and so 
> forth.  Hope that helps.
> 
> regards,
>
> chris




More information about the vtkusers mailing list