Hello all,
How do you go about coloring the space between two parallel lines on a plot?
Fill() seems to be for closed shapes.. so that's no good. The line properties seems too complicated since I would need to somehow relate the width between my two lines with "points".
Thanks!
|
|
0
|
|
|
|
Reply
|
Judy
|
8/3/2010 1:19:05 AM |
|
"Judy " <sauwen.jl@gmail.com> wrote in message <i37qq9$srd$1@fred.mathworks.com>...
> Hello all,
>
> How do you go about coloring the space between two parallel lines on a plot?
>
> Fill() seems to be for closed shapes.. so that's no good. The line properties seems too complicated since I would need to somehow relate the width between my two lines with "points".
>
> Thanks!
doc area
% Look in the Examples section.
|
|
0
|
|
|
|
Reply
|
someone
|
8/3/2010 3:08:04 AM
|
|
"Judy " <sauwen.jl@gmail.com> wrote in message <i37qq9$srd$1@fred.mathworks.com>...
> Hello all,
>
> How do you go about coloring the space between two parallel lines on a plot?
>
> Fill() seems to be for closed shapes.. so that's no good. The line properties seems too complicated since I would need to somehow relate the width between my two lines with "points".
>
> Thanks!
a hint:
help patch;
us
|
|
0
|
|
|
|
Reply
|
us
|
8/3/2010 5:56:06 AM
|
|
I looked at patch but when I wanted to color in two vertical lines, it made 2 triangles instead. I suppose I could indicate 4 vertices.. but that doesn't seem very clean.
I saw an area function as well, and it works well. I changed my two parallel lines to just an array, going from 0 to 1 and then back down from 1 to 0 when ready.
Only thing now, is the coloring option doesn't seem to be working.
Here is an example.
Why isn't my filled color changing to cyan?
a=zeros(1,10); a(6:7)=5;
figure,
plot(a);
area(a,'FaceColor','c')
Thanks!
|
|
0
|
|
|
|
Reply
|
Judy
|
8/4/2010 12:29:13 AM
|
|
Whoops... I meant 4 vertices as more points to make up 4 total triangles.... :P
|
|
0
|
|
|
|
Reply
|
Judy
|
8/4/2010 12:45:08 AM
|
|
"Judy " <sauwen.jl@gmail.com> wrote in message
news:i3ac8p$qvl$1@fred.mathworks.com...
> I looked at patch but when I wanted to color in two vertical lines, it
> made 2 triangles instead. I suppose I could indicate 4 vertices.. but
> that doesn't seem very clean.
>
> I saw an area function as well, and it works well. I changed my two
> parallel lines to just an array, going from 0 to 1 and then back down from
> 1 to 0 when ready.
> Only thing now, is the coloring option doesn't seem to be working.
>
> Here is an example.
>
> Why isn't my filled color changing to cyan?
>
> a=zeros(1,10); a(6:7)=5;
> figure,
> plot(a);
> area(a,'FaceColor','c')
It did when I tried it. First, make sure you haven't created your own
area.m function or variable that's shadowing the built-in function:
which -all area
Next, call AREA with an output argument (to store the handle to the
areaseries object AREA created) and GET the properties of that handle. Make
sure the FaceColor property of that object is cyan [0 1 1].
--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com
|
|
0
|
|
|
|
Reply
|
Steven_Lord
|
8/4/2010 1:58:41 PM
|
|
Looks like MATLAB thinks it is filling in the right color but it isn't being displayed as so. I've tried other colors too in the FaceColor property and it still results in a filled in dark blue color as seen in my link below. I may just have to live with this if there is no other choice.
http://imgur.com/Ko4RR
Thanks~
|
|
0
|
|
|
|
Reply
|
Judy
|
8/4/2010 6:26:04 PM
|
|
Judy wrote:
> Looks like MATLAB thinks it is filling in the right color but it isn't
> being displayed as so. I've tried other colors too in the FaceColor
> property and it still results in a filled in dark blue color as seen in
> my link below. I may just have to live with this if there is no other
> choice.
What is your renderer set to?
|
|
0
|
|
|
|
Reply
|
Walter
|
8/4/2010 6:40:24 PM
|
|
Walter Roberson <roberson@hushmail.com> wrote in message <i3cc6p$cbf$1@canopus.cc.umanitoba.ca>...
> Judy wrote:
> > Looks like MATLAB thinks it is filling in the right color but it isn't
> > being displayed as so. I've tried other colors too in the FaceColor
> > property and it still results in a filled in dark blue color as seen in
> > my link below. I may just have to live with this if there is no other
> > choice.
>
> What is your renderer set to?
What is a rendered set? (?) Thanks.
|
|
0
|
|
|
|
Reply
|
Judy
|
8/4/2010 6:54:04 PM
|
|
"Judy " <sauwen.jl@gmail.com> wrote in message <i3ac8p$qvl$1@fred.mathworks.com>...
> I looked at patch but when I wanted to color in two vertical lines, it made 2 triangles instead. I suppose I could indicate 4 vertices.. but that doesn't seem very clean.
this reflects a false setup of your X/Y parameters for PATCH...
can you show CSSM how you called the function(?)...
note: PATCH is much more versatile compared to AREA, which comes with a simple level arg to close your patch...
us
|
|
0
|
|
|
|
Reply
|
us
|
8/4/2010 7:03:05 PM
|
|
"us " <us@neurol.unizh.ch> wrote in message <i3cdh8$f58$1@fred.mathworks.com>...
> "Judy " <sauwen.jl@gmail.com> wrote in message <i3ac8p$qvl$1@fred.mathworks.com>...
> > I looked at patch but when I wanted to color in two vertical lines, it made 2 triangles instead. I suppose I could indicate 4 vertices.. but that doesn't seem very clean.
>
> this reflects a false setup of your X/Y parameters for PATCH...
> can you show CSSM how you called the function(?)...
> note: PATCH is much more versatile compared to AREA, which comes with a simple level arg to close your patch...
>
> us
figure,
line([1 1],[0 10]);
line([5,5],[0,10]);
hold on,
plot(0:6, zeros(1,7)); %reference to make plot zoom out a bit
% xData=[1; 5; 1; 5]
% yData=[0; 0; 10; 10]
xData=[1; 1; 5; 5]
yData=[0; 10; 0; 10]
zData=zeros(4,1);
patch(xData,yData,zData,'c')
Here's how my output looks: http://drop.io/rsac8vu1711
Thanks~
|
|
0
|
|
|
|
Reply
|
Judy
|
8/4/2010 7:27:04 PM
|
|
"us " <us@neurol.unizh.ch> wrote in message <i3cdh8$f58$1@fred.mathworks.com>...
> "Judy " <sauwen.jl@gmail.com> wrote in message <i3ac8p$qvl$1@fred.mathworks.com>...
> > I looked at patch but when I wanted to color in two vertical lines, it made 2 triangles instead. I suppose I could indicate 4 vertices.. but that doesn't seem very clean.
>
> this reflects a false setup of your X/Y parameters for PATCH...
> can you show CSSM how you called the function(?)...
> note: PATCH is much more versatile compared to AREA, which comes with a simple level arg to close your patch...
>
> us
figure,
line([1 1],[0 10]);
line([5,5],[0,10]);
hold on,
plot(0:6, zeros(1,7)); %reference to make plot zoom out a bit
% xData=[1; 5; 1; 5]
% yData=[0; 0; 10; 10]
xData=[1; 1; 5; 5]
yData=[0; 10; 0; 10]
zData=zeros(4,1);
patch(xData,yData,zData,'c')
Here's how my output looks: http://drop.io/rsac8vu1711
Thanks~
|
|
0
|
|
|
|
Reply
|
Judy
|
8/4/2010 7:27:04 PM
|
|
"Judy " <sauwen.jl@gmail.com> wrote in message <i3ceu8$fin$1@fred.mathworks.com>...
> "us " <us@neurol.unizh.ch> wrote in message <i3cdh8$f58$1@fred.mathworks.com>...
> > "Judy " <sauwen.jl@gmail.com> wrote in message <i3ac8p$qvl$1@fred.mathworks.com>...
> > > I looked at patch but when I wanted to color in two vertical lines, it made 2 triangles instead. I suppose I could indicate 4 vertices.. but that doesn't seem very clean.
> >
> > this reflects a false setup of your X/Y parameters for PATCH...
> > can you show CSSM how you called the function(?)...
> > note: PATCH is much more versatile compared to AREA, which comes with a simple level arg to close your patch...
> >
> > us
>
> figure,
> line([1 1],[0 10]);
> line([5,5],[0,10]);
> hold on,
> plot(0:6, zeros(1,7)); %reference to make plot zoom out a bit
> % xData=[1; 5; 1; 5]
> % yData=[0; 0; 10; 10]
> xData=[1; 1; 5; 5]
> yData=[0; 10; 0; 10]
> zData=zeros(4,1);
> patch(xData,yData,zData,'c')
>
> Here's how my output looks: http://drop.io/rsac8vu1711
>
> Thanks~
what CSSMers thought: false arrangement of X/Y data...
one of the solutions
x=[1,5,5,1];
y=[0,0,10,10];
patch(x,y,[0,1,1]);
set(gca,'xlim',[0,6],'ylim',[-1,11]);
us
|
|
0
|
|
|
|
Reply
|
us
|
8/4/2010 7:42:05 PM
|
|
On Aug 4, 9:42=A0pm, "us " <u...@neurol.unizh.ch> wrote:
> "Judy " <sauwen...@gmail.com> wrote in message <i3ceu8$fi...@fred.mathwor=
ks.com>...
> > "us " <u...@neurol.unizh.ch> wrote in message <i3cdh8$f5...@fred.mathwo=
rks.com>...
> > > "Judy " <sauwen...@gmail.com> wrote in message <i3ac8p$qv...@fred.mat=
hworks.com>...
> > > > I looked at patch but when I wanted to color in two vertical lines,=
it made 2 triangles instead. =A0I suppose I could indicate 4 vertices.. bu=
t that doesn't seem very clean.
>
> > > this reflects a false setup of your X/Y parameters for PATCH...
> > > can you show CSSM how you called the function(?)...
> > > note: PATCH is much more versatile compared to AREA, which comes with=
a simple level arg to close your patch...
>
> > > us
>
> > figure,
> > line([1 1],[0 10]);
> > line([5,5],[0,10]);
> > hold on,
> > plot(0:6, zeros(1,7)); %reference to make plot zoom out a bit
> > % xData=3D[1; 5; 1; 5]
> > % yData=3D[0; 0; 10; 10]
> > xData=3D[1; 1; 5; 5]
> > yData=3D[0; 10; 0; 10]
> > zData=3Dzeros(4,1);
> > patch(xData,yData,zData,'c')
>
> > Here's how my output looks:http://drop.io/rsac8vu1711
>
> > Thanks~
>
> what CSSMers thought: false arrangement of X/Y data...
>
> one of the solutions
>
> =A0 =A0 =A0x=3D[1,5,5,1];
> =A0 =A0 =A0y=3D[0,0,10,10];
> =A0 =A0 =A0patch(x,y,[0,1,1]);
> =A0 =A0 =A0set(gca,'xlim',[0,6],'ylim',[-1,11]);
>
> us- Hide quoted text -
>
> - Show quoted text -
and here's an example to show the versatility of PATCH...
x=3D1:10;
ybot=3Drand(size(x));
ytop=3Drand(size(x))+2;
xp=3D[x,x(end:-1:1)]; % <- closed area...
yp=3D[ybot,ytop(end:-1:1)];
patch(xp,yp,[0,1,1]);
set(gca,'xlim',[0,11],'ylim',[-1,4]);
us
|
|
0
|
|
|
|
Reply
|
us1 (8054)
|
8/4/2010 7:47:42 PM
|
|
Grah.. I see what I did. It works, thanks!
|
|
0
|
|
|
|
Reply
|
Judy
|
8/4/2010 7:54:04 PM
|
|
Judy wrote:
> Walter Roberson <roberson@hushmail.com> wrote in message
> <i3cc6p$cbf$1@canopus.cc.umanitoba.ca>...
>> Judy wrote:
>> > Looks like MATLAB thinks it is filling in the right color but it
>> isn't > being displayed as so. I've tried other colors too in the
>> FaceColor > property and it still results in a filled in dark blue
>> color as seen in > my link below. I may just have to live with this
>> if there is no other > choice.
>>
>> What is your renderer set to?
>
> What is a rendered set? (?) Thanks.
A renderer is a particular algorithm for converting graphics objects into
pixels. Different renderers have different advantages and disadvantages and
different limitations or bugs.
http://www.mathworks.com/support/tech-notes/1200/1201.html
|
|
0
|
|
|
|
Reply
|
Walter
|
8/4/2010 7:56:11 PM
|
|
Walter Roberson <roberson@hushmail.com> wrote in message <i3cgkr$i2j$2@canopus.cc.umanitoba.ca>...
> Judy wrote:
> > Walter Roberson <roberson@hushmail.com> wrote in message
> > <i3cc6p$cbf$1@canopus.cc.umanitoba.ca>...
> >> Judy wrote:
> >> > Looks like MATLAB thinks it is filling in the right color but it
> >> isn't > being displayed as so. I've tried other colors too in the
> >> FaceColor > property and it still results in a filled in dark blue
> >> color as seen in > my link below. I may just have to live with this
> >> if there is no other > choice.
> >>
> >> What is your renderer set to?
> >
> > What is a rendered set? (?) Thanks.
>
> A renderer is a particular algorithm for converting graphics objects into
> pixels. Different renderers have different advantages and disadvantages and
> different limitations or bugs.
>
> http://www.mathworks.com/support/tech-notes/1200/1201.html
The command
get(gcf,'Renderer')
gets me painters.. doesn't seem to have any known problems like OpenGL.
|
|
0
|
|
|
|
Reply
|
Judy
|
8/4/2010 9:27:04 PM
|
|
|
16 Replies
474 Views
(page loaded in 0.111 seconds)
Similiar Articles: Filling in the space between two parallel lines with a color ...Hello all, How do you go about coloring the space between two parallel lines on a plot? Fill() seems to be for closed shapes.. so that's no good... Add baseline to Boxplot - comp.soft-sys.matlabFilling in the space between two parallel lines with a color ... Add baseline to Boxplot - comp.soft-sys.matlab Filling in the space between two parallel lines with a color ... "Fill" in Matlab ??? - comp.soft-sys.matlabFilling in the space between two parallel lines with a color ... Hello all, How do you go about coloring the space between two parallel lines on a plot? Fill() seems to be ... Fill between curves that are functions, not data series - comp ...Filling in the space between two parallel lines with a color ... Fill between curves that are functions, not data series - comp ... Filling in the space between two ... Plot area color - comp.soft-sys.matlabFilling in the space between two parallel lines with a color ... Plot area color - comp.soft-sys.matlab | Computer Group Filling in the space between two parallel lines ... Filling Blanks Between 2 Values - comp.soft-sys.sasFill a matrix without for-loop - comp.soft-sys.matlab How to fill a ... Filling in the space between two parallel lines with a color ... Plot area color - comp ... Drawing two overlapping lines in different colors - comp.graphics ...Filling in the space between two parallel lines with a color ... Drawing two overlapping lines in different colors - comp.graphics ... Filling in the space between two ... sgplot series repeated line type and color - comp.soft-sys.sas ...Filling in the space between two parallel lines with a color ... sgplot series repeated line type and color - comp.soft-sys.sas ..... knowledge, the Burstnibbler series of ... Visual C++ OpenGL tesselator - comp.graphics.api.openglFilling in the space between two parallel lines with a color ... help with simple polygon tessellation - comp.graphics.api.opengl ... Filling in the space between two ... how to fill boxplot with color - comp.soft-sys.matlabAdd baseline to Boxplot - comp.soft-sys.matlab Add baseline to Boxplot - comp.soft-sys.matlab Filling in the space between two parallel lines with a color ... how to fill ... help with simple polygon tessellation - comp.graphics.api.opengl ...Filling in the space between two parallel lines with a color ... help with simple polygon tessellation - comp.graphics.api.opengl ... Filling in the space between two ... Creating a custom JSplitPane component - comp.lang.java.gui ...Filling in the space between two parallel lines with a color ... Hello all, How do you go about coloring the space between two parallel lines on a plot? regression between two sets of circular data - comp.soft-sys ...Filling in the space between two parallel lines with a color ... regression between two sets of circular data - comp.soft-sys ... intersection point calculation between ... Fill a single contour - comp.soft-sys.matlabPlot area color - comp.soft-sys.matlab set(gca,'Color',[1.0 0.8 0.1]); By the way,I m not sure whether this code will ... Filling in the space between two parallel lines ... angle between 2 lines on image - comp.soft-sys.matlabFilling in the space between two parallel lines with a color ..... coloring the space between two parallel lines ... dividing color image into nxn non overlapping blocks ... Filling in the space between two parallel lines with a color ...Hello all, How do you go about coloring the space between two parallel lines on a plot? Fill() seems to be for closed shapes.. so that's no good... Filling in the space between two parallel lines... - Newsreader ...Thread Subject: Filling in the space between two parallel lines with a color 7/23/2012 6:32:48 AM
|