# Re: plot_image color tables

From: Joseph Neilsen <jneilsen_at_email.domain.hidden>
Date: Sun, 2 Jan 2011 13:26:00 -0500 (EST)
```Thanks Dave,

_pgctab worked just right. I ended up setting the green intensity to zero
and tweaking the red/blue levels until I got the right purple.

Cheers,

Joey

On Sun, 2 Jan 2011, David P. Huenemoerder wrote:

>
>
> Hi Joey,
>
>     Joseph> I'm wondering if there is a way to use plot_image to make images of an
>     Joseph> arbitrary color. I have a 2D Gaussian that I'm trying to display, and I'd
>     Joseph> like to do it in various levels of purple (i.e. purple fading to black).
>     Joseph> set_palette allows you to select the color table, but not to just pick a
>     Joseph> color.
>
>     Joseph> Is there a way to do what I'm looking for?
>
> It looks like _pgctab will do what you want.  You'll have to
> experiment a bit.  Here's an ad hoc empirical example.
>
>   z = Double_Type[256,256];
>   for(i=0;i<256;i++)
>      for(j=0;j<256;j++)
>         z[i,j]= sin((i-128)/100.)*cos((j-128)/20.);;
>
>   rl = [-0.5, 0.0, 0.17, 0.33, 0.50, 0.67, 0.83, 1.0, 1.7] ;
>   rr = [ 0.0, 0.0,  0.0,  0.0,  0.6,  1.0,  1.0, 1.0, 1.0] ;
>   rg = [ 0.0, 0.0,  0.0,  1.0,  1.0,  1.0,  0.6, 0.0, 1.0] ;
>   rb = [ 0.0, 0.3,  0.8,  1.0,  0.3,  0.0,  0.0, 0.0, 1.0] ;
>
>   resize(16,1);
>   plot_image( z ) ;
>
>   _pgctab( rl, rr, rg, rb, 1.0, 0.5 ) ;
>   plot_image( z ) ;
>
>   _pgctab( rl, rr, rg*0, rr, 1.0, 0.5 ) ;
>   plot_image( z ) ;
>
>
> See <http://www.astro.caltech.edu/~tjp/pgplot/subroutines.html#PGCTAB>
> for a description of the pgplot subroutines (which  are _pg* functions
> in isis).  Note that when isis can determine a parameter from the data
> (like the length of an array), that argument is omitted from the isis
> interface).
>
> I also used the examples tables from:
>
>   <http://spdg1.sci.shizuoka.ac.jp/grwinlib/contrib/pgplot/examples/pgdemo4.f>
>
>
> Another option might be to manipulate color tables post facto with
> some external programs, like those in the imagemagick suite.
>
> Or you could see how set_palette works in the isis source code.
>
>
> -- Dave
>
> David Huenemoerder  617-253-4283 (o); -253-8084 (f); http://space.mit.edu/home/dph
> MIT Kavli Institute for Astrophysics and Space Research
> 70 Vassar St., NE80-6065,
> Cambridge, MA  02139
> [Admin. Asst.: Elaine Tirrell, 617-253-7480, egt_at_email.domain.hidden>
> ----
> You received this message because you are
> subscribed to the isis-users list.
> To unsubscribe, send a message to
> isis-users-request_at_email.domain.hidden> with the first line of the message as:
> unsubscribe
>
----
You received this message because you are
subscribed to the isis-users list.
To unsubscribe, send a message to
isis-users-request_at_email.domain.hiddenwith the first line of the message as:
unsubscribe
```
Received on Sun Jan 02 2011 - 13:26:04 EST

This archive was generated by hypermail 2.2.0 : Mon Jan 17 2011 - 08:52:23 EST