Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Shading area under a graph to represent another variable.

Subject: Shading area under a graph to represent another variable.

From: Deiniol

Date: 6 Nov, 2013 12:32:05

Message: 1 of 3

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

Subject: Shading area under a graph to represent another variable.

From: someone

Date: 6 Nov, 2013 15:28:07

Message: 2 of 3

"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.

Subject: Shading area under a graph to represent another variable.

From: Kelly Kearney

Date: 6 Nov, 2013 17:27:05

Message: 3 of 3

"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')

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us