File: ColorBar

package info (click to toggle)
dxsamples 4.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 26,348 kB
  • ctags: 1,513
  • sloc: ansic: 10,079; sh: 8,445; java: 1,772; makefile: 1,101
file content (25 lines) | stat: -rw-r--r-- 821 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Import the water molecule data
data = Import("watermolecule");

// Create an isosurface at the value 0.3
isosurface = Isosurface(data, 0.3);

// Compute the gradient of the electron density
gradient = Gradient(data);

// Map the gradient onto the isosurface
isosurface = Map(isosurface, gradient);

// Color the isosurface based on the magnitude of the gradient. 
colored, colormap = AutoColor(isosurface);

// use the colormap output of AutoColor as input to the ColorBar module.
// The bar will be placed on the right hand side of the image, half way up.
colorbar = ColorBar(colormap, position = [0.9 0.5]);

// Collect the colorbar with the colored isosurface
collected = Collect(colorbar, colored);

// Display the bar with the isosurface
camera = AutoCamera(collected, "off-diagonal");
Display(collected,camera);