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?













1















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


Mathematica graphics



Is there a better way do this?










share|improve this question


























    1















    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


    Mathematica graphics



    Is there a better way do this?










    share|improve this question
























      1












      1








      1








      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


      Mathematica graphics



      Is there a better way do this?










      share|improve this question














      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


      Mathematica graphics



      Is there a better way do this?







      tikz-pgf






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 3 hours ago









      NasserNasser

      8,48083490




      8,48083490




















          1 Answer
          1






          active

          oldest

          votes


















          3














          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


          enter image description here



          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





          share|improve this answer

























          • 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











          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
          );



          );













          draft saved

          draft discarded


















          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









          3














          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


          enter image description here



          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





          share|improve this answer

























          • 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















          3














          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


          enter image description here



          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





          share|improve this answer

























          • 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













          3












          3








          3







          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


          enter image description here



          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





          share|improve this answer















          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


          enter image description here



          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






          share|improve this answer














          share|improve this answer



          share|improve this answer








          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

















          • 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

















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

          Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

          199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單