Fanning Software Consulting

Colorbar Label Formats

QUESTION: Your cgColorbar program is great, but the labels are always integers. How can I make the labels appear as floating point numbers?

ANSWER: Use the FORMAT keyword to make the label format anything you like. To make a floating point format with two digits to the right of the decimal, you can create the color bar like this.

   IDL> cgColorbar, Range=[0,100], Divisions=5, Font=0, Format='(F0.2)'
The color bar labeled with floating point values.
The color bar labeled with floating point values.
 

Version of IDL used to prepare this article: IDL 7.1.

Written: 7 October 2011