Stateful colorbar rendering (matplotlib-style).
Implements: - Plot-area splitting for right/left/top/bottom colorbar placement - Scalar-mappable detection (pcolormesh/scatter/contour) - Gradient rendering + ticks/labels using existing primitives
Target tick count for the colorbar long axis, sized to the bar's pixel length like matplotlib's length-aware MaxNLocator. matplotlib allows roughly one tick per ~40 px (its default ~0.4 in spacing at 100 dpi), then snaps to a nice step. A fixed count (e.g. 5) yields coarse steps (0.5) on tall bars where matplotlib renders 0.2.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(in) | :: | vertical | |||
| type(plot_area_t), | intent(in) | :: | plot_area |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(plot_context), | intent(inout) | :: | backend | |||
| character(len=*), | intent(in) | :: | location | |||
| real(kind=wp), | intent(in) | :: | fraction | |||
| real(kind=wp), | intent(in) | :: | pad | |||
| real(kind=wp), | intent(in) | :: | shrink | |||
| type(plot_area_t), | intent(out) | :: | saved_area | |||
| type(plot_area_t), | intent(out) | :: | main_area | |||
| type(plot_area_t), | intent(out) | :: | colorbar_area | |||
| logical, | intent(out) | :: | supported |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(plot_data_t), | intent(in) | :: | plots(:) | |||
| integer, | intent(in) | :: | plot_count | |||
| integer, | intent(in) | :: | preferred_index | |||
| integer, | intent(out) | :: | plot_index | |||
| real(kind=wp), | intent(out) | :: | vmin | |||
| real(kind=wp), | intent(out) | :: | vmax | |||
| character(len=20), | intent(out) | :: | colormap | |||
| logical, | intent(out) | :: | ok |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(plot_context), | intent(inout) | :: | backend | |||
| type(plot_area_t), | intent(in) | :: | plot_area | |||
| real(kind=wp), | intent(in) | :: | vmin | |||
| real(kind=wp), | intent(in) | :: | vmax | |||
| character(len=*), | intent(in) | :: | colormap | |||
| character(len=*), | intent(in) | :: | location | |||
| character(len=*), | intent(in), | optional | :: | label | ||
| real(kind=wp), | intent(in), | optional | :: | custom_ticks(:) | ||
| character(len=*), | intent(in), | optional | :: | custom_ticklabels(:) | ||
| real(kind=wp), | intent(in), | optional | :: | label_fontsize | ||
| real(kind=wp), | intent(in), | optional | :: | line_levels(:) | ||
| real(kind=wp), | intent(in), | optional | :: | line_width |
Automatic colorbar ticks inside [vmin, vmax] and their labels.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | vmin | |||
| real(kind=wp), | intent(in) | :: | vmax | |||
| integer, | intent(in) | :: | target_ticks | |||
| real(kind=wp), | intent(out) | :: | ticks(40) | |||
| character(len=50), | intent(out) | :: | labels(40) | |||
| integer, | intent(out) | :: | n |