Thread Subject: Color regions of plot background

Subject: Color regions of plot background

From: David Doria

Date: 2 May, 2008 12:23:03

Message: 1 of 3

Is there a ways to set the color of the plot background over
particular intervals

say i want the background on [0,1] red and [1,2] blue

is this possible?

Thanks,

Dave

Subject: Color regions of plot background

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 2 May, 2008 13:19:43

Message: 2 of 3

In article <fvf137$njj$1@fred.mathworks.com>,
David Doria <daviddoria@gmail.com> wrote:
>Is there a ways to set the color of the plot background over
>particular intervals

>say i want the background on [0,1] red and [1,2] blue

>is this possible?

No. There is only one plot background color.

What you can do, though, is create patch() objects in the areas you
want, and set the patch FaceColor to the color you want, and
set the patch EdgeColor to 'none'. You might have to play
with the patch alpha transparency parameters or the z coordinate of
the patch to get the plot lines to appear "above" the background
colors.
--
  "Ignorance has been our king... he sits unchallenged on the throne of
  Man. His dynasty is age-old. His right to rule is now considered
  legitimate. Past sages have affirmed it. They did nothing to unseat
  him." -- Walter M Miller, Jr

Subject: Color regions of plot background

From: Scott Burnside

Date: 2 May, 2008 16:34:04

Message: 3 of 3

> snip
>
> >is this possible?
>
> No. There is only one plot background color.
>
> snip

Nonsense...

img = zeros(10,10,3);
img(1:5,:,1) = 0;
img(1:5,:,2) = 1;
img(1:5,:,3) = 0;
img(6:10,:,1) = 0;
img(6:10,:,2) = 0;
img(6:10,:,3) = 1;

imagesc(img)
hold on
axis off
x = 1:10;
y = sin(x)+ x;
plot(x,y,'-k','markersize',14);
hold on

Scott

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com