Tikz draw contour without some edges, and fillHow to draw path with alternating colorsCurved line with varying styleRotate a node but not its content: the case of the ellipse decorationNumerical conditional within tikz keys?Drawing a flag in Tikz!TikZ: Drawing an arc from an intersection to an intersectionHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?Drawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingTikz externalize and placing a caption overlapping with a pictureLine up nested tikz enviroments or how to get rid of themHow to draw a square and its diagonals with arrows?beginfigure… endfigure is not working with tikz package
How strong are Wi-Fi signals?
What is Theresa May waiting for?
Count rotary dial pulses in a phone number (including letters)
Who will lead the country until there is a new Tory leader?
Which European Languages are not Indo-European?
Realizing cohomology classes by submanifolds
Why didn't Project Mercury advance to an orbital flight on their second mission?
Sitecore 9.0 works with solr 7.2.1?
Website returning plaintext password
I unknowingly submitted plagarised work
Installed Tankless Water Heater - Internet loss when active
Would Jetfuel for a modern jet like an F-16 or a F-35 be producable in the WW2 era?
Compaq Portable vs IBM 5155 Portable PC
Gladys goes shopping
What does this symbol on the box of power supply mean?
Is "cool" appropriate or offensive to use in IMs?
what kind of chord progession is this?
Why is the LastName field required for the contact? What is the best approach to import contacts that only have the first name?
My employer faked my resume to acquire projects
Make 24 using exactly three 3s
Should breaking down something like a door be adjudicated as an attempt to beat its AC and HP, or as an ability check against a set DC?
Apache redirect to https:/www only partially working
Can I tell a prospective employee that everyone in the team is leaving?
The art of clickbait captions
Tikz draw contour without some edges, and fill
How to draw path with alternating colorsCurved line with varying styleRotate a node but not its content: the case of the ellipse decorationNumerical conditional within tikz keys?Drawing a flag in Tikz!TikZ: Drawing an arc from an intersection to an intersectionHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?Drawing rectilinear curves in Tikz, aka an Etch-a-Sketch drawingTikz externalize and placing a caption overlapping with a pictureLine up nested tikz enviroments or how to get rid of themHow to draw a square and its diagonals with arrows?beginfigure… endfigure is not working with tikz package
I'd like to draw two wave-shaped contours, as in the figure below, and fill the area between. I tried the following code, but it produces an undesired black vertical edge on the right. How do I remove that?
documentclass[tikz]standalone
begindocument
begintikzpicture
useasboundingbox (-1,-1) rectangle (6,2);
draw[fill=black!10] (0,1) to[out=0,in=180] ++(5,-0.6) -- ++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
endtikzpicture
enddocument

I also tried to remove the -- between ++(5,-0.6) and ++(0,0.6) in the 5th line, it doesn't draw the undesired edge, but it messes up the filling.
documentclass[tikz]standalone
begindocument
begintikzpicture
useasboundingbox (-1,-1) rectangle (6,2);
draw[fill=black!10] (0,1) to[out=0,in=180] ++(5,-0.6) ++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
endtikzpicture
enddocument

tikz-pgf
add a comment |
I'd like to draw two wave-shaped contours, as in the figure below, and fill the area between. I tried the following code, but it produces an undesired black vertical edge on the right. How do I remove that?
documentclass[tikz]standalone
begindocument
begintikzpicture
useasboundingbox (-1,-1) rectangle (6,2);
draw[fill=black!10] (0,1) to[out=0,in=180] ++(5,-0.6) -- ++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
endtikzpicture
enddocument

I also tried to remove the -- between ++(5,-0.6) and ++(0,0.6) in the 5th line, it doesn't draw the undesired edge, but it messes up the filling.
documentclass[tikz]standalone
begindocument
begintikzpicture
useasboundingbox (-1,-1) rectangle (6,2);
draw[fill=black!10] (0,1) to[out=0,in=180] ++(5,-0.6) ++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
endtikzpicture
enddocument

tikz-pgf
add a comment |
I'd like to draw two wave-shaped contours, as in the figure below, and fill the area between. I tried the following code, but it produces an undesired black vertical edge on the right. How do I remove that?
documentclass[tikz]standalone
begindocument
begintikzpicture
useasboundingbox (-1,-1) rectangle (6,2);
draw[fill=black!10] (0,1) to[out=0,in=180] ++(5,-0.6) -- ++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
endtikzpicture
enddocument

I also tried to remove the -- between ++(5,-0.6) and ++(0,0.6) in the 5th line, it doesn't draw the undesired edge, but it messes up the filling.
documentclass[tikz]standalone
begindocument
begintikzpicture
useasboundingbox (-1,-1) rectangle (6,2);
draw[fill=black!10] (0,1) to[out=0,in=180] ++(5,-0.6) ++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
endtikzpicture
enddocument

tikz-pgf
I'd like to draw two wave-shaped contours, as in the figure below, and fill the area between. I tried the following code, but it produces an undesired black vertical edge on the right. How do I remove that?
documentclass[tikz]standalone
begindocument
begintikzpicture
useasboundingbox (-1,-1) rectangle (6,2);
draw[fill=black!10] (0,1) to[out=0,in=180] ++(5,-0.6) -- ++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
endtikzpicture
enddocument

I also tried to remove the -- between ++(5,-0.6) and ++(0,0.6) in the 5th line, it doesn't draw the undesired edge, but it messes up the filling.
documentclass[tikz]standalone
begindocument
begintikzpicture
useasboundingbox (-1,-1) rectangle (6,2);
draw[fill=black!10] (0,1) to[out=0,in=180] ++(5,-0.6) ++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
endtikzpicture
enddocument

tikz-pgf
tikz-pgf
asked May 12 at 18:43
AlexAlex
1553
1553
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
Quick and dirty: fill the area first and then draw what you want to draw. It is not easily possible to switch off the drawing of a part of a path (but it is possible yet considerably more effort).
documentclass[tikz]standalone
begindocument
begintikzpicture
useasboundingbox (-1,-1) rectangle (6,2);
path[fill=black!10] (0,1) to[out=0,in=180] ++(5,-0.6) -- ++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
draw (0,1) to[out=0,in=180] ++(5,-0.6)++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
endtikzpicture
enddocument

You can switch the path on and off e.g. using this answer.
documentclass[tikz]standalone
pgfkeystikz/.cd,
edge options/.code=tikzsetedge style/.style=#1,
begindocument
begintikzpicture[every edge/.append code = % https://tex.stackexchange.com/a/396092/121799
globalletcurrenttargettikztotarget % save tikztotarget in a global variable
pgfkeysalsoappend after command=to[edge style] (currenttarget),
every edge/.append style=edge style ]
useasboundingbox (-1,-1) rectangle (6,2);
path[fill=black!10]
(0,1) [edge options=out=0,in=180,draw=black] edge ++(5,-0.6)
-- ++(0,0.6)
[edge options=out=180,in=0,draw=black] edge ++(-5,-0.6);
endtikzpicture
enddocument
add a comment |
With use TikZ library pgfplots.fillbetween
documentclass[margin=3mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
usetikzlibrarypgfplots.fillbetween
begindocument
begintikzpicture
draw[name path=A] (0, 0.3) to [out=0,in=180] ++(5,-0.6);
draw[name path=B] (0,-0.3) to [out=0,in=180] ++(5, 0.6);
tikzfillbetween[of=A and B] fill=gray!30;
endtikzpicture
enddocument

add a comment |
For comparison, with plain Metapost, where filling and drawing are kept separate, and where you can concatenate path variables directly.
documentclass[border=5mm]standalone
usepackageluatex85
usepackageluamplib
begindocument
beginmplibcode
beginfig(1);
z0 = (-72, 8.5);
path A, B;
A = z0 right .. right z0 rotated 180;
B = A reflectedabout(up, down);
fill A -- B -- cycle withcolor 7/8[blue, white];
draw A;
draw B;
endfig;
endmplibcode
enddocument
(compile with lualatex...)

add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f490511%2ftikz-draw-contour-without-some-edges-and-fill%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Quick and dirty: fill the area first and then draw what you want to draw. It is not easily possible to switch off the drawing of a part of a path (but it is possible yet considerably more effort).
documentclass[tikz]standalone
begindocument
begintikzpicture
useasboundingbox (-1,-1) rectangle (6,2);
path[fill=black!10] (0,1) to[out=0,in=180] ++(5,-0.6) -- ++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
draw (0,1) to[out=0,in=180] ++(5,-0.6)++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
endtikzpicture
enddocument

You can switch the path on and off e.g. using this answer.
documentclass[tikz]standalone
pgfkeystikz/.cd,
edge options/.code=tikzsetedge style/.style=#1,
begindocument
begintikzpicture[every edge/.append code = % https://tex.stackexchange.com/a/396092/121799
globalletcurrenttargettikztotarget % save tikztotarget in a global variable
pgfkeysalsoappend after command=to[edge style] (currenttarget),
every edge/.append style=edge style ]
useasboundingbox (-1,-1) rectangle (6,2);
path[fill=black!10]
(0,1) [edge options=out=0,in=180,draw=black] edge ++(5,-0.6)
-- ++(0,0.6)
[edge options=out=180,in=0,draw=black] edge ++(-5,-0.6);
endtikzpicture
enddocument
add a comment |
Quick and dirty: fill the area first and then draw what you want to draw. It is not easily possible to switch off the drawing of a part of a path (but it is possible yet considerably more effort).
documentclass[tikz]standalone
begindocument
begintikzpicture
useasboundingbox (-1,-1) rectangle (6,2);
path[fill=black!10] (0,1) to[out=0,in=180] ++(5,-0.6) -- ++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
draw (0,1) to[out=0,in=180] ++(5,-0.6)++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
endtikzpicture
enddocument

You can switch the path on and off e.g. using this answer.
documentclass[tikz]standalone
pgfkeystikz/.cd,
edge options/.code=tikzsetedge style/.style=#1,
begindocument
begintikzpicture[every edge/.append code = % https://tex.stackexchange.com/a/396092/121799
globalletcurrenttargettikztotarget % save tikztotarget in a global variable
pgfkeysalsoappend after command=to[edge style] (currenttarget),
every edge/.append style=edge style ]
useasboundingbox (-1,-1) rectangle (6,2);
path[fill=black!10]
(0,1) [edge options=out=0,in=180,draw=black] edge ++(5,-0.6)
-- ++(0,0.6)
[edge options=out=180,in=0,draw=black] edge ++(-5,-0.6);
endtikzpicture
enddocument
add a comment |
Quick and dirty: fill the area first and then draw what you want to draw. It is not easily possible to switch off the drawing of a part of a path (but it is possible yet considerably more effort).
documentclass[tikz]standalone
begindocument
begintikzpicture
useasboundingbox (-1,-1) rectangle (6,2);
path[fill=black!10] (0,1) to[out=0,in=180] ++(5,-0.6) -- ++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
draw (0,1) to[out=0,in=180] ++(5,-0.6)++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
endtikzpicture
enddocument

You can switch the path on and off e.g. using this answer.
documentclass[tikz]standalone
pgfkeystikz/.cd,
edge options/.code=tikzsetedge style/.style=#1,
begindocument
begintikzpicture[every edge/.append code = % https://tex.stackexchange.com/a/396092/121799
globalletcurrenttargettikztotarget % save tikztotarget in a global variable
pgfkeysalsoappend after command=to[edge style] (currenttarget),
every edge/.append style=edge style ]
useasboundingbox (-1,-1) rectangle (6,2);
path[fill=black!10]
(0,1) [edge options=out=0,in=180,draw=black] edge ++(5,-0.6)
-- ++(0,0.6)
[edge options=out=180,in=0,draw=black] edge ++(-5,-0.6);
endtikzpicture
enddocument
Quick and dirty: fill the area first and then draw what you want to draw. It is not easily possible to switch off the drawing of a part of a path (but it is possible yet considerably more effort).
documentclass[tikz]standalone
begindocument
begintikzpicture
useasboundingbox (-1,-1) rectangle (6,2);
path[fill=black!10] (0,1) to[out=0,in=180] ++(5,-0.6) -- ++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
draw (0,1) to[out=0,in=180] ++(5,-0.6)++(0,0.6) to[out=180,in=0] ++(-5,-0.6);
endtikzpicture
enddocument

You can switch the path on and off e.g. using this answer.
documentclass[tikz]standalone
pgfkeystikz/.cd,
edge options/.code=tikzsetedge style/.style=#1,
begindocument
begintikzpicture[every edge/.append code = % https://tex.stackexchange.com/a/396092/121799
globalletcurrenttargettikztotarget % save tikztotarget in a global variable
pgfkeysalsoappend after command=to[edge style] (currenttarget),
every edge/.append style=edge style ]
useasboundingbox (-1,-1) rectangle (6,2);
path[fill=black!10]
(0,1) [edge options=out=0,in=180,draw=black] edge ++(5,-0.6)
-- ++(0,0.6)
[edge options=out=180,in=0,draw=black] edge ++(-5,-0.6);
endtikzpicture
enddocument
edited May 12 at 19:02
answered May 12 at 18:46
marmotmarmot
130k6164311
130k6164311
add a comment |
add a comment |
With use TikZ library pgfplots.fillbetween
documentclass[margin=3mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
usetikzlibrarypgfplots.fillbetween
begindocument
begintikzpicture
draw[name path=A] (0, 0.3) to [out=0,in=180] ++(5,-0.6);
draw[name path=B] (0,-0.3) to [out=0,in=180] ++(5, 0.6);
tikzfillbetween[of=A and B] fill=gray!30;
endtikzpicture
enddocument

add a comment |
With use TikZ library pgfplots.fillbetween
documentclass[margin=3mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
usetikzlibrarypgfplots.fillbetween
begindocument
begintikzpicture
draw[name path=A] (0, 0.3) to [out=0,in=180] ++(5,-0.6);
draw[name path=B] (0,-0.3) to [out=0,in=180] ++(5, 0.6);
tikzfillbetween[of=A and B] fill=gray!30;
endtikzpicture
enddocument

add a comment |
With use TikZ library pgfplots.fillbetween
documentclass[margin=3mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
usetikzlibrarypgfplots.fillbetween
begindocument
begintikzpicture
draw[name path=A] (0, 0.3) to [out=0,in=180] ++(5,-0.6);
draw[name path=B] (0,-0.3) to [out=0,in=180] ++(5, 0.6);
tikzfillbetween[of=A and B] fill=gray!30;
endtikzpicture
enddocument

With use TikZ library pgfplots.fillbetween
documentclass[margin=3mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
usetikzlibrarypgfplots.fillbetween
begindocument
begintikzpicture
draw[name path=A] (0, 0.3) to [out=0,in=180] ++(5,-0.6);
draw[name path=B] (0,-0.3) to [out=0,in=180] ++(5, 0.6);
tikzfillbetween[of=A and B] fill=gray!30;
endtikzpicture
enddocument

answered May 12 at 19:34
ZarkoZarko
135k872179
135k872179
add a comment |
add a comment |
For comparison, with plain Metapost, where filling and drawing are kept separate, and where you can concatenate path variables directly.
documentclass[border=5mm]standalone
usepackageluatex85
usepackageluamplib
begindocument
beginmplibcode
beginfig(1);
z0 = (-72, 8.5);
path A, B;
A = z0 right .. right z0 rotated 180;
B = A reflectedabout(up, down);
fill A -- B -- cycle withcolor 7/8[blue, white];
draw A;
draw B;
endfig;
endmplibcode
enddocument
(compile with lualatex...)

add a comment |
For comparison, with plain Metapost, where filling and drawing are kept separate, and where you can concatenate path variables directly.
documentclass[border=5mm]standalone
usepackageluatex85
usepackageluamplib
begindocument
beginmplibcode
beginfig(1);
z0 = (-72, 8.5);
path A, B;
A = z0 right .. right z0 rotated 180;
B = A reflectedabout(up, down);
fill A -- B -- cycle withcolor 7/8[blue, white];
draw A;
draw B;
endfig;
endmplibcode
enddocument
(compile with lualatex...)

add a comment |
For comparison, with plain Metapost, where filling and drawing are kept separate, and where you can concatenate path variables directly.
documentclass[border=5mm]standalone
usepackageluatex85
usepackageluamplib
begindocument
beginmplibcode
beginfig(1);
z0 = (-72, 8.5);
path A, B;
A = z0 right .. right z0 rotated 180;
B = A reflectedabout(up, down);
fill A -- B -- cycle withcolor 7/8[blue, white];
draw A;
draw B;
endfig;
endmplibcode
enddocument
(compile with lualatex...)

For comparison, with plain Metapost, where filling and drawing are kept separate, and where you can concatenate path variables directly.
documentclass[border=5mm]standalone
usepackageluatex85
usepackageluamplib
begindocument
beginmplibcode
beginfig(1);
z0 = (-72, 8.5);
path A, B;
A = z0 right .. right z0 rotated 180;
B = A reflectedabout(up, down);
fill A -- B -- cycle withcolor 7/8[blue, white];
draw A;
draw B;
endfig;
endmplibcode
enddocument
(compile with lualatex...)

answered May 13 at 8:22
ThrustonThruston
27.5k24492
27.5k24492
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f490511%2ftikz-draw-contour-without-some-edges-and-fill%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown