ENH: vtkScalarBarActor SetFixedLabels method?
One bit of functionality I've missed in VTK compared to other viz packages is the ability to do set ticks to a static set of floats. It looks like in theory all that's needed to do this in VTK is:
- Add a new protected attribute
double * FixedLabels(default null)
- Add a public
SetFixedLabels(int nLabels, double* labels), which internally just calls
- Add one more conditional in vtkScalarBarActor::LayoutTicks to pull
vals from the double array instead of computing them using a linear or logarithmic scale.
- Deal with the non-linearly-spaced positions (if necessary, haven't checked to see if this is necessary, but seems straightfortward).
- Deal with out-of-bounds labels (probably discard them / set them invisible?)
FixedLabels(i.e., set back to "dynamically calculate" mode)
I don't think this would require too many new lines of code, happy to take a stab at implementing it if people agree it would be useful.
An alternative solution is to subclass
vtkScalarBarActor and override
LayoutTicks, but I'm looking to get this working in Python and don't want to have to compile a custom class just for this.