I get a value error on roundNums when I try loading that script. For a black and white (and shades of gray) palette, I guess I like 0 0 0,:255
Thanks, -- Raul On Mon, Sep 6, 2021 at 8:33 PM Devon McCormick <[email protected]> wrote: > > There are a number of palettes I have found useful here: > https://code.jsoftware.com/wiki/User:Devon_McCormick/Palettes . > > On Mon, Sep 6, 2021 at 3:16 PM Raul Miller <[email protected]> wrote: > > > I was poking through the viewmat code, and noticed a couple things > > that might be of interest. > > > > First, is that viewmat has a default palette, which you can see here: > > > > load'viewmat' > > viewmat i.6 > > > > Viewmat uses linear interpolation between the palette colors to > > represent position in the range of values it's displaying. > > > > If you want to see how it blends, you could do something like this: > > viewmat i.60 > > > > If you want to supply your own palette, you can do that also. Palettes > > are three column lists of colors, with 0 0 0 for black, 255 0 0 for > > red, 0 255 0 for green, 0 0 255 for blue and 255 255 255 for white. > > > > For example: > > (255*=i.3) viewmat i.3 > > (255*#:i.8) viewmat i.8 > > > > Finally, getvm1_jviewmat_ generates the bitmap it uses. > > > > For example: > > 0 {:: ''getvm1_jviewmat_ i.3 3 > > 255 40959 65471 > > 65311 8388352 16768768 > > 16727808 16711775 16711935 > > > > The left argument is not optional, and is the palette (the default > > palette for an empty left argument). Each pixel in the bitmap is one > > integer. So another way to see the default palette is: > > > > 256#.inv 0 {:: ''getvm1_jviewmat_ i.6 > > 0 0 255 > > 0 255 255 > > 0 255 0 > > 255 255 0 > > 255 0 0 > > 255 0 255 > > > > (Note that there's a leading 1 dimension on this result, since a > > bitmap is a rank 2 array. You could use {. to discard that leading > > dimension.) > > > > FYI, > > > > -- > > Raul > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > > -- > > Devon McCormick, CFA > > Quantitative Consultant > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
