How do I concentrate my interpolation coloring around specific data ranges?

Hi, im trying to plot an area graph with interpolated shading, in which i use patch(). Everything works out perfectly but i'm graphing a set of datapoints that range from 4500-5500. So naturally when I put the plot range to that value it only shows one color. Is there a way to concentrate the interpolation between the max and min value points of my data?
I had to add zeroes in the beginning and end of my data vector so I could enclose the data between x axis and my value points

 Akzeptierte Antwort

The simplest solution would be to change the mapping of data values to the colormap using caxis, e.g.:
caxis([4500 5500])

6 Kommentare

Hannah
Hannah am 6 Jun. 2013
Bearbeitet: Hannah am 6 Jun. 2013
I tried that but it turns the whole plot one color.
I don't see why it would - unless all the data points are much closer together than that. Maybe you need to provide some code to clarify the question.
Pool31_35_Storage = [0 5042.7 5046.0 5052.9 5061.1 5067.2 5089.2 5085.2 5100.7 5106.5 5089.2 5067.9 5056.4 5090.5 5040.8 5015.8 4984.9 4952.0 4932.9 4954.5 4951.0 4913.3 4920.4 4938.6 4974.5 0];
x=linspace(1,26,26);
n = 26;
N = length(x);
color = [Pool31_35_Storage(:)-max(Pool31_35_Storage)];%; x(:) zeros(N,1)];
caxis([4000 5500]);
H1 = patch(x, Pool31_35_Storage, color);
hold on
set(H1, 'FaceColor', 'interp', 'EdgeColor', 'none');
Ah - your color values are negative. Try caxis(-[5500 4000]).
Ohh, now its interpolated again. Is there a way to concentrate the color so that patch stays blue until about 4000 or so and then starts interpolating?
Perhaps the easiest approach would be to tweak the colormap using the colormapeditor. The documentation also describes how you can save the colormap after you have edited it.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by