Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Shading area under a graph to represent another variable.
Replies: 2   Last Post: Nov 6, 2013 12:27 PM

 Messages: [ Previous | Next ]
 Kelly Kearney Posts: 24 Registered: 4/25/13
Re: Shading area under a graph to represent another variable.
Posted: Nov 6, 2013 12:27 PM

"someone" wrote in message <l5dn66\$hhb\$1@newscl01ah.mathworks.com>...
> "Deiniol" wrote in message <l5dcs5\$sfn\$1@newscl01ah.mathworks.com>...
> > Hi,
> >
> > I trying to create a plot which will represent a profile from a geophysical survey. I have so far plotted a line to represent the ground topology and the topology of a sub-surface layer. What I would like to know is, is it possible to shade the area between these two plotted lines and have the colour change to represent changing resistivity? if this is possible how would I go about that?
> >
> > Cheers,
> >
> > Deiniol

>
> % Perhaps
>
> doc area
>
> % will help. Look at the Examples section.

Also, if your resistivity data is more of a continuous function, rather than discrete blocks, you can achieve the effect using patches:

x = 1:100;
y = rand(1,100);
c = sin(x);
xq = [x(1:end-1); x(2:end); x(2:end); x(1:end-1); x(1:end-1)];
yq = [y(1:end-1); y(2:end); zeros(2, nx-1); y(1:end-1)];
cq = [c(1:end-1); c(2:end); c(2:end); c(1:end-1); c(1:end-1)];
patch(xq, yq, cq, 'edgecolor', 'none')

Date Subject Author
11/6/13 Deiniol
11/6/13 Curious
11/6/13 Kelly Kearney