Thread Subject: multiple background-color

Subject: multiple background-color

From: Walter Linzenbold

Date: 18 Aug, 2008 11:45:08

Message: 1 of 3

Hi.

Is there a way to set the background color of a plot to
multiple colors?

For example:

x = (-10:10)
y = ones(size(x));

plot(x,y)

In this case I want the background to be green for x-axis
-10 to 0 and red for x-axis 0 to 10.


Thx and regards.
Walter

Subject: multiple background-color

From: Walter Roberson

Date: 18 Aug, 2008 16:40:04

Message: 2 of 3

Walter Linzenbold wrote:

> Is there a way to set the background color of a plot to
> multiple colors?

No.

 
> For example:
>
> x = (-10:10)
> y = ones(size(x));

> plot(x,y)
 
> In this case I want the background to be green for x-axis
> -10 to 0 and red for x-axis 0 to 10.

patch() or rectangle() the area first and then draw on top of it.

Warning: somewhere or other (I couldn't find it again when I last looked)
there is a note that when opengl is used as the renderer, and
if you draw patches and lines in the same 2D plane (e.g., because you
did not provide any z coordinate for the patches) then instead of
being rendered in normal child order, that the patch will always appear
"below" the line. This problem has come up in practice to posters a
couple of times this year -- they wanted the patch to overlay the line
(with alpha transparency leaving the line partly visible) and they
couldn't do it. They may have been using PC systems. When I tested
on my linux-64 system, the patch was on top of the line, the opposite
of the documented situation. Thus, possibly depending on your OS and
exact graphics card, if you need to use alpha transparency (and so
need to use opengl as the renderer) then you might find that you need
to specify explicit z coordinates for the patch, just "above" or just
"below" your lines [according to what you are trying to achieve.]

--
Q = quotation(rand);
if isempty(Q); error('Quotation server filesystem problems')
else sprintf('%s',Q), end

Subject: multiple background-color

From: ControlTheoryPro@gmail.com

Date: 19 Aug, 2008 03:47:43

Message: 3 of 3

I haven't used it in a long time but I remember the "area" function
begin good for that. I'd study the help.

Gabe
Wiki category on all sorts of MATLAB stuff - still growing
http://wikis.controltheorypro.com/index.php?title=Category:MATLAB

Tags for this Thread

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
multiple colors Walter Linzenbold 18 Aug, 2008 11:58:44
rssFeed for this Thread

Contact us at files@mathworks.com