Skip to content

Commit 730e857

Browse files
committed
add docs for new colorbar things
1 parent 91fb91e commit 730e857

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed

cpp/source/common/scalar_quantity.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ Scalar quantities can also be used to visualize integer-valued labels such as ca
44

55
Add the labels as a scalar quantity where the values just happen to be integers (each integer represents a particular class or label), and set `DataType::CATEGORICAL`. This will change the visualization to a different set of defaults, adjust some shading rules, and use a distinct color from the colormap for each label.
66

7+
### Color Bars
8+
9+
Each scalar quantity has an associated color map, which linearly maps scalar values to a spectrum of colors for visualization.
10+
See [colormaps]([[url.prefix]]/features/color_maps) for a listing of the available maps, and use `quantity->setColorMap("cmap_name")` to choose the map.
11+
12+
The colormap is always displayed with an inline colorbar in the structures panel, which also gives a histogram of the scalar values in your quantity.
13+
The limits (`vminmax`) of the colormap range are given by the two numeric fields below the colored display. You can click and drag horizontally on these fields to adjust the map range, or ctrl-click (cmd-click) to enter arbitrary custom values.
14+
15+
![image inline and onscreen colorbar]([[url.prefix]]/media/colorbar_options.jpg)
16+
17+
!!! note "onscreen colorbar"
18+
19+
Optionally an additional onscreen colorbar, which is more similar to the colorbars used in other plotting libraries, can be enabled with `quantity->setOnscreenColorbarEnabled(true)`.
20+
21+
By default it is positioned automatically inline with the other UI elements, or it can be manually positioned with `quantity->setOnscreenColorbarLocation(glm::vec2(xpos,ypos))`.
22+
23+
You can even **export this color map to an `.svg` file** for creating figures, via the options menu, or with `quantity->exportColorbarToSVG("filename.svg")`.
24+
725
### Scalar Quantity Options
826

927
These options and behaviors are available for all types of scalar quantities on any structure.
@@ -12,6 +30,9 @@ These options and behaviors are available for all types of scalar quantities on
1230
--- | --- | --- | --- | ---
1331
enabled | is the quantity enabled? | `#!cpp bool isEnabled()` | `#!cpp setEnabled(bool newVal)` | [yes]([[url.prefix]]/basics/parameters/#persistent-values)
1432
color map | the [color map]([[url.prefix]]/features/color_maps) to use | `#!cpp std::string getColorMap()` | `#!cpp setColorMap(std::string newMap)` | [yes]([[url.prefix]]/basics/parameters/#persistent-values)
33+
onscreen colorbar | additional onscreen colorbar | `#!cpp bool getOnscreenColorbarEnabled()` | `#!cpp setOnscreenColorbarEnabled(bool newVal)` | [yes]([[url.prefix]]/basics/parameters/#persistent-values)
34+
onscreen colorbar location| where to put onscreen colorbar, `(-1,-1)` (default) means auto | `#!cpp glm::vec2 getOnscreenColorbarLocation()` | `#!cpp setOnscreenColorbarLocation(glm::vec2 newVal)` | [yes]([[url.prefix]]/basics/parameters/#persistent-values)
35+
save colorbar to `.svg` file | export colorbar to file | `#!cpp void exportColorbarToSVG(std::string filename)` | - | -
1536
map range | the lower and upper limits used when mapping the data in to the color map| `#!cpp std::pair<double,double> getMapRange()` | `#!cpp setMapRange(std::pair<double,double>)` and `#!cpp resetMapRange()`| no
1637
isolines enabled | are isolines shaded (default=`false`) | `#!cpp bool getIsolinesEnabled()` | `#!cpp setIsolinesEnabled(bool newVal)`| [yes]([[url.prefix]]/basics/parameters/#persistent-values)
1738
isoline style | stripes or thin contour lines | `#!cpp IsolineStyle getIsolineStyle()` | `#!cpp setIsolineStyle(IsolineStyle newVal)`| [yes]([[url.prefix]]/basics/parameters/#persistent-values)

py/source/common/scalar_quantity.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ Scalar quantities can also be used to visualize integer-valued labels such as ca
44

55
Add the labels as a scalar quantity where the values just happen to be integers (each integer represents a particular class or label), and set `datatype='categorical'`. This will change the visualization to a different set of defaults, adjust some shading rules, and use a distinct color from the colormap for each label.
66

7+
### Color Bars
8+
9+
Each scalar quantity has an associated color map, which linearly maps scalar values to a spectrum of colors for visualization.
10+
See [colormaps]([[url.prefix]]/features/color_maps) for a listing of the available maps, and use `add_scalar_quantity(..., cmap="cmap_name")` to choose the map.
11+
12+
The colormap is always displayed with an inline colorbar in the structures panel, which also gives a histogram of the scalar values in your quantity.
13+
The limits (`vminmax`) of the colormap range are given by the two numeric fields below the colored display. You can click and drag horizontally on these fields to adjust the map range, or ctrl-click (cmd-click) to enter arbitrary custom values.
14+
15+
![image inline and onscreen colorbar]([[url.prefix]]/media/colorbar_options.jpg)
16+
17+
!!! note "onscreen colorbar"
18+
19+
Optionally an additional onscreen colorbar, which is more similar to the colorbars used in other plotting libraries, can be enabled with `add_scalar_quantity(..., onscreen_colorbar_enabled=True)`.
20+
21+
By default it is positioned automatically inline with the other UI elements, or it can be manually positioned with `add_scalar_quantity(..., onscreen_colorbar_location=(400., 400.))`.
22+
23+
You can even **export this color map to an `.svg` file** for creating figures via the options menu.
24+
725
### Scalar Quantity Options
826

927
When adding a scalar quantity, the following keyword options can be set. These are available for all kinds of scalar quantities on all structures.
@@ -13,7 +31,10 @@ Keyword arguments:
1331
- `enabled` boolean, whether the quantity is initially enabled (note that generally only one quantitiy can be shown at a time; the most recent will be used)
1432
- `datatype`, one of `"standard"`, `"symmetric"`, `"magnitude"`, or `"categorical"`, affects default colormap and map range, and the categorical policies mentioned above
1533
- `vminmax`, a 2-tuple of floats, specifying the min and max range for colormap limits; the default is `None`, which computes the min and max of the data
16-
- `cmap`, which [colormap](../../../features/color_maps) to use
34+
- colormap keywords:
35+
- `cmap`, which [colormap](../../../features/color_maps) to use
36+
- `onscreen_colorbar_enabled` set to `True` to enable an additional traditional colormap
37+
- `onscreen_colorbar_location` set to screen coordinates like `(400., 400.)` to position the onscreen colorbar manually (default is automatic)
1738
- isoline keywords (darker-shaded stripes showing isocontours of the scalar field):
1839
- `isolines_enabled` are isolines enabled (default: `False`)
1940
- `isoline_style` one of `stripe`, `'contour` (default: `stripe`)

shared/media/colorbar_options.jpg

222 KB
Loading

shared/media/colorbar_options.pdf

576 KB
Binary file not shown.

0 commit comments

Comments
 (0)