02_user_tutorials:plotting:colorbar-measuringstick
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| 02_user_tutorials:plotting:colorbar-measuringstick [2025/12/10 13:14] – removed - external edit (Unknown date) 127.0.0.1 | 02_user_tutorials:plotting:colorbar-measuringstick [2025/12/10 17:27] (current) – gaetan | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ~~NOTOC~~ | ||
| + | {{howhard> | ||
| + | |||
| + | ====== Color bars and measuring sticks ====== | ||
| + | |||
| + | ===== Color bars and colour maps ===== | ||
| + | |||
| + | False colouring is a common tool, for instance, to visualize different light absorption, temperature distribution etc. The right choice of proper colour map can make the difference between a great intuitive understandable figure or just some usual plot. GroIMP provides for this purpose the ColorGradient class, in which several common colour maps are predefined. It further supports the definition of user-defined gradients and even different interpolation methods between the colours. | ||
| + | |||
| + | The set of predefined colour maps include the following maps: | ||
| + | |||
| + | // | ||
| + | // | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | To define a // | ||
| + | |||
| + | <code java> | ||
| + | // colour map, min, max | ||
| + | const ColorGradient colorMap = new ColorGradient(" | ||
| + | |||
| + | protected void init() [ | ||
| + | Axiom ==> | ||
| + | for(int i:(0:50)) ( | ||
| + | [Null(0, | ||
| + | ); | ||
| + | ] | ||
| + | </ | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | Beside the predefined colour maps, user-defined sequences of colours can be used. To define a user-defined colour gradient, one need to define an array of //Colour// objects and provide it to the // | ||
| + | |||
| + | <code java> | ||
| + | import java.awt.Color; | ||
| + | |||
| + | // colour map, min, max | ||
| + | const Color[] colors = new Color[] {Color.BLACK, | ||
| + | Color.decode("# | ||
| + | const ColorGradient colorMap = new ColorGradient(colors, | ||
| + | |||
| + | protected void init() [ | ||
| + | Axiom ==> | ||
| + | for(int i:(0:50)) ( | ||
| + | [Null(0, | ||
| + | ); | ||
| + | ] | ||
| + | </ | ||
| + | |||
| + | The resulting gradient should look like this: | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | |||
| + | The // | ||
| + | |||
| + | <code java> | ||
| + | ColorGradient cMap_linRGB = new ColorGradient(" | ||
| + | ColorGradient cMap_bSplineRGB = new ColorGradient(" | ||
| + | ColorGradient cMap_bezRGB = new ColorGradient(" | ||
| + | ColorGradient cMap_bSplineLab = new ColorGradient(" | ||
| + | ColorGradient cMap_bezLab = new ColorGradient(" | ||
| + | ColorGradient cMap_bezLabL = new ColorGradient(" | ||
| + | </ | ||
| + | |||
| + | The differences between the interpolation methods are quite recognizable for the human eye. Especially the linear RGB interpolations showing recognizable gaps compared to the luminescence based La*b* colour space interpolations are very harmonic. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | |||
| + | ===== Measuring sticks ===== | ||
| + | |||
| + | Any false colour representation without a legend as reference is not complete. GroIMP here provides a Library-function called // | ||
| + | |||
| + | Reference objects as measuring sticks are a simple but effective tool to give the use a visual feedback to compare dimensions. GroIMP provides for this purpose a parametrizable measuring sticks - defined as function within the //Library// class. | ||
| + | |||
| + | <code java> | ||
| + | // HSV colour map, min, max | ||
| + | const ColorGradient colorMap = new ColorGradient(" | ||
| + | |||
| + | protected void init() [ | ||
| + | Axiom ==> | ||
| + | [ | ||
| + | ColorBar(colorMap, | ||
| + | ] | ||
| + | [ | ||
| + | Null(0.5, 0, 0) // move 0.5m | ||
| + | MeasuringStick(10, | ||
| + | ]; | ||
| + | ] | ||
| + | </ | ||
| + | |||
| + | {{ : | ||
