You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cpp/source/common/scalar_quantity.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,24 @@ Scalar quantities can also be used to visualize integer-valued labels such as ca
4
4
5
5
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.
6
6
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
+

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
+
7
25
### Scalar Quantity Options
8
26
9
27
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
12
30
--- | --- | --- | --- | ---
13
31
enabled | is the quantity enabled? | `#!cpp bool isEnabled()` | `#!cpp setEnabled(bool newVal)` | [yes]([[url.prefix]]/basics/parameters/#persistent-values)
14
32
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)
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)` | - | -
15
36
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
Copy file name to clipboardExpand all lines: py/source/common/scalar_quantity.md
+22-1Lines changed: 22 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,24 @@ Scalar quantities can also be used to visualize integer-valued labels such as ca
4
4
5
5
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.
6
6
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
+

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
+
7
25
### Scalar Quantity Options
8
26
9
27
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:
13
31
-`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)
14
32
-`datatype`, one of `"standard"`, `"symmetric"`, `"magnitude"`, or `"categorical"`, affects default colormap and map range, and the categorical policies mentioned above
15
33
-`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)
17
38
- isoline keywords (darker-shaded stripes showing isocontours of the scalar field):
18
39
-`isolines_enabled` are isolines enabled (default: `False`)
19
40
-`isoline_style` one of `stripe`, `'contour` (default: `stripe`)
0 commit comments