Filling between to draw

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I'm trying to fill an area between to draw lines. I tried a lot of options, but none of them seem to work.



Plot of my current Code



I labeled the areas I need, with the specific colors, to fill. My current Code is:



 documentclass[10pt,a4paper,twoside]article
usepackage[utf8]inputenc
usepackage[ngerman]babel
usepackageamsmath
usepackageamsfonts
usepackageamssymb
usepackage[centering,includeheadfoot,top=25mm, left=40mm, right=25mm, bottom=30mm]geometry
usepackagefancyhdr
usepackagecolor
usepackagethmbox
usepackagetikz
usepackagepgfplots
pgfplotssetcompat=1.11
usepgfplotslibraryfillbetween
usetikzlibraryintersections

begindocument

begintikzpicture

fill[color=yellow] (0, 0) circle (2); % Sonne im Ursprung (0, 0)
shade[right color=lightgray] (7.5, 0) circle (0.5); % Sonne im Ursprung (5, 0)
shade[shading=ball, ball color=blue] (10, 0) circle (1); % Erde im Ursprung (10, 0)

draw[dashed, color=red ,shorten >=-1.6cm,shorten <=-0cm,name path = A] (0, 2) --node[near start,sloped,above]textcolorredRandstrahl (7.5, 0.5);
draw[dashed, color=red ,shorten >=-3cm,shorten <=-0cm] (0, 2) -- (7.5, -0.5);

draw[dashed, color=red ,shorten >=-1.6cm,shorten <=-0cm,name path = B] (0, -2) -- (7.5, -0.5);
draw[dashed, color=red ,shorten >=-3cm,shorten <=-0cm] (0, -2) -- (7.5, 0.5);

endtikzpicture
enddocument


As mentioned, I tried a lot of options. So this is, more or less, a desperate attempt for solving my problem.



Thanks for helping me.










share|improve this question









New contributor




DonFangzahn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    2
    down vote

    favorite












    I'm trying to fill an area between to draw lines. I tried a lot of options, but none of them seem to work.



    Plot of my current Code



    I labeled the areas I need, with the specific colors, to fill. My current Code is:



     documentclass[10pt,a4paper,twoside]article
    usepackage[utf8]inputenc
    usepackage[ngerman]babel
    usepackageamsmath
    usepackageamsfonts
    usepackageamssymb
    usepackage[centering,includeheadfoot,top=25mm, left=40mm, right=25mm, bottom=30mm]geometry
    usepackagefancyhdr
    usepackagecolor
    usepackagethmbox
    usepackagetikz
    usepackagepgfplots
    pgfplotssetcompat=1.11
    usepgfplotslibraryfillbetween
    usetikzlibraryintersections

    begindocument

    begintikzpicture

    fill[color=yellow] (0, 0) circle (2); % Sonne im Ursprung (0, 0)
    shade[right color=lightgray] (7.5, 0) circle (0.5); % Sonne im Ursprung (5, 0)
    shade[shading=ball, ball color=blue] (10, 0) circle (1); % Erde im Ursprung (10, 0)

    draw[dashed, color=red ,shorten >=-1.6cm,shorten <=-0cm,name path = A] (0, 2) --node[near start,sloped,above]textcolorredRandstrahl (7.5, 0.5);
    draw[dashed, color=red ,shorten >=-3cm,shorten <=-0cm] (0, 2) -- (7.5, -0.5);

    draw[dashed, color=red ,shorten >=-1.6cm,shorten <=-0cm,name path = B] (0, -2) -- (7.5, -0.5);
    draw[dashed, color=red ,shorten >=-3cm,shorten <=-0cm] (0, -2) -- (7.5, 0.5);

    endtikzpicture
    enddocument


    As mentioned, I tried a lot of options. So this is, more or less, a desperate attempt for solving my problem.



    Thanks for helping me.










    share|improve this question









    New contributor




    DonFangzahn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I'm trying to fill an area between to draw lines. I tried a lot of options, but none of them seem to work.



      Plot of my current Code



      I labeled the areas I need, with the specific colors, to fill. My current Code is:



       documentclass[10pt,a4paper,twoside]article
      usepackage[utf8]inputenc
      usepackage[ngerman]babel
      usepackageamsmath
      usepackageamsfonts
      usepackageamssymb
      usepackage[centering,includeheadfoot,top=25mm, left=40mm, right=25mm, bottom=30mm]geometry
      usepackagefancyhdr
      usepackagecolor
      usepackagethmbox
      usepackagetikz
      usepackagepgfplots
      pgfplotssetcompat=1.11
      usepgfplotslibraryfillbetween
      usetikzlibraryintersections

      begindocument

      begintikzpicture

      fill[color=yellow] (0, 0) circle (2); % Sonne im Ursprung (0, 0)
      shade[right color=lightgray] (7.5, 0) circle (0.5); % Sonne im Ursprung (5, 0)
      shade[shading=ball, ball color=blue] (10, 0) circle (1); % Erde im Ursprung (10, 0)

      draw[dashed, color=red ,shorten >=-1.6cm,shorten <=-0cm,name path = A] (0, 2) --node[near start,sloped,above]textcolorredRandstrahl (7.5, 0.5);
      draw[dashed, color=red ,shorten >=-3cm,shorten <=-0cm] (0, 2) -- (7.5, -0.5);

      draw[dashed, color=red ,shorten >=-1.6cm,shorten <=-0cm,name path = B] (0, -2) -- (7.5, -0.5);
      draw[dashed, color=red ,shorten >=-3cm,shorten <=-0cm] (0, -2) -- (7.5, 0.5);

      endtikzpicture
      enddocument


      As mentioned, I tried a lot of options. So this is, more or less, a desperate attempt for solving my problem.



      Thanks for helping me.










      share|improve this question









      New contributor




      DonFangzahn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I'm trying to fill an area between to draw lines. I tried a lot of options, but none of them seem to work.



      Plot of my current Code



      I labeled the areas I need, with the specific colors, to fill. My current Code is:



       documentclass[10pt,a4paper,twoside]article
      usepackage[utf8]inputenc
      usepackage[ngerman]babel
      usepackageamsmath
      usepackageamsfonts
      usepackageamssymb
      usepackage[centering,includeheadfoot,top=25mm, left=40mm, right=25mm, bottom=30mm]geometry
      usepackagefancyhdr
      usepackagecolor
      usepackagethmbox
      usepackagetikz
      usepackagepgfplots
      pgfplotssetcompat=1.11
      usepgfplotslibraryfillbetween
      usetikzlibraryintersections

      begindocument

      begintikzpicture

      fill[color=yellow] (0, 0) circle (2); % Sonne im Ursprung (0, 0)
      shade[right color=lightgray] (7.5, 0) circle (0.5); % Sonne im Ursprung (5, 0)
      shade[shading=ball, ball color=blue] (10, 0) circle (1); % Erde im Ursprung (10, 0)

      draw[dashed, color=red ,shorten >=-1.6cm,shorten <=-0cm,name path = A] (0, 2) --node[near start,sloped,above]textcolorredRandstrahl (7.5, 0.5);
      draw[dashed, color=red ,shorten >=-3cm,shorten <=-0cm] (0, 2) -- (7.5, -0.5);

      draw[dashed, color=red ,shorten >=-1.6cm,shorten <=-0cm,name path = B] (0, -2) -- (7.5, -0.5);
      draw[dashed, color=red ,shorten >=-3cm,shorten <=-0cm] (0, -2) -- (7.5, 0.5);

      endtikzpicture
      enddocument


      As mentioned, I tried a lot of options. So this is, more or less, a desperate attempt for solving my problem.



      Thanks for helping me.







      tikz-pgf intersections fillbetween fill






      share|improve this question









      New contributor




      DonFangzahn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      DonFangzahn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 46 mins ago









      ferahfeza

      5,11411830




      5,11411830






      New contributor




      DonFangzahn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 53 mins ago









      DonFangzahn

      111




      111




      New contributor




      DonFangzahn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      DonFangzahn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      DonFangzahn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote













          Welcome to TeX.SE! The reason why you really fill the regions between the paths in your picture is that you used shorten >=... with some negative dimensions. Hence the paths are shorter than the dashed lines. I fixed that to make it work. And even though you could do that with the pgfplots library fillbetween, this is not necessary here since you only have straight lines. And I used backgrounds and slightly changed the order in which things get drawn in order not to overwrite your planets.



          documentclass[10pt,a4paper,twoside]article
          usepackage[utf8]inputenc
          usepackagetikz
          usetikzlibraryintersections,backgrounds

          begindocument

          begintikzpicture
          fill[color=yellow] (0, 0) circle (2); % Sonne im Ursprung (0, 0)
          shade[right color=lightgray] (7.5, 0) circle (0.5); % Sonne im Ursprung (5, 0)

          draw[dashed, color=red,name path = A] (0, 2) --
          node[near start,sloped,above]textcolorredRandstrahl (10, 0)
          coordinate (X1);
          draw[dashed, color=red ,name path = C] (0, 2) --
          (10, -1.33)
          coordinate (X2);

          draw[dashed, color=red ,name path = B] (0, -2) -- (10, 0)
          coordinate (X3);
          draw[dashed, color=red ,name path = D] (0, -2) -- (10, 1.33)
          coordinate (X4);
          beginscope[on background layer]
          fill[gray,
          name intersections=of=A and D,by=X5] (X3) -- (X5) -- (X4);
          fill[gray,
          name intersections=of=C and B,by=X6] (X1) -- (X6) -- (X2);
          fill[black] (X6) -- (X3) -- (X5);
          endscope
          shade[shading=ball, ball color=blue] (10, 0) circle (1); % Erde im Ursprung (10, 0)
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer




















          • From the bottom of my heart, thank you, a lot. This solved my problem.
            – DonFangzahn
            7 mins ago










          • @DonFangzahn Glad to hear! BTW, if you are satisfied with a given answer, you may consider accepting it by clicking on the check mark left of it.
            – marmot
            4 mins 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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          DonFangzahn is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f453191%2ffilling-between-to-draw%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote













          Welcome to TeX.SE! The reason why you really fill the regions between the paths in your picture is that you used shorten >=... with some negative dimensions. Hence the paths are shorter than the dashed lines. I fixed that to make it work. And even though you could do that with the pgfplots library fillbetween, this is not necessary here since you only have straight lines. And I used backgrounds and slightly changed the order in which things get drawn in order not to overwrite your planets.



          documentclass[10pt,a4paper,twoside]article
          usepackage[utf8]inputenc
          usepackagetikz
          usetikzlibraryintersections,backgrounds

          begindocument

          begintikzpicture
          fill[color=yellow] (0, 0) circle (2); % Sonne im Ursprung (0, 0)
          shade[right color=lightgray] (7.5, 0) circle (0.5); % Sonne im Ursprung (5, 0)

          draw[dashed, color=red,name path = A] (0, 2) --
          node[near start,sloped,above]textcolorredRandstrahl (10, 0)
          coordinate (X1);
          draw[dashed, color=red ,name path = C] (0, 2) --
          (10, -1.33)
          coordinate (X2);

          draw[dashed, color=red ,name path = B] (0, -2) -- (10, 0)
          coordinate (X3);
          draw[dashed, color=red ,name path = D] (0, -2) -- (10, 1.33)
          coordinate (X4);
          beginscope[on background layer]
          fill[gray,
          name intersections=of=A and D,by=X5] (X3) -- (X5) -- (X4);
          fill[gray,
          name intersections=of=C and B,by=X6] (X1) -- (X6) -- (X2);
          fill[black] (X6) -- (X3) -- (X5);
          endscope
          shade[shading=ball, ball color=blue] (10, 0) circle (1); % Erde im Ursprung (10, 0)
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer




















          • From the bottom of my heart, thank you, a lot. This solved my problem.
            – DonFangzahn
            7 mins ago










          • @DonFangzahn Glad to hear! BTW, if you are satisfied with a given answer, you may consider accepting it by clicking on the check mark left of it.
            – marmot
            4 mins ago














          up vote
          3
          down vote













          Welcome to TeX.SE! The reason why you really fill the regions between the paths in your picture is that you used shorten >=... with some negative dimensions. Hence the paths are shorter than the dashed lines. I fixed that to make it work. And even though you could do that with the pgfplots library fillbetween, this is not necessary here since you only have straight lines. And I used backgrounds and slightly changed the order in which things get drawn in order not to overwrite your planets.



          documentclass[10pt,a4paper,twoside]article
          usepackage[utf8]inputenc
          usepackagetikz
          usetikzlibraryintersections,backgrounds

          begindocument

          begintikzpicture
          fill[color=yellow] (0, 0) circle (2); % Sonne im Ursprung (0, 0)
          shade[right color=lightgray] (7.5, 0) circle (0.5); % Sonne im Ursprung (5, 0)

          draw[dashed, color=red,name path = A] (0, 2) --
          node[near start,sloped,above]textcolorredRandstrahl (10, 0)
          coordinate (X1);
          draw[dashed, color=red ,name path = C] (0, 2) --
          (10, -1.33)
          coordinate (X2);

          draw[dashed, color=red ,name path = B] (0, -2) -- (10, 0)
          coordinate (X3);
          draw[dashed, color=red ,name path = D] (0, -2) -- (10, 1.33)
          coordinate (X4);
          beginscope[on background layer]
          fill[gray,
          name intersections=of=A and D,by=X5] (X3) -- (X5) -- (X4);
          fill[gray,
          name intersections=of=C and B,by=X6] (X1) -- (X6) -- (X2);
          fill[black] (X6) -- (X3) -- (X5);
          endscope
          shade[shading=ball, ball color=blue] (10, 0) circle (1); % Erde im Ursprung (10, 0)
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer




















          • From the bottom of my heart, thank you, a lot. This solved my problem.
            – DonFangzahn
            7 mins ago










          • @DonFangzahn Glad to hear! BTW, if you are satisfied with a given answer, you may consider accepting it by clicking on the check mark left of it.
            – marmot
            4 mins ago












          up vote
          3
          down vote










          up vote
          3
          down vote









          Welcome to TeX.SE! The reason why you really fill the regions between the paths in your picture is that you used shorten >=... with some negative dimensions. Hence the paths are shorter than the dashed lines. I fixed that to make it work. And even though you could do that with the pgfplots library fillbetween, this is not necessary here since you only have straight lines. And I used backgrounds and slightly changed the order in which things get drawn in order not to overwrite your planets.



          documentclass[10pt,a4paper,twoside]article
          usepackage[utf8]inputenc
          usepackagetikz
          usetikzlibraryintersections,backgrounds

          begindocument

          begintikzpicture
          fill[color=yellow] (0, 0) circle (2); % Sonne im Ursprung (0, 0)
          shade[right color=lightgray] (7.5, 0) circle (0.5); % Sonne im Ursprung (5, 0)

          draw[dashed, color=red,name path = A] (0, 2) --
          node[near start,sloped,above]textcolorredRandstrahl (10, 0)
          coordinate (X1);
          draw[dashed, color=red ,name path = C] (0, 2) --
          (10, -1.33)
          coordinate (X2);

          draw[dashed, color=red ,name path = B] (0, -2) -- (10, 0)
          coordinate (X3);
          draw[dashed, color=red ,name path = D] (0, -2) -- (10, 1.33)
          coordinate (X4);
          beginscope[on background layer]
          fill[gray,
          name intersections=of=A and D,by=X5] (X3) -- (X5) -- (X4);
          fill[gray,
          name intersections=of=C and B,by=X6] (X1) -- (X6) -- (X2);
          fill[black] (X6) -- (X3) -- (X5);
          endscope
          shade[shading=ball, ball color=blue] (10, 0) circle (1); % Erde im Ursprung (10, 0)
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer












          Welcome to TeX.SE! The reason why you really fill the regions between the paths in your picture is that you used shorten >=... with some negative dimensions. Hence the paths are shorter than the dashed lines. I fixed that to make it work. And even though you could do that with the pgfplots library fillbetween, this is not necessary here since you only have straight lines. And I used backgrounds and slightly changed the order in which things get drawn in order not to overwrite your planets.



          documentclass[10pt,a4paper,twoside]article
          usepackage[utf8]inputenc
          usepackagetikz
          usetikzlibraryintersections,backgrounds

          begindocument

          begintikzpicture
          fill[color=yellow] (0, 0) circle (2); % Sonne im Ursprung (0, 0)
          shade[right color=lightgray] (7.5, 0) circle (0.5); % Sonne im Ursprung (5, 0)

          draw[dashed, color=red,name path = A] (0, 2) --
          node[near start,sloped,above]textcolorredRandstrahl (10, 0)
          coordinate (X1);
          draw[dashed, color=red ,name path = C] (0, 2) --
          (10, -1.33)
          coordinate (X2);

          draw[dashed, color=red ,name path = B] (0, -2) -- (10, 0)
          coordinate (X3);
          draw[dashed, color=red ,name path = D] (0, -2) -- (10, 1.33)
          coordinate (X4);
          beginscope[on background layer]
          fill[gray,
          name intersections=of=A and D,by=X5] (X3) -- (X5) -- (X4);
          fill[gray,
          name intersections=of=C and B,by=X6] (X1) -- (X6) -- (X2);
          fill[black] (X6) -- (X3) -- (X5);
          endscope
          shade[shading=ball, ball color=blue] (10, 0) circle (1); % Erde im Ursprung (10, 0)
          endtikzpicture
          enddocument


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 15 mins ago









          marmot

          61.4k465133




          61.4k465133











          • From the bottom of my heart, thank you, a lot. This solved my problem.
            – DonFangzahn
            7 mins ago










          • @DonFangzahn Glad to hear! BTW, if you are satisfied with a given answer, you may consider accepting it by clicking on the check mark left of it.
            – marmot
            4 mins ago
















          • From the bottom of my heart, thank you, a lot. This solved my problem.
            – DonFangzahn
            7 mins ago










          • @DonFangzahn Glad to hear! BTW, if you are satisfied with a given answer, you may consider accepting it by clicking on the check mark left of it.
            – marmot
            4 mins ago















          From the bottom of my heart, thank you, a lot. This solved my problem.
          – DonFangzahn
          7 mins ago




          From the bottom of my heart, thank you, a lot. This solved my problem.
          – DonFangzahn
          7 mins ago












          @DonFangzahn Glad to hear! BTW, if you are satisfied with a given answer, you may consider accepting it by clicking on the check mark left of it.
          – marmot
          4 mins ago




          @DonFangzahn Glad to hear! BTW, if you are satisfied with a given answer, you may consider accepting it by clicking on the check mark left of it.
          – marmot
          4 mins ago










          DonFangzahn is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          DonFangzahn is a new contributor. Be nice, and check out our Code of Conduct.












          DonFangzahn is a new contributor. Be nice, and check out our Code of Conduct.











          DonFangzahn is a new contributor. Be nice, and check out our Code of Conduct.













           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f453191%2ffilling-between-to-draw%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          Long meetings (6-7 hours a day): Being “babysat” by supervisor

          Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

          Confectionery