[vtkusers] Change scalarbar labels

Cory Quammen cory.quammen at kitware.com
Mon Aug 10 09:59:10 EDT 2015


VTK 5.4 is now 6 years old, and 5.6 is 4 years old. Can you update to a
more recent version?

On Tue, Aug 4, 2015 at 11:57 AM, Ich <liuyanbc157 at gmail.com> wrote:

> Hi, Cory,
>
> Thank for replying. But I'm using vtk 5.4 now. There is no such a
> SetAnnotation function in
> ScalartoColor Class(I have seen that in vtk 6.x this is this function,
> because what i have done is
> in a project, so i just use vtk 5.6).
>
>  I have tried to override SetLabelFormat() in Class vtkScalarBarActor(),
> if it is just with (with
> python) self.LabelFormat = '***(something else)', it will not change
> Annotation, but LabelFormat
> in this instance is actually changed.
>
> So I think, it must have something happened in function SetLabelFormat(),
> not just with
> self.LabelFormat = '*****'.
> Perhaps if I could see content of this function, perhaps i can change
> annotations freely.
>
> So question is, could you give me some advice in vtk 5.4 for changing
> annotation in scalar bar,.
>
> Or  could you give me the code of this function SetLabelFormat(char*),, in
> vkt5.4 it should be SetMacroString(LabelFormat, char*).
>
> Thanks again for your help.
> Jan
>
> Am 15.07.2015 um 15:51 schrieb Cory Quammen <cory.quammen at kitware.com>:
>
> Jan,
>
> Unless you can figure out the printf formatting string that gives you what
> you want, you'll need to use annotations instead of the labels. You can set
> annotated values with vtkScalarsToColors::SetAnnotation(vtkVariant,
> vtkStdString), e.g.
>
> lookupTable->SetAnnotation(0.0, "0");
> lookupTable->SetAnnotation(0.2, "200e-03");
> etc.
>
> Then you'll need to display the annotations with
>
> vtkScalarBarActor::SetDrawAnnotations(1);
>
> Hope that helps,
> Cory
>
> On Mon, Jul 13, 2015 at 5:31 AM, Jan <liuyanbc157 at gmail.com> wrote:
>
>> Hallo, everyone,
>>
>> Now I want to set new strings in position of scalarbar labels.
>> For example, the range of value is 0 - 1, and with numberofLabels(6). But
>> I
>> want the display instead of 0 0.2 0.4 0.6 0.8 1.0 but with form of 0
>> 200e-03
>> 400e-03 600e-03 800e -03 1.0. The Problem is that FormatofLabels doesn't
>> help
>> support these strings. So what could I do perhaps with
>> AllocateAndSizeLabels() in ScalarbarActor or with other methods to change
>> the
>> format of nummers in this way?
>>
>> Thanks alot.
>>
>> Jan
>>
>> _______________________________________________
>> 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
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
>
>
>


-- 
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150810/8da30e2c/attachment.html>


More information about the vtkusers mailing list