Fill area between curves with tikzfillbetween
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I need to fill the area between a few curves with tikzfillbetween
, but I don't want the inner circle to be filled.
documentclassstandalone
usepackagetikz
usepackagepgfplots
usetikzlibrarypatterns
pgfplotssetcompat=1.10
usepgfplotslibraryfillbetween
begindocument
begintikzpicture[scale=1]
defR1
defs0.2
draw [black, line width=1pt,samples=100,domain=0:2*pi, name path=A]
plot (R*cos(x r), R*sin(x r));
draw [black, line width=1pt,samples=100,domain=-pi/6:pi/6, name path=B]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/6:pi/2, name path=C]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/2:5/6*pi, name path=D]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=5*pi/6:7*pi/6, name path=E]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=7*pi/6:3*pi/2, name path=F]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=3*pi/2:11*pi/6, name path=G]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
tikzfillbetween[of=A and B]blue;
tikzfillbetween[of=A and C]red;
tikzfillbetween[of=A and D]blue;
tikzfillbetween[of=A and E]red;
tikzfillbetween[of=A and F]blue;
tikzfillbetween[of=A and G]red;
endtikzpicture
enddocument
tikz-pgf draw
add a comment |Â
up vote
2
down vote
favorite
I need to fill the area between a few curves with tikzfillbetween
, but I don't want the inner circle to be filled.
documentclassstandalone
usepackagetikz
usepackagepgfplots
usetikzlibrarypatterns
pgfplotssetcompat=1.10
usepgfplotslibraryfillbetween
begindocument
begintikzpicture[scale=1]
defR1
defs0.2
draw [black, line width=1pt,samples=100,domain=0:2*pi, name path=A]
plot (R*cos(x r), R*sin(x r));
draw [black, line width=1pt,samples=100,domain=-pi/6:pi/6, name path=B]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/6:pi/2, name path=C]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/2:5/6*pi, name path=D]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=5*pi/6:7*pi/6, name path=E]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=7*pi/6:3*pi/2, name path=F]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=3*pi/2:11*pi/6, name path=G]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
tikzfillbetween[of=A and B]blue;
tikzfillbetween[of=A and C]red;
tikzfillbetween[of=A and D]blue;
tikzfillbetween[of=A and E]red;
tikzfillbetween[of=A and F]blue;
tikzfillbetween[of=A and G]red;
endtikzpicture
enddocument
tikz-pgf draw
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I need to fill the area between a few curves with tikzfillbetween
, but I don't want the inner circle to be filled.
documentclassstandalone
usepackagetikz
usepackagepgfplots
usetikzlibrarypatterns
pgfplotssetcompat=1.10
usepgfplotslibraryfillbetween
begindocument
begintikzpicture[scale=1]
defR1
defs0.2
draw [black, line width=1pt,samples=100,domain=0:2*pi, name path=A]
plot (R*cos(x r), R*sin(x r));
draw [black, line width=1pt,samples=100,domain=-pi/6:pi/6, name path=B]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/6:pi/2, name path=C]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/2:5/6*pi, name path=D]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=5*pi/6:7*pi/6, name path=E]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=7*pi/6:3*pi/2, name path=F]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=3*pi/2:11*pi/6, name path=G]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
tikzfillbetween[of=A and B]blue;
tikzfillbetween[of=A and C]red;
tikzfillbetween[of=A and D]blue;
tikzfillbetween[of=A and E]red;
tikzfillbetween[of=A and F]blue;
tikzfillbetween[of=A and G]red;
endtikzpicture
enddocument
tikz-pgf draw
I need to fill the area between a few curves with tikzfillbetween
, but I don't want the inner circle to be filled.
documentclassstandalone
usepackagetikz
usepackagepgfplots
usetikzlibrarypatterns
pgfplotssetcompat=1.10
usepgfplotslibraryfillbetween
begindocument
begintikzpicture[scale=1]
defR1
defs0.2
draw [black, line width=1pt,samples=100,domain=0:2*pi, name path=A]
plot (R*cos(x r), R*sin(x r));
draw [black, line width=1pt,samples=100,domain=-pi/6:pi/6, name path=B]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/6:pi/2, name path=C]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/2:5/6*pi, name path=D]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=5*pi/6:7*pi/6, name path=E]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=7*pi/6:3*pi/2, name path=F]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=3*pi/2:11*pi/6, name path=G]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
tikzfillbetween[of=A and B]blue;
tikzfillbetween[of=A and C]red;
tikzfillbetween[of=A and D]blue;
tikzfillbetween[of=A and E]red;
tikzfillbetween[of=A and F]blue;
tikzfillbetween[of=A and G]red;
endtikzpicture
enddocument
tikz-pgf draw
tikz-pgf draw
asked 4 hours ago
jlorenzo
183
183
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
I have never used pgfplots
before and I notice that your code consists in making 6 times the same curve by rotating it around the origin. So I used two foreach
loops: one to color in blue, the other to color in red with the same code as you.
This results in:
documentclass[border=5mm]standalone
usepackagetikz
usepackagepgfplots
usetikzlibrarypatterns
pgfplotssetcompat=1.10
usepgfplotslibraryfillbetween
begindocument
begintikzpicture[scale=1]
defR1
defs0.2
foreach d in -pi/6:pi/6,pi/2:5/6*pi,-pi/2:-5*pi/6
draw [black, line width=1pt,samples=100,domain=d, name path=B]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=d, name path=A]
plot (R*cos(x r), R*sin(x r));
tikzfillbetween[of=B and A]blue;
foreach d [count=c] in pi/2:pi/6,5*pi/6:7*pi/6,3*pi/2:11*pi/6
draw [black, line width=1pt,samples=100,domain=d, name path=C]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=d, name path=A]
plot (R*cos(x r), R*sin(x r));
tikzfillbetween[of=A and C]red;
endtikzpicture
enddocument
The pgfplots library fillbetween can be used without doing pgfplots stuff, i.e. without using anaxis
environment. It allows you to fill intersection segments of long paths. (If the task here is just to produce the picture, you only need to fill the inner circle white at the end of the OP's code. I thought the task was to make use of the pgfplots library fillbetween because the OP is loading it. However, who knows. +1)
â marmot
2 hours ago
@marmot I didn't quite understand your comment. The only thing I did was to trace each of the six lunula separately with thefillbetween
library. I didn't try to do what the OP said, I coded the same construction differently to get around its problem. I could have done 120° rotations, it would have resulted in the same result. +1 too :)
â AndréC
1 hour ago
What I want to say is that withfillbetween
you can decompose a long path into small segments for the fills, and you do not have to create a whole lot of additional paths. In this case, this can be done because we know the parametrizations of the segments, in general, however, we do not, and then this library is really useful.
â marmot
1 hour ago
add a comment |Â
up vote
2
down vote
You are loading but not really using the pgfplots
library fillbetween
. In order to achieve what you want, consider filling intersection sequences rather than the full paths. A
is very long, and if you fill the full thing, the circle will be filled.
documentclassstandalone
usepackagetikz
usepackagepgfplots
usetikzlibrarypatterns
pgfplotssetcompat=1.10
usepgfplotslibraryfillbetween
begindocument
begintikzpicture[scale=1]
defR1
defs0.2
draw [black, line width=1pt,samples=100,domain=0:2*pi, name path=A]
plot (R*cos(x r), R*sin(x r));
draw [black, line width=1pt,samples=100,domain=-pi/6:pi/6, name path=B]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/6:pi/2, name path=C]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/2:5/6*pi, name path=D]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=5*pi/6:7*pi/6, name path=E]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=7*pi/6:3*pi/2, name path=F]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=3*pi/2:11*pi/6, name path=G]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
fill [blue,intersection segments=of=A and B,
sequence=A0 -- B1[reverse]];
fill [red,intersection segments=of=A and C,
sequence=A1 -- B1[reverse]];
fill [blue,intersection segments=of=A and D,
sequence=A1 -- B1[reverse]];
fill [red,intersection segments=of=A and E,
sequence=A1 -- B1[reverse]];
fill [blue,intersection segments=of=A and F,
sequence=A1 -- B1[reverse]];
fill [red,intersection segments=of=A and G,
sequence=A1 -- B1[reverse]];
endtikzpicture
enddocument
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
I have never used pgfplots
before and I notice that your code consists in making 6 times the same curve by rotating it around the origin. So I used two foreach
loops: one to color in blue, the other to color in red with the same code as you.
This results in:
documentclass[border=5mm]standalone
usepackagetikz
usepackagepgfplots
usetikzlibrarypatterns
pgfplotssetcompat=1.10
usepgfplotslibraryfillbetween
begindocument
begintikzpicture[scale=1]
defR1
defs0.2
foreach d in -pi/6:pi/6,pi/2:5/6*pi,-pi/2:-5*pi/6
draw [black, line width=1pt,samples=100,domain=d, name path=B]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=d, name path=A]
plot (R*cos(x r), R*sin(x r));
tikzfillbetween[of=B and A]blue;
foreach d [count=c] in pi/2:pi/6,5*pi/6:7*pi/6,3*pi/2:11*pi/6
draw [black, line width=1pt,samples=100,domain=d, name path=C]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=d, name path=A]
plot (R*cos(x r), R*sin(x r));
tikzfillbetween[of=A and C]red;
endtikzpicture
enddocument
The pgfplots library fillbetween can be used without doing pgfplots stuff, i.e. without using anaxis
environment. It allows you to fill intersection segments of long paths. (If the task here is just to produce the picture, you only need to fill the inner circle white at the end of the OP's code. I thought the task was to make use of the pgfplots library fillbetween because the OP is loading it. However, who knows. +1)
â marmot
2 hours ago
@marmot I didn't quite understand your comment. The only thing I did was to trace each of the six lunula separately with thefillbetween
library. I didn't try to do what the OP said, I coded the same construction differently to get around its problem. I could have done 120° rotations, it would have resulted in the same result. +1 too :)
â AndréC
1 hour ago
What I want to say is that withfillbetween
you can decompose a long path into small segments for the fills, and you do not have to create a whole lot of additional paths. In this case, this can be done because we know the parametrizations of the segments, in general, however, we do not, and then this library is really useful.
â marmot
1 hour ago
add a comment |Â
up vote
3
down vote
I have never used pgfplots
before and I notice that your code consists in making 6 times the same curve by rotating it around the origin. So I used two foreach
loops: one to color in blue, the other to color in red with the same code as you.
This results in:
documentclass[border=5mm]standalone
usepackagetikz
usepackagepgfplots
usetikzlibrarypatterns
pgfplotssetcompat=1.10
usepgfplotslibraryfillbetween
begindocument
begintikzpicture[scale=1]
defR1
defs0.2
foreach d in -pi/6:pi/6,pi/2:5/6*pi,-pi/2:-5*pi/6
draw [black, line width=1pt,samples=100,domain=d, name path=B]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=d, name path=A]
plot (R*cos(x r), R*sin(x r));
tikzfillbetween[of=B and A]blue;
foreach d [count=c] in pi/2:pi/6,5*pi/6:7*pi/6,3*pi/2:11*pi/6
draw [black, line width=1pt,samples=100,domain=d, name path=C]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=d, name path=A]
plot (R*cos(x r), R*sin(x r));
tikzfillbetween[of=A and C]red;
endtikzpicture
enddocument
The pgfplots library fillbetween can be used without doing pgfplots stuff, i.e. without using anaxis
environment. It allows you to fill intersection segments of long paths. (If the task here is just to produce the picture, you only need to fill the inner circle white at the end of the OP's code. I thought the task was to make use of the pgfplots library fillbetween because the OP is loading it. However, who knows. +1)
â marmot
2 hours ago
@marmot I didn't quite understand your comment. The only thing I did was to trace each of the six lunula separately with thefillbetween
library. I didn't try to do what the OP said, I coded the same construction differently to get around its problem. I could have done 120° rotations, it would have resulted in the same result. +1 too :)
â AndréC
1 hour ago
What I want to say is that withfillbetween
you can decompose a long path into small segments for the fills, and you do not have to create a whole lot of additional paths. In this case, this can be done because we know the parametrizations of the segments, in general, however, we do not, and then this library is really useful.
â marmot
1 hour ago
add a comment |Â
up vote
3
down vote
up vote
3
down vote
I have never used pgfplots
before and I notice that your code consists in making 6 times the same curve by rotating it around the origin. So I used two foreach
loops: one to color in blue, the other to color in red with the same code as you.
This results in:
documentclass[border=5mm]standalone
usepackagetikz
usepackagepgfplots
usetikzlibrarypatterns
pgfplotssetcompat=1.10
usepgfplotslibraryfillbetween
begindocument
begintikzpicture[scale=1]
defR1
defs0.2
foreach d in -pi/6:pi/6,pi/2:5/6*pi,-pi/2:-5*pi/6
draw [black, line width=1pt,samples=100,domain=d, name path=B]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=d, name path=A]
plot (R*cos(x r), R*sin(x r));
tikzfillbetween[of=B and A]blue;
foreach d [count=c] in pi/2:pi/6,5*pi/6:7*pi/6,3*pi/2:11*pi/6
draw [black, line width=1pt,samples=100,domain=d, name path=C]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=d, name path=A]
plot (R*cos(x r), R*sin(x r));
tikzfillbetween[of=A and C]red;
endtikzpicture
enddocument
I have never used pgfplots
before and I notice that your code consists in making 6 times the same curve by rotating it around the origin. So I used two foreach
loops: one to color in blue, the other to color in red with the same code as you.
This results in:
documentclass[border=5mm]standalone
usepackagetikz
usepackagepgfplots
usetikzlibrarypatterns
pgfplotssetcompat=1.10
usepgfplotslibraryfillbetween
begindocument
begintikzpicture[scale=1]
defR1
defs0.2
foreach d in -pi/6:pi/6,pi/2:5/6*pi,-pi/2:-5*pi/6
draw [black, line width=1pt,samples=100,domain=d, name path=B]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=d, name path=A]
plot (R*cos(x r), R*sin(x r));
tikzfillbetween[of=B and A]blue;
foreach d [count=c] in pi/2:pi/6,5*pi/6:7*pi/6,3*pi/2:11*pi/6
draw [black, line width=1pt,samples=100,domain=d, name path=C]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=d, name path=A]
plot (R*cos(x r), R*sin(x r));
tikzfillbetween[of=A and C]red;
endtikzpicture
enddocument
answered 3 hours ago
AndréC
3,481729
3,481729
The pgfplots library fillbetween can be used without doing pgfplots stuff, i.e. without using anaxis
environment. It allows you to fill intersection segments of long paths. (If the task here is just to produce the picture, you only need to fill the inner circle white at the end of the OP's code. I thought the task was to make use of the pgfplots library fillbetween because the OP is loading it. However, who knows. +1)
â marmot
2 hours ago
@marmot I didn't quite understand your comment. The only thing I did was to trace each of the six lunula separately with thefillbetween
library. I didn't try to do what the OP said, I coded the same construction differently to get around its problem. I could have done 120° rotations, it would have resulted in the same result. +1 too :)
â AndréC
1 hour ago
What I want to say is that withfillbetween
you can decompose a long path into small segments for the fills, and you do not have to create a whole lot of additional paths. In this case, this can be done because we know the parametrizations of the segments, in general, however, we do not, and then this library is really useful.
â marmot
1 hour ago
add a comment |Â
The pgfplots library fillbetween can be used without doing pgfplots stuff, i.e. without using anaxis
environment. It allows you to fill intersection segments of long paths. (If the task here is just to produce the picture, you only need to fill the inner circle white at the end of the OP's code. I thought the task was to make use of the pgfplots library fillbetween because the OP is loading it. However, who knows. +1)
â marmot
2 hours ago
@marmot I didn't quite understand your comment. The only thing I did was to trace each of the six lunula separately with thefillbetween
library. I didn't try to do what the OP said, I coded the same construction differently to get around its problem. I could have done 120° rotations, it would have resulted in the same result. +1 too :)
â AndréC
1 hour ago
What I want to say is that withfillbetween
you can decompose a long path into small segments for the fills, and you do not have to create a whole lot of additional paths. In this case, this can be done because we know the parametrizations of the segments, in general, however, we do not, and then this library is really useful.
â marmot
1 hour ago
The pgfplots library fillbetween can be used without doing pgfplots stuff, i.e. without using an
axis
environment. It allows you to fill intersection segments of long paths. (If the task here is just to produce the picture, you only need to fill the inner circle white at the end of the OP's code. I thought the task was to make use of the pgfplots library fillbetween because the OP is loading it. However, who knows. +1)â marmot
2 hours ago
The pgfplots library fillbetween can be used without doing pgfplots stuff, i.e. without using an
axis
environment. It allows you to fill intersection segments of long paths. (If the task here is just to produce the picture, you only need to fill the inner circle white at the end of the OP's code. I thought the task was to make use of the pgfplots library fillbetween because the OP is loading it. However, who knows. +1)â marmot
2 hours ago
@marmot I didn't quite understand your comment. The only thing I did was to trace each of the six lunula separately with the
fillbetween
library. I didn't try to do what the OP said, I coded the same construction differently to get around its problem. I could have done 120° rotations, it would have resulted in the same result. +1 too :)â AndréC
1 hour ago
@marmot I didn't quite understand your comment. The only thing I did was to trace each of the six lunula separately with the
fillbetween
library. I didn't try to do what the OP said, I coded the same construction differently to get around its problem. I could have done 120° rotations, it would have resulted in the same result. +1 too :)â AndréC
1 hour ago
What I want to say is that with
fillbetween
you can decompose a long path into small segments for the fills, and you do not have to create a whole lot of additional paths. In this case, this can be done because we know the parametrizations of the segments, in general, however, we do not, and then this library is really useful.â marmot
1 hour ago
What I want to say is that with
fillbetween
you can decompose a long path into small segments for the fills, and you do not have to create a whole lot of additional paths. In this case, this can be done because we know the parametrizations of the segments, in general, however, we do not, and then this library is really useful.â marmot
1 hour ago
add a comment |Â
up vote
2
down vote
You are loading but not really using the pgfplots
library fillbetween
. In order to achieve what you want, consider filling intersection sequences rather than the full paths. A
is very long, and if you fill the full thing, the circle will be filled.
documentclassstandalone
usepackagetikz
usepackagepgfplots
usetikzlibrarypatterns
pgfplotssetcompat=1.10
usepgfplotslibraryfillbetween
begindocument
begintikzpicture[scale=1]
defR1
defs0.2
draw [black, line width=1pt,samples=100,domain=0:2*pi, name path=A]
plot (R*cos(x r), R*sin(x r));
draw [black, line width=1pt,samples=100,domain=-pi/6:pi/6, name path=B]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/6:pi/2, name path=C]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/2:5/6*pi, name path=D]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=5*pi/6:7*pi/6, name path=E]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=7*pi/6:3*pi/2, name path=F]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=3*pi/2:11*pi/6, name path=G]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
fill [blue,intersection segments=of=A and B,
sequence=A0 -- B1[reverse]];
fill [red,intersection segments=of=A and C,
sequence=A1 -- B1[reverse]];
fill [blue,intersection segments=of=A and D,
sequence=A1 -- B1[reverse]];
fill [red,intersection segments=of=A and E,
sequence=A1 -- B1[reverse]];
fill [blue,intersection segments=of=A and F,
sequence=A1 -- B1[reverse]];
fill [red,intersection segments=of=A and G,
sequence=A1 -- B1[reverse]];
endtikzpicture
enddocument
add a comment |Â
up vote
2
down vote
You are loading but not really using the pgfplots
library fillbetween
. In order to achieve what you want, consider filling intersection sequences rather than the full paths. A
is very long, and if you fill the full thing, the circle will be filled.
documentclassstandalone
usepackagetikz
usepackagepgfplots
usetikzlibrarypatterns
pgfplotssetcompat=1.10
usepgfplotslibraryfillbetween
begindocument
begintikzpicture[scale=1]
defR1
defs0.2
draw [black, line width=1pt,samples=100,domain=0:2*pi, name path=A]
plot (R*cos(x r), R*sin(x r));
draw [black, line width=1pt,samples=100,domain=-pi/6:pi/6, name path=B]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/6:pi/2, name path=C]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/2:5/6*pi, name path=D]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=5*pi/6:7*pi/6, name path=E]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=7*pi/6:3*pi/2, name path=F]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=3*pi/2:11*pi/6, name path=G]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
fill [blue,intersection segments=of=A and B,
sequence=A0 -- B1[reverse]];
fill [red,intersection segments=of=A and C,
sequence=A1 -- B1[reverse]];
fill [blue,intersection segments=of=A and D,
sequence=A1 -- B1[reverse]];
fill [red,intersection segments=of=A and E,
sequence=A1 -- B1[reverse]];
fill [blue,intersection segments=of=A and F,
sequence=A1 -- B1[reverse]];
fill [red,intersection segments=of=A and G,
sequence=A1 -- B1[reverse]];
endtikzpicture
enddocument
add a comment |Â
up vote
2
down vote
up vote
2
down vote
You are loading but not really using the pgfplots
library fillbetween
. In order to achieve what you want, consider filling intersection sequences rather than the full paths. A
is very long, and if you fill the full thing, the circle will be filled.
documentclassstandalone
usepackagetikz
usepackagepgfplots
usetikzlibrarypatterns
pgfplotssetcompat=1.10
usepgfplotslibraryfillbetween
begindocument
begintikzpicture[scale=1]
defR1
defs0.2
draw [black, line width=1pt,samples=100,domain=0:2*pi, name path=A]
plot (R*cos(x r), R*sin(x r));
draw [black, line width=1pt,samples=100,domain=-pi/6:pi/6, name path=B]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/6:pi/2, name path=C]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/2:5/6*pi, name path=D]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=5*pi/6:7*pi/6, name path=E]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=7*pi/6:3*pi/2, name path=F]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=3*pi/2:11*pi/6, name path=G]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
fill [blue,intersection segments=of=A and B,
sequence=A0 -- B1[reverse]];
fill [red,intersection segments=of=A and C,
sequence=A1 -- B1[reverse]];
fill [blue,intersection segments=of=A and D,
sequence=A1 -- B1[reverse]];
fill [red,intersection segments=of=A and E,
sequence=A1 -- B1[reverse]];
fill [blue,intersection segments=of=A and F,
sequence=A1 -- B1[reverse]];
fill [red,intersection segments=of=A and G,
sequence=A1 -- B1[reverse]];
endtikzpicture
enddocument
You are loading but not really using the pgfplots
library fillbetween
. In order to achieve what you want, consider filling intersection sequences rather than the full paths. A
is very long, and if you fill the full thing, the circle will be filled.
documentclassstandalone
usepackagetikz
usepackagepgfplots
usetikzlibrarypatterns
pgfplotssetcompat=1.10
usepgfplotslibraryfillbetween
begindocument
begintikzpicture[scale=1]
defR1
defs0.2
draw [black, line width=1pt,samples=100,domain=0:2*pi, name path=A]
plot (R*cos(x r), R*sin(x r));
draw [black, line width=1pt,samples=100,domain=-pi/6:pi/6, name path=B]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/6:pi/2, name path=C]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=pi/2:5/6*pi, name path=D]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=5*pi/6:7*pi/6, name path=E]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=7*pi/6:3*pi/2, name path=F]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
draw [black, line width=1pt,samples=100,domain=3*pi/2:11*pi/6, name path=G]
plot ((R + abs(s*cos(3*x r)))*cos(x r), (R + abs(s*cos(3*x r)))*sin(x r));
fill [blue,intersection segments=of=A and B,
sequence=A0 -- B1[reverse]];
fill [red,intersection segments=of=A and C,
sequence=A1 -- B1[reverse]];
fill [blue,intersection segments=of=A and D,
sequence=A1 -- B1[reverse]];
fill [red,intersection segments=of=A and E,
sequence=A1 -- B1[reverse]];
fill [blue,intersection segments=of=A and F,
sequence=A1 -- B1[reverse]];
fill [red,intersection segments=of=A and G,
sequence=A1 -- B1[reverse]];
endtikzpicture
enddocument
answered 4 hours ago
marmot
63.5k468136
63.5k468136
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f454240%2ffill-area-between-curves-with-tikzfillbetween%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password