[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scatter Plot Help - exporting linearly interpolated rgb values
From: |
Ben Abbott |
Subject: |
Re: Scatter Plot Help - exporting linearly interpolated rgb values |
Date: |
Thu, 15 Mar 2012 08:20:46 -0400 |
On Mar 15, 2012, at 12:38 AM, octave_newbie wrote:
> Octave newbie here...I have a data matrix, [X, Y, Z] where X, Y are positions
> (X and Y are each Nx1 matrix) , Z is the corresponding height.
>
> When I plot it using scatter plot, the function 'scatter' automatically
> linearly interpolates the data Z into the specified 64x3 colormap (I
> specified the 'jet' colormap), and plots the rgb values on a figure.
>
> I would like to somehow find a way to obtain the interpolated rgb values in
> matrix form. Is that possible?
If I recall correctly, Z is mapped to the nearest color values by 1D
interpolation of the color axes limits.
h = scatter (X, Y, [], Z);
colors = interp1 (caxis, [1, (size (colormap (), 1))], Z, "nearest")
or
h = scatter (X, Y, [], Z);
colors = interp1 (caxis, [1, (size (colormap (), 1))], get (h,
"cdata"), "nearest")
Ben