Easier way to draw a filled ellipse with top edge dashed and bottom edge solid?partially filled, tilted cylinder in TikZRotate a node but not its content: the case of the ellipse decorationDraw a path with dashed start and solid endHow can I get access to the size parameters of a TikZ node?How to define the default vertical distance between nodes?TikZ/ERD: node (=Entity) label on the insideTikZ: Drawing an arc from an intersection to an intersectionLine up nested tikz enviroments or how to get rid of thempgfplots issue: solid and filled markers with dashed linesAny easier way to draw lots of arrows in tikz?
Why does the U.S military use mercenaries?
Reference for electronegativities of different metal oxidation states
Can't think of a good word or term to describe not feeling or thinking
Why were early aviators' trousers flared at the thigh?
How could the B-29 bomber back up under its own power?
Have the writers and actors of Game Of Thrones responded to its poor reception?
Why is python script running in background consuming 100 % CPU?
Is it a good idea to teach algorithm courses using pseudocode instead of a real programming language?
Is the free group on two generators generated by two elements?
Warped chessboard
Greek theta instead of lower case þ (Icelandic) in TexStudio
Could a chemically propelled craft travel directly between Earth and Mars spaceports?
How was the blinking terminal cursor invented?
Chain rule instead of product rule
How come Arya Stark wasn't hurt by this in Game of Thrones Season 8 Episode 5?
How to convince boss to spend notice period on documentation instead of new projects
Does the Aboleth have expertise in history and perception?
Parse a C++14 integer literal
Gambler's Fallacy Dice
Cutting a larger circle on center of a smaller circle
Is there any official Lore on Keraptis the Wizard, apart from what is in White Plume Mountain?
Why are stats in Angband written as 18/** instead of 19, 20...?
Is being an extrovert a necessary condition to be a manager?
Cycling to work - 30 mile return
Easier way to draw a filled ellipse with top edge dashed and bottom edge solid?
partially filled, tilted cylinder in TikZRotate a node but not its content: the case of the ellipse decorationDraw a path with dashed start and solid endHow can I get access to the size parameters of a TikZ node?How to define the default vertical distance between nodes?TikZ/ERD: node (=Entity) label on the insideTikZ: Drawing an arc from an intersection to an intersectionLine up nested tikz enviroments or how to get rid of thempgfplots issue: solid and filled markers with dashed linesAny easier way to draw lots of arrows in tikz?
I wanted to draw an ellipse with top half dashed and bottom half solid but also filled. Is there a direct way to do this using the ellipse
command from usetikzlibraryshapes
?
What I do now, which feels like a trick, is to draw 2 arcs for the top and bottom half this way I can set one arc dashed and the other not. Then next draw an ellipse on top of them but without an edge, just filled. Like this
documentclass[tikz]standalone
usetikzlibraryshapes
begindocument
begintikzpicture
defxR1.25; %x radius of ellipse
defyR0.5; %y radius of ellipse
draw [dashed,domain=0:180] plot (xR*cos(x), yR*sin(x)); %top half
draw [domain=-180:0] plot (xR*cos(x), yR*sin(x)); %bottom half
fill[gray!20] (0,0) ellipse (xR and yR); %overlay with ellipse
endtikzpicture
enddocument
Is there a better way do this?
tikz-pgf
add a comment |
I wanted to draw an ellipse with top half dashed and bottom half solid but also filled. Is there a direct way to do this using the ellipse
command from usetikzlibraryshapes
?
What I do now, which feels like a trick, is to draw 2 arcs for the top and bottom half this way I can set one arc dashed and the other not. Then next draw an ellipse on top of them but without an edge, just filled. Like this
documentclass[tikz]standalone
usetikzlibraryshapes
begindocument
begintikzpicture
defxR1.25; %x radius of ellipse
defyR0.5; %y radius of ellipse
draw [dashed,domain=0:180] plot (xR*cos(x), yR*sin(x)); %top half
draw [domain=-180:0] plot (xR*cos(x), yR*sin(x)); %bottom half
fill[gray!20] (0,0) ellipse (xR and yR); %overlay with ellipse
endtikzpicture
enddocument
Is there a better way do this?
tikz-pgf
add a comment |
I wanted to draw an ellipse with top half dashed and bottom half solid but also filled. Is there a direct way to do this using the ellipse
command from usetikzlibraryshapes
?
What I do now, which feels like a trick, is to draw 2 arcs for the top and bottom half this way I can set one arc dashed and the other not. Then next draw an ellipse on top of them but without an edge, just filled. Like this
documentclass[tikz]standalone
usetikzlibraryshapes
begindocument
begintikzpicture
defxR1.25; %x radius of ellipse
defyR0.5; %y radius of ellipse
draw [dashed,domain=0:180] plot (xR*cos(x), yR*sin(x)); %top half
draw [domain=-180:0] plot (xR*cos(x), yR*sin(x)); %bottom half
fill[gray!20] (0,0) ellipse (xR and yR); %overlay with ellipse
endtikzpicture
enddocument
Is there a better way do this?
tikz-pgf
I wanted to draw an ellipse with top half dashed and bottom half solid but also filled. Is there a direct way to do this using the ellipse
command from usetikzlibraryshapes
?
What I do now, which feels like a trick, is to draw 2 arcs for the top and bottom half this way I can set one arc dashed and the other not. Then next draw an ellipse on top of them but without an edge, just filled. Like this
documentclass[tikz]standalone
usetikzlibraryshapes
begindocument
begintikzpicture
defxR1.25; %x radius of ellipse
defyR0.5; %y radius of ellipse
draw [dashed,domain=0:180] plot (xR*cos(x), yR*sin(x)); %top half
draw [domain=-180:0] plot (xR*cos(x), yR*sin(x)); %bottom half
fill[gray!20] (0,0) ellipse (xR and yR); %overlay with ellipse
endtikzpicture
enddocument
Is there a better way do this?
tikz-pgf
tikz-pgf
asked 3 hours ago
NasserNasser
8,48083490
8,48083490
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
With arcs. I'd also fill the area first, this looks arguably better.
documentclass[tikz]standalone
begindocument
begintikzpicture
defxR1.25; %x radius of ellipse
defyR0.5; %y radius of ellipse
fill[gray!20] (0,0) ellipse (xR and yR); %overlay with ellipse
draw [dashed] (-xR,0) arc[start angle=180,end angle=0,x radius=1.25,y radius=0.5]; %top half
draw (-xR,0) arc[start angle=180,end angle=360,x radius=1.25,y radius=0.5]; %bottom half
endtikzpicture
enddocument
Or using two commands "only".
documentclass[tikz]standalone
begindocument
begintikzpicture
defxR1.25; %x radius of ellipse
defyR0.5; %y radius of ellipse
draw [dashed,fill=gray!20] (0,0) ellipse (xR and yR);
draw (-xR,0) arc[start angle=180,end angle=360,x radius=1.25,y radius=0.5]; %bottom half
endtikzpicture
enddocument
You could write styles that dash the first 50% (or whatever %) of the path:
documentclass[tikz]standalone
usetikzlibrarydecorations.markings
begindocument
begintikzpicture[draw only after/.style=preaction=decorate,decoration=markings,mark=at
position 0 with pgfmathsetmacromypoffpgfdecoratedpathlength*#1xdefmypoffmypoff
pgfmathsetmacromyplpgfdecoratedpathlengthxdefmyplmypl,
postaction=draw,dash pattern=on 0pt off mypoff on mypl]
draw [dashed,fill=gray!20,draw only after=1/2] (1.25,0)
arc[start angle=00,end angle=360,x radius=1.25,y radius=0.5];
endtikzpicture
enddocument
dash the first 50% (or whatever %) of the path
Yes, that will be good. How would one do this? Thanks.
– Nasser
2 hours ago
@Nasser I added this to the answer.
– marmot
2 hours ago
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%2f491401%2feasier-way-to-draw-a-filled-ellipse-with-top-edge-dashed-and-bottom-edge-solid%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
With arcs. I'd also fill the area first, this looks arguably better.
documentclass[tikz]standalone
begindocument
begintikzpicture
defxR1.25; %x radius of ellipse
defyR0.5; %y radius of ellipse
fill[gray!20] (0,0) ellipse (xR and yR); %overlay with ellipse
draw [dashed] (-xR,0) arc[start angle=180,end angle=0,x radius=1.25,y radius=0.5]; %top half
draw (-xR,0) arc[start angle=180,end angle=360,x radius=1.25,y radius=0.5]; %bottom half
endtikzpicture
enddocument
Or using two commands "only".
documentclass[tikz]standalone
begindocument
begintikzpicture
defxR1.25; %x radius of ellipse
defyR0.5; %y radius of ellipse
draw [dashed,fill=gray!20] (0,0) ellipse (xR and yR);
draw (-xR,0) arc[start angle=180,end angle=360,x radius=1.25,y radius=0.5]; %bottom half
endtikzpicture
enddocument
You could write styles that dash the first 50% (or whatever %) of the path:
documentclass[tikz]standalone
usetikzlibrarydecorations.markings
begindocument
begintikzpicture[draw only after/.style=preaction=decorate,decoration=markings,mark=at
position 0 with pgfmathsetmacromypoffpgfdecoratedpathlength*#1xdefmypoffmypoff
pgfmathsetmacromyplpgfdecoratedpathlengthxdefmyplmypl,
postaction=draw,dash pattern=on 0pt off mypoff on mypl]
draw [dashed,fill=gray!20,draw only after=1/2] (1.25,0)
arc[start angle=00,end angle=360,x radius=1.25,y radius=0.5];
endtikzpicture
enddocument
dash the first 50% (or whatever %) of the path
Yes, that will be good. How would one do this? Thanks.
– Nasser
2 hours ago
@Nasser I added this to the answer.
– marmot
2 hours ago
add a comment |
With arcs. I'd also fill the area first, this looks arguably better.
documentclass[tikz]standalone
begindocument
begintikzpicture
defxR1.25; %x radius of ellipse
defyR0.5; %y radius of ellipse
fill[gray!20] (0,0) ellipse (xR and yR); %overlay with ellipse
draw [dashed] (-xR,0) arc[start angle=180,end angle=0,x radius=1.25,y radius=0.5]; %top half
draw (-xR,0) arc[start angle=180,end angle=360,x radius=1.25,y radius=0.5]; %bottom half
endtikzpicture
enddocument
Or using two commands "only".
documentclass[tikz]standalone
begindocument
begintikzpicture
defxR1.25; %x radius of ellipse
defyR0.5; %y radius of ellipse
draw [dashed,fill=gray!20] (0,0) ellipse (xR and yR);
draw (-xR,0) arc[start angle=180,end angle=360,x radius=1.25,y radius=0.5]; %bottom half
endtikzpicture
enddocument
You could write styles that dash the first 50% (or whatever %) of the path:
documentclass[tikz]standalone
usetikzlibrarydecorations.markings
begindocument
begintikzpicture[draw only after/.style=preaction=decorate,decoration=markings,mark=at
position 0 with pgfmathsetmacromypoffpgfdecoratedpathlength*#1xdefmypoffmypoff
pgfmathsetmacromyplpgfdecoratedpathlengthxdefmyplmypl,
postaction=draw,dash pattern=on 0pt off mypoff on mypl]
draw [dashed,fill=gray!20,draw only after=1/2] (1.25,0)
arc[start angle=00,end angle=360,x radius=1.25,y radius=0.5];
endtikzpicture
enddocument
dash the first 50% (or whatever %) of the path
Yes, that will be good. How would one do this? Thanks.
– Nasser
2 hours ago
@Nasser I added this to the answer.
– marmot
2 hours ago
add a comment |
With arcs. I'd also fill the area first, this looks arguably better.
documentclass[tikz]standalone
begindocument
begintikzpicture
defxR1.25; %x radius of ellipse
defyR0.5; %y radius of ellipse
fill[gray!20] (0,0) ellipse (xR and yR); %overlay with ellipse
draw [dashed] (-xR,0) arc[start angle=180,end angle=0,x radius=1.25,y radius=0.5]; %top half
draw (-xR,0) arc[start angle=180,end angle=360,x radius=1.25,y radius=0.5]; %bottom half
endtikzpicture
enddocument
Or using two commands "only".
documentclass[tikz]standalone
begindocument
begintikzpicture
defxR1.25; %x radius of ellipse
defyR0.5; %y radius of ellipse
draw [dashed,fill=gray!20] (0,0) ellipse (xR and yR);
draw (-xR,0) arc[start angle=180,end angle=360,x radius=1.25,y radius=0.5]; %bottom half
endtikzpicture
enddocument
You could write styles that dash the first 50% (or whatever %) of the path:
documentclass[tikz]standalone
usetikzlibrarydecorations.markings
begindocument
begintikzpicture[draw only after/.style=preaction=decorate,decoration=markings,mark=at
position 0 with pgfmathsetmacromypoffpgfdecoratedpathlength*#1xdefmypoffmypoff
pgfmathsetmacromyplpgfdecoratedpathlengthxdefmyplmypl,
postaction=draw,dash pattern=on 0pt off mypoff on mypl]
draw [dashed,fill=gray!20,draw only after=1/2] (1.25,0)
arc[start angle=00,end angle=360,x radius=1.25,y radius=0.5];
endtikzpicture
enddocument
With arcs. I'd also fill the area first, this looks arguably better.
documentclass[tikz]standalone
begindocument
begintikzpicture
defxR1.25; %x radius of ellipse
defyR0.5; %y radius of ellipse
fill[gray!20] (0,0) ellipse (xR and yR); %overlay with ellipse
draw [dashed] (-xR,0) arc[start angle=180,end angle=0,x radius=1.25,y radius=0.5]; %top half
draw (-xR,0) arc[start angle=180,end angle=360,x radius=1.25,y radius=0.5]; %bottom half
endtikzpicture
enddocument
Or using two commands "only".
documentclass[tikz]standalone
begindocument
begintikzpicture
defxR1.25; %x radius of ellipse
defyR0.5; %y radius of ellipse
draw [dashed,fill=gray!20] (0,0) ellipse (xR and yR);
draw (-xR,0) arc[start angle=180,end angle=360,x radius=1.25,y radius=0.5]; %bottom half
endtikzpicture
enddocument
You could write styles that dash the first 50% (or whatever %) of the path:
documentclass[tikz]standalone
usetikzlibrarydecorations.markings
begindocument
begintikzpicture[draw only after/.style=preaction=decorate,decoration=markings,mark=at
position 0 with pgfmathsetmacromypoffpgfdecoratedpathlength*#1xdefmypoffmypoff
pgfmathsetmacromyplpgfdecoratedpathlengthxdefmyplmypl,
postaction=draw,dash pattern=on 0pt off mypoff on mypl]
draw [dashed,fill=gray!20,draw only after=1/2] (1.25,0)
arc[start angle=00,end angle=360,x radius=1.25,y radius=0.5];
endtikzpicture
enddocument
edited 2 hours ago
answered 3 hours ago
marmotmarmot
128k6162308
128k6162308
dash the first 50% (or whatever %) of the path
Yes, that will be good. How would one do this? Thanks.
– Nasser
2 hours ago
@Nasser I added this to the answer.
– marmot
2 hours ago
add a comment |
dash the first 50% (or whatever %) of the path
Yes, that will be good. How would one do this? Thanks.
– Nasser
2 hours ago
@Nasser I added this to the answer.
– marmot
2 hours ago
dash the first 50% (or whatever %) of the path
Yes, that will be good. How would one do this? Thanks.– Nasser
2 hours ago
dash the first 50% (or whatever %) of the path
Yes, that will be good. How would one do this? Thanks.– Nasser
2 hours ago
@Nasser I added this to the answer.
– marmot
2 hours ago
@Nasser I added this to the answer.
– marmot
2 hours ago
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%2f491401%2feasier-way-to-draw-a-filled-ellipse-with-top-edge-dashed-and-bottom-edge-solid%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