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
Why are stats in Angband written as 18/** instead of 19, 20...?
Does the US Supreme Court vote using secret ballots?
Using `printf` to print variable containing `%` percent sign results in "bash: printf: `p': invalid format character"
Why using a variable as index of a list-item does not retrieve that item with clist_item:Nn?
Does the talk count as invited if my PI invited me?
Why is the S-duct intake on the Tu-154 uniquely oblong?
Pedaling at different gear ratios on flat terrain: what's the point?
Quotient of Three Dimensional Torus by Permutation on Coordinates
Combining two Lorentz boosts
In Dutch history two people are referred to as "William III"; are there any more cases where this happens?
Does a windmilling propeller create more drag than a stopped propeller in an engine out scenario
on the truth quest vs in the quest for truth
What color to choose as "danger" if the main color of my app is red
Why does string strummed with finger sound different from the one strummed with pick?
Can an airline pilot be prosecuted for killing an unruly passenger who could not be physically restrained?
Windows reverting changes made by Linux to FAT32 partion
Will this series of events work to drown the Tarrasque?
Why is choosing a suitable thermodynamic potential important?
Cycling to work - 30mile return
Can the word crowd refer to just 10 people?
Should all adjustments be random effects in a mixed linear effect?
Are there any symmetric cryptosystems based on computational complexity assumptions?
Working hours and productivity expectations for game artists and programmers
Driving a school bus in the USA
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
127k6162308
127k6162308
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
134k872179
134k872179
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