## Maxima – 268 – draw – 15 Continuo da qui, copio dal Reference Manual, PDF scaricabile da qui, sono a p.829.

`palette`
Default value: `color`.

`palette` indicates how to map gray levels onto color components. It works together with option enhanced3d in 3D graphics, who associates every point of a surfaces to a real number or gray level. It also works with gray images. With `palette`, levels are transformed into colors.

There are two ways for defining these transformations.

First, palette can be a vector of length three with components ranging from `-36` to `+36`; each value is an index for a formula mapping the levels onto red, green and blue colors, respectively:

``````     0: 0               1: 0.5           2: 1
3: x               4: x^2           5: x^3
6: x^4             7: sqrt(x)       8: sqrt(sqrt(x))
9: sin(90x)       10: cos(90x)     11: |x-0.5|
12: (2x-1)^2       13: sin(180x)    14: |cos(180x)|
15: sin(360x)      16: cos(360x)    17: |sin(360x)|
18: |cos(360x)|    19: |sin(720x)|  20: |cos(720x)|
21: 3x             22: 3x-1         23: 3x-2
24: |3x-1|         25: |3x-2|       26: (3x-1)/2
27: (3x-2)/2       28: |(3x-1)/2|   29: |(3x-2)/2|
30: x/0.32-0.78125 31: 2*x-0.84     32: 4x;1;-2x+1.84;x/0.08-11.5
33: |2*x - 0.5|    34: 2*x          35: 2*x - 0.5
36: 2*x - 1``````

negative numbers mean negative colour component. `palette = gray` and `palette = color` are short cuts for `palette = [3,3,3]` and `palette = [7,5,15]`, respectively.

Second, `palette` can be a user defined lookup table. In this case, the format for building a lookup table of length `n` is `palette=[color_1, color_2, ..., color_n]`, where `color_i` is a well formed `color` (see option `color`) such that `color_1` is assigned to the lowest gray level and `color_n` to the highest. The rest of colors are interpolated.

Since this is a global graphics option, its position in the scene description does not matter.

It works together with option `enhanced3d` in 3D graphics.

``````(%i1) draw3d(
enhanced3d = [z-x+2*y, x, y, z],
palette = [32, -8, 17],
explicit(20*exp(-x^2-y^2)-10, x, -3, 3, y, -3, 3))\$`````` It also works with gray images.

``````(%i2) im: apply(
'matrix,
makelist(makelist(random(200), i, 1, 30), i, 1, 30))\$

(%i3) /* palette = color, default */
draw2d(image(im, 0, 0, 30, 30))\$`````` ``(%i4) draw2d(palette = gray, image(im, 0, 0, 30, 30))\$`` ``````(%i5) draw2d(palette = [15, 20, -4],
colorbox = false,
image(im, 0, 0, 30, 30))\$`````` `palette` can be a user defined lookup table. In this example, low values of `x` are colored in red, and higher values in yellow.

``````(%i6) draw3d(
palette = [red, blue, yellow],
enhanced3d = x,
explicit(x^2+y^2, x, -1, 1, y, -1, 1))\$`````` See also `colorbox` and `enhanced3d`.

`point_size`
Default value: `1`.

`point_size` sets the size for plotted points. It must be a non negative number. This option has no effect when graphic option `point_type` is set to `dot`.

This option affects the graphic object points in either `gr2d` and `gr3d`.

``````(%i7) draw2d(points(makelist([random(20), random(50)], k, 1, 10)),
point_size = 5,
points(makelist(k, k, 1, 20), makelist(random(30), k, 1, 20)))\$`````` Posta un commento o usa questo indirizzo per il trackback.