[vtkusers] Scalar bar with discrete values

Jothybasu Selvaraj jothybasu at gmail.com
Fri Feb 24 11:27:54 EST 2012


SettingNumberOfColors and No. of values does give me a scalar bar lie the
one shown in the attached screeshot!

I don't understad what you are looking for.

Have you set both value and label no.?

Jothy

On Fri, Feb 24, 2012 at 3:04 PM, Karl Merkley <karl at elemtech.com> wrote:

> Setting the number of labels does help but it doesn't give me the discrete
> values on the scalar bar.    For example, if I have three discrete values
> .4, .5, 1.25.   The scalar bar displays .4 .825, 1.25.    The .825 appears
> to be just average of the minimum and the maximum for the three value case.
>
> Looking the source code for vtkScalarBarActor::AllocateAndSizeLabels(...),
> it looks like the interior values of scalar bar are a function of  the
> range and the number of labels.  There is no way to specify the discrete
> values.    It looks like I will have to subclass vtkScalarBarActor and
> overload AllocateAndSizeLabels.  Fortunately, it is a virtual method!
>
>    -- Karl
>
> On Feb 23, 2012, at 2:33 AM, Jothybasu Selvaraj wrote:
>
> You could do that by
>
> //For 10 labels
> scalarBar->SetMaximumNumberOfColors(10);
> scalarBar->SetNumberOfLabels(10);
>
> Jothy
>
> On Thu, Feb 23, 2012 at 12:10 AM, Karl Merkley <karl at elemtech.com> wrote:
>
>>
>> I have a set of discrete values (thicknesses) that I want to describe
>> with a scalar bar.   Each color has exactly one value associated with it.
>> When I set up my scalar bar it has a range defined by each color.    Is
>> there a way to get a single label drawn at the center of the color range
>> instead of labels at the tops and bottoms of each range?
>>
>>  Thanks,
>>     Karl
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>
>
>
> --
> Jothy
>
>  _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
> ---------------------------
> Karl Merkley, Ph.D.
>
> Elemental Technologies, Inc.
> Computational Simulation Software, LLC
> www.csimsoft.com
>
> Office:  1-801-756-1972, ext 1
>
>
>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>


-- 
Jothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120224/730bc888/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ScalarBar.PNG
Type: image/png
Size: 3869 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120224/730bc888/attachment.png>


More information about the vtkusers mailing list