Got Questions? Get Answers.
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:
add lines to figure plots

Subject: add lines to figure plots

From: Jonathan

Date: 17 Mar, 2009 20:25:03

Message: 1 of 3

Question,

When creating plots in Matlab, is it possible to specify the inclusion of a line at a specific location on the y-axis e.g. a line located at zero (or some other arbitrary location), with the plotted results fluctuating about that line?

Similarly, is it possible to generate more sophisticated plots that would say shade specific areas separated between lines (e.g. topographic cross-sections), while the areas outside those boundary lines would remain unshaded. I realize you can do this
in area plots etc, but this is specifically for line plots.

Thanks
Jon

Subject: add lines to figure plots

From: us

Date: 17 Mar, 2009 22:02:01

Message: 2 of 3

"Jonathan"
> When creating plots in Matlab, is it possible to specify the inclusion of a line at a specific location on the y-axis e.g. a line located at zero (or some other arbitrary location), with the plotted results fluctuating about that line?
> Similarly, is it possible to generate more sophisticated plots that would say shade specific areas separated between lines (e.g. topographic cross-sections), while the areas outside those boundary lines would remain unshaded. I realize you can do this
> in area plots etc, but this is specifically for line plots...

one of the solutions

     x=1:360;
     y=sind(x);
     line(x,y); % <- or: plot(x,y);
     line([x(1),x(end)],[.5,.5],'linewidth',2,'color',[0,0,0]);

%{
re your second question:
this FEX submission may be helpful

http://www.mathworks.com/matlabcentral/fileexchange/19436

%}

us

Subject: add lines to figure plots

From: Jonathan

Date: 17 Mar, 2009 22:15:04

Message: 3 of 3

"us " <us@neurol.unizh.ch> wrote in message <gpp6kp$4vg$1@fred.mathworks.com>...
> "Jonathan"
> > When creating plots in Matlab, is it possible to specify the inclusion of a line at a specific location on the y-axis e.g. a line located at zero (or some other arbitrary location), with the plotted results fluctuating about that line?
> > Similarly, is it possible to generate more sophisticated plots that would say shade specific areas separated between lines (e.g. topographic cross-sections), while the areas outside those boundary lines would remain unshaded. I realize you can do this
> > in area plots etc, but this is specifically for line plots...
>
> one of the solutions
>
> x=1:360;
> y=sind(x);
> line(x,y); % <- or: plot(x,y);
> line([x(1),x(end)],[.5,.5],'linewidth',2,'color',[0,0,0]);
>
> %{
> re your second question:
> this FEX submission may be helpful
>
> http://www.mathworks.com/matlabcentral/fileexchange/19436
>
> %}
>
> us

Thanks for your help. I ended up figuring out the first question but your info on my second question was especially helpful.

Jon

Tags for 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