[vtkusers] Re: Change color of axes
goodwin.lawlor at ucd.ie
Thu Jan 20 17:45:08 EST 2005
You might find it easier to do it this way (and maybe vtkAxes should be
changed to do it this way...)
# Get rid of the point scalars
[[axes GetOutput] GetPointData] SetScalars ""
# Set up and use some cell scalars... can use RGB values
colors SetNumberOfComponents 3
colors SetNumberOfTuples 3
#to set the x axes to red (rgb = 255 0 0)
colors SetTuple3 0 255 0 0
#to set the y axis to yellow (rgb = 255 255 0)
colors SetTuple3 1 255 255 0
#to set the z axis to green (rgb = 0 255 0)
colors SetTuple3 2 0 255 0
[[axes GetOutput] GetCellsData] SetScalars colors
If the Java color chooser gives you 3 numbers between 0 and 1, multiply them
by 255 to get the correct values for the "colors" array.
----- Original Message -----
From: "Kanghong Li" <kli at issi-hsv.com>
To: "Goodwin Lawlor" <goodwin.lawlor at ucd.ie>
Sent: Thursday, January 20, 2005 10:10 PM
Subject: Re: Change color of axes
> Thanks. I was wondering if this can be done dynamically? Like if user
> selects colors for the X,Y,Z axes from Java color chooser, can I update
> axes graph based on their selection? How do I obtain current graph's axes?
> Also there might be a mapping problem between the value returned by the
> color chooser and the scalar values that VTK uses.
> Sorry, this might be something simple for you, but I am stuck and I am new
> to VTK.
> Thanks so much for your help.
> ----- Original Message -----
> From: "Goodwin Lawlor" <goodwin.lawlor at ucd.ie>
> To: <kli at issi-hsv.com>
> Sent: Tuesday, January 18, 2005 5:58 PM
> Subject: Re: Change color of axes
> > Change the values of the point data scalars to a number between 0 and 1.
> > The default is 0 0 0.25 0.25 0.5 0.5 (there are six scalars for the 6
> > points... 2 for each line)
> > 0 = red
> > 0.25 = yellow
> > 0.5 = green
> > (1.0 = blue)
> > These values are indexes into the default lookup table.
> > So to change the green axis to blue:
> > vtkAxes axes
> > axes Update
> > set scalars [[[axes GetOuput] GetPointData] GetScalars]
> > $scalars SetTuple1 4 1.0
> > $scalars SetTuple1 5 1.0
> > hth
> > Goodwin
> > "Kanghong Li" <kli at issi-hsv.com> wrote in message
> > news:000501c4fdb3$2802c520$7b01a8c0 at SUN...
> > > How can we change the defaut colors (red(x), yellow(y), green(z)) of
> > > vtkaxes? Thanks.
> > >
> > > _______________________________________________
> > > This is the private VTK discussion list.
> > > Please keep messages on-topic. Check the FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> > > Follow this link to subscribe/unsubscribe:
> > > http://www.vtk.org/mailman/listinfo/vtkusers
> > >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 16/01/2005
More information about the vtkusers