Pgfplots fillbetween and Tikz shadeMake a rainbow linePlanck's blackbody curve with “rainbow” in...

Can someone explain the English 'W' sound?

Why are Oscar, India, and X-Ray (O, I, and X) not used as taxiway identifiers?

On the history of Haar measure

How can I indicate that what I'm saying is not sarcastic online?

Is it possible to access the complete command line including pipes in a bash script?

How can I deal with someone that wants to kill something that isn't supposed to be killed?

What is a "staved" town, like in "Staverton"?

What is "ass door"?

How can I show that the speed of light in vacuum is the same in all reference frames?

How can Kazakhstan perform MITM attacks on all HTTPS traffic?

Does Impedance Matching Imply any Practical RF Transmitter Must Waste >=50% of Energy?

how to add 1 milliseconds on a datetime string?

Does downing a character at the start of its turn require an immediate Death Saving Throw?

How does mathematics work?

How could Barty Crouch Jr. have run out of Polyjuice Potion at the end of the Goblet of Fire movie?

Are there any English words pronounced with sounds/syllables that aren't part of the spelling?

Why did computer video outputs go from digital to analog, then back to digital?

Does quantity of data extensions impact performance?

Do I care if the housing market has gone up or down, if I'm moving from one house to another?

How to work a regular job as a former celebrity

High income and difficulty during interviews

Can I pay with HKD in Macau or Shenzhen?

How to apply dcolumn in my longtable case? Need help

5V/12V load balance of 3.5'' HDD?



Pgfplots fillbetween and Tikz shade


Make a rainbow linePlanck's blackbody curve with “rainbow” in Tikzfilling area between 2 functions, with shadingplotting two time series with boundsGrouped bar chartHow do i get the x axis on top but keep a line on the bottomHow can I represent the curved shape of a surface?Creating a rainbow color macroHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?How to hide empty (value 0) ybars with pgfplots?Show mark labels near marks and not centered in ybar interaval graphHow to shade (not fill) region bounded by parabola?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I am trying to replace the rainbow in this MWE



documentclass{standalone}
usepackage{pgfplots}
usepackage{pgfmath}
usepackage{amsmath}
usepackage[ngerman]{babel}
usepackage[utf8]{inputenc}


usepackage[%
%decimalsymbol=comma,
locale=DE,
]{siunitx}

usepgfplotslibrary{fillbetween}

pgfplotsset{compat=1.16}

begin{document}
begin{tikzpicture}[samples=200, scale=1.15,declare function={
planck(x,T)=(374177152466412/x^5)/(exp(14387.77/(x*T))-1);
}]
begin{axis}[
xmin=0,
xmax=3,
xlabel={$omega$ [si{hertz}]},
ymin=0,
ylabel={$rho (omega; T)$ [si{joulepercubicmeter}]},
ytick=empty,
no markers,
grid=both,
domain=0.1:3,
]
addplot+ [forget plot,name path=A] {planck(x,6000)};
addplot [forget plot,name path=B,samples=2] {0};
%-------------------------------
% add shading code here...
%-------------------------------
addplot [forget plot,blue] fill between [of=A and B,soft clip={domain=.4:.47}];
addplot [forget plot,green] fill between [of=A and B,soft clip={domain=.47:.535}];
addplot [forget plot,yellow] fill between [of=A and B,soft clip={domain=.535:.6}];
addplot [forget plot,orange] fill between [of=A and B,soft clip={domain=.6:.66}];
addplot [forget plot,red] fill between [of=A and B,soft clip={domain=.66:.72}];

pgfplotsinvokeforeach{3000, 4000, 5000, 6000}
{
addplot {planck(x,#1)};
addlegendentryexpanded{$T = #1,si{kelvin}$}
}
end{axis}
end{tikzpicture}
end{document}


Planck with rainbow



with the shaded rainbow from this answer



documentclass{article}
usepackage[named]{xcolor}
usepackage{pgffor}
usepackage{tikz}
usetikzlibrary{shadings}

pgfdeclareverticalshading{rainbow}{100bp}
{color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow);
color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue);
color(75bp)=(violet); color(100bp)=(violet)}
begin{document}
begin{tikzpicture}
shade[shading=rainbow,shading angle=270] (0,0) rectangle (5cm,textheight);
end{tikzpicture}
end{document}


enter image description here



How is it possible to "mix" the tikz and pgfplots code?



Thank you very much!










share|improve this question









New contributor



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


























    1















    I am trying to replace the rainbow in this MWE



    documentclass{standalone}
    usepackage{pgfplots}
    usepackage{pgfmath}
    usepackage{amsmath}
    usepackage[ngerman]{babel}
    usepackage[utf8]{inputenc}


    usepackage[%
    %decimalsymbol=comma,
    locale=DE,
    ]{siunitx}

    usepgfplotslibrary{fillbetween}

    pgfplotsset{compat=1.16}

    begin{document}
    begin{tikzpicture}[samples=200, scale=1.15,declare function={
    planck(x,T)=(374177152466412/x^5)/(exp(14387.77/(x*T))-1);
    }]
    begin{axis}[
    xmin=0,
    xmax=3,
    xlabel={$omega$ [si{hertz}]},
    ymin=0,
    ylabel={$rho (omega; T)$ [si{joulepercubicmeter}]},
    ytick=empty,
    no markers,
    grid=both,
    domain=0.1:3,
    ]
    addplot+ [forget plot,name path=A] {planck(x,6000)};
    addplot [forget plot,name path=B,samples=2] {0};
    %-------------------------------
    % add shading code here...
    %-------------------------------
    addplot [forget plot,blue] fill between [of=A and B,soft clip={domain=.4:.47}];
    addplot [forget plot,green] fill between [of=A and B,soft clip={domain=.47:.535}];
    addplot [forget plot,yellow] fill between [of=A and B,soft clip={domain=.535:.6}];
    addplot [forget plot,orange] fill between [of=A and B,soft clip={domain=.6:.66}];
    addplot [forget plot,red] fill between [of=A and B,soft clip={domain=.66:.72}];

    pgfplotsinvokeforeach{3000, 4000, 5000, 6000}
    {
    addplot {planck(x,#1)};
    addlegendentryexpanded{$T = #1,si{kelvin}$}
    }
    end{axis}
    end{tikzpicture}
    end{document}


    Planck with rainbow



    with the shaded rainbow from this answer



    documentclass{article}
    usepackage[named]{xcolor}
    usepackage{pgffor}
    usepackage{tikz}
    usetikzlibrary{shadings}

    pgfdeclareverticalshading{rainbow}{100bp}
    {color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow);
    color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue);
    color(75bp)=(violet); color(100bp)=(violet)}
    begin{document}
    begin{tikzpicture}
    shade[shading=rainbow,shading angle=270] (0,0) rectangle (5cm,textheight);
    end{tikzpicture}
    end{document}


    enter image description here



    How is it possible to "mix" the tikz and pgfplots code?



    Thank you very much!










    share|improve this question









    New contributor



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






















      1












      1








      1


      1






      I am trying to replace the rainbow in this MWE



      documentclass{standalone}
      usepackage{pgfplots}
      usepackage{pgfmath}
      usepackage{amsmath}
      usepackage[ngerman]{babel}
      usepackage[utf8]{inputenc}


      usepackage[%
      %decimalsymbol=comma,
      locale=DE,
      ]{siunitx}

      usepgfplotslibrary{fillbetween}

      pgfplotsset{compat=1.16}

      begin{document}
      begin{tikzpicture}[samples=200, scale=1.15,declare function={
      planck(x,T)=(374177152466412/x^5)/(exp(14387.77/(x*T))-1);
      }]
      begin{axis}[
      xmin=0,
      xmax=3,
      xlabel={$omega$ [si{hertz}]},
      ymin=0,
      ylabel={$rho (omega; T)$ [si{joulepercubicmeter}]},
      ytick=empty,
      no markers,
      grid=both,
      domain=0.1:3,
      ]
      addplot+ [forget plot,name path=A] {planck(x,6000)};
      addplot [forget plot,name path=B,samples=2] {0};
      %-------------------------------
      % add shading code here...
      %-------------------------------
      addplot [forget plot,blue] fill between [of=A and B,soft clip={domain=.4:.47}];
      addplot [forget plot,green] fill between [of=A and B,soft clip={domain=.47:.535}];
      addplot [forget plot,yellow] fill between [of=A and B,soft clip={domain=.535:.6}];
      addplot [forget plot,orange] fill between [of=A and B,soft clip={domain=.6:.66}];
      addplot [forget plot,red] fill between [of=A and B,soft clip={domain=.66:.72}];

      pgfplotsinvokeforeach{3000, 4000, 5000, 6000}
      {
      addplot {planck(x,#1)};
      addlegendentryexpanded{$T = #1,si{kelvin}$}
      }
      end{axis}
      end{tikzpicture}
      end{document}


      Planck with rainbow



      with the shaded rainbow from this answer



      documentclass{article}
      usepackage[named]{xcolor}
      usepackage{pgffor}
      usepackage{tikz}
      usetikzlibrary{shadings}

      pgfdeclareverticalshading{rainbow}{100bp}
      {color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow);
      color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue);
      color(75bp)=(violet); color(100bp)=(violet)}
      begin{document}
      begin{tikzpicture}
      shade[shading=rainbow,shading angle=270] (0,0) rectangle (5cm,textheight);
      end{tikzpicture}
      end{document}


      enter image description here



      How is it possible to "mix" the tikz and pgfplots code?



      Thank you very much!










      share|improve this question









      New contributor



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











      I am trying to replace the rainbow in this MWE



      documentclass{standalone}
      usepackage{pgfplots}
      usepackage{pgfmath}
      usepackage{amsmath}
      usepackage[ngerman]{babel}
      usepackage[utf8]{inputenc}


      usepackage[%
      %decimalsymbol=comma,
      locale=DE,
      ]{siunitx}

      usepgfplotslibrary{fillbetween}

      pgfplotsset{compat=1.16}

      begin{document}
      begin{tikzpicture}[samples=200, scale=1.15,declare function={
      planck(x,T)=(374177152466412/x^5)/(exp(14387.77/(x*T))-1);
      }]
      begin{axis}[
      xmin=0,
      xmax=3,
      xlabel={$omega$ [si{hertz}]},
      ymin=0,
      ylabel={$rho (omega; T)$ [si{joulepercubicmeter}]},
      ytick=empty,
      no markers,
      grid=both,
      domain=0.1:3,
      ]
      addplot+ [forget plot,name path=A] {planck(x,6000)};
      addplot [forget plot,name path=B,samples=2] {0};
      %-------------------------------
      % add shading code here...
      %-------------------------------
      addplot [forget plot,blue] fill between [of=A and B,soft clip={domain=.4:.47}];
      addplot [forget plot,green] fill between [of=A and B,soft clip={domain=.47:.535}];
      addplot [forget plot,yellow] fill between [of=A and B,soft clip={domain=.535:.6}];
      addplot [forget plot,orange] fill between [of=A and B,soft clip={domain=.6:.66}];
      addplot [forget plot,red] fill between [of=A and B,soft clip={domain=.66:.72}];

      pgfplotsinvokeforeach{3000, 4000, 5000, 6000}
      {
      addplot {planck(x,#1)};
      addlegendentryexpanded{$T = #1,si{kelvin}$}
      }
      end{axis}
      end{tikzpicture}
      end{document}


      Planck with rainbow



      with the shaded rainbow from this answer



      documentclass{article}
      usepackage[named]{xcolor}
      usepackage{pgffor}
      usepackage{tikz}
      usetikzlibrary{shadings}

      pgfdeclareverticalshading{rainbow}{100bp}
      {color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow);
      color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue);
      color(75bp)=(violet); color(100bp)=(violet)}
      begin{document}
      begin{tikzpicture}
      shade[shading=rainbow,shading angle=270] (0,0) rectangle (5cm,textheight);
      end{tikzpicture}
      end{document}


      enter image description here



      How is it possible to "mix" the tikz and pgfplots code?



      Thank you very much!







      tikz-pgf pgfplots shading fillbetween






      share|improve this question









      New contributor



      vulcano9 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



      vulcano9 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 8 hours ago









      Stefan Pinnow

      21k9 gold badges36 silver badges80 bronze badges




      21k9 gold badges36 silver badges80 bronze badges






      New contributor



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








      asked 9 hours ago









      vulcano9vulcano9

      82 bronze badges




      82 bronze badges




      New contributor



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




      New contributor




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
























          2 Answers
          2






          active

          oldest

          votes


















          4














          shading can be used more or less instead of fill, so my answer to your previous question Planck's blackbody curve with "rainbow" in Tikz can be easily modified, you just need



          addplot [shading=rainbow, shading angle=90, forget plot, draw=none, domain=5:10] {planck(x,5000)} closedcycle;


          instead of what I used there. Modify the domain to whatever is correct.



          enter image description here



          (By the way, you seem to have made two accounts, I think you can have them merged: https://tex.stackexchange.com/help/merging-accounts)



          documentclass[border=3.14mm,tikz]{standalone}
          usepackage{siunitx}
          usepackage{pgfplots}
          pgfplotsset{compat=1.16}

          usetikzlibrary{shadings}

          pgfdeclareverticalshading{rainbow}{100bp}
          {color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow);
          color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue);
          color(75bp)=(violet); color(100bp)=(violet)}

          begin{document}
          begin{tikzpicture}[
          samples=100,
          declare function={
          planck(x,T)=(x^3)/((pi^2)*(exp(2000*x/(T))-1));
          }]
          begin{axis}[
          xmin=0,
          xlabel={$omega$ [si{hertz}]},
          ymin=0,
          ymax=pi,
          ylabel={$rho (omega; T)$ [si{joulepercubicmeter}]},
          ytick=empty,
          no markers,
          grid=both,domain=0.1:40,
          style={ultra thick}]

          addplot [shading=rainbow, shading angle=90, forget plot, draw=none, domain=5:10] {planck(x,5000)} closedcycle;

          pgfplotsinvokeforeach{3000, 4000, 5000}
          {
          addplot {planck(x,#1)};
          addlegendentryexpanded{$T = #1 [si{kelvin}]$}
          }

          end{axis}
          end{tikzpicture}
          end{document}





          share|improve this answer
























          • Thank you very much!

            – vulcano9
            8 hours ago



















          2














          Like this?



              documentclass{standalone}
          usepackage{pgfplots}
          usepackage{pgfmath}
          usepackage{amsmath}
          usepackage[ngerman]{babel}
          usepackage[utf8]{inputenc}


          usepackage[%
          %decimalsymbol=comma,
          locale=DE,
          ]{siunitx}

          usepgfplotslibrary{fillbetween}
          usetikzlibrary{shadings}
          pgfplotsset{compat=1.16}

          pgfdeclareverticalshading{rainbow}{100bp}
          {color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow);
          color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue);
          color(75bp)=(violet); color(100bp)=(violet)}

          begin{document}
          begin{tikzpicture}[samples=200, scale=1.15,declare function={
          planck(x,T)=(374177152466412/x^5)/(exp(14387.77/(x*T))-1);
          }]
          begin{axis}[
          xmin=0,
          xmax=3,
          xlabel={$omega$ [si{hertz}]},
          ymin=0,
          ylabel={$rho (omega; T)$ [si{joulepercubicmeter}]},
          ytick=empty,
          no markers,
          grid=both,
          domain=0.1:3,
          ]
          addplot+ [forget plot,name path=A] {planck(x,6000)};
          addplot [forget plot,name path=B,samples=2] {0};
          %-------------------------------
          % add shading code here...
          %-------------------------------
          addplot [forget plot,shading=rainbow,shading angle=270]
          fill between [of=A and B,soft clip={domain=.4:.72}];
          % addplot [forget plot,green] fill between [of=A and B,soft clip={domain=.47:.535}];
          % addplot [forget plot,yellow] fill between [of=A and B,soft clip={domain=.535:.6}];
          % addplot [forget plot,orange] fill between [of=A and B,soft clip={domain=.6:.66}];
          % addplot [forget plot,red] fill between [of=A and B,soft clip={domain=.66:.72}];

          pgfplotsinvokeforeach{3000, 4000, 5000, 6000}
          {
          addplot {planck(x,#1)};
          addlegendentryexpanded{$T = #1,si{kelvin}$}
          }
          end{axis}
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer
























          • Thank you guys!

            – vulcano9
            8 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
          });


          }
          });






          vulcano9 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%2f501160%2fpgfplots-fillbetween-and-tikz-shade%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          shading can be used more or less instead of fill, so my answer to your previous question Planck's blackbody curve with "rainbow" in Tikz can be easily modified, you just need



          addplot [shading=rainbow, shading angle=90, forget plot, draw=none, domain=5:10] {planck(x,5000)} closedcycle;


          instead of what I used there. Modify the domain to whatever is correct.



          enter image description here



          (By the way, you seem to have made two accounts, I think you can have them merged: https://tex.stackexchange.com/help/merging-accounts)



          documentclass[border=3.14mm,tikz]{standalone}
          usepackage{siunitx}
          usepackage{pgfplots}
          pgfplotsset{compat=1.16}

          usetikzlibrary{shadings}

          pgfdeclareverticalshading{rainbow}{100bp}
          {color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow);
          color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue);
          color(75bp)=(violet); color(100bp)=(violet)}

          begin{document}
          begin{tikzpicture}[
          samples=100,
          declare function={
          planck(x,T)=(x^3)/((pi^2)*(exp(2000*x/(T))-1));
          }]
          begin{axis}[
          xmin=0,
          xlabel={$omega$ [si{hertz}]},
          ymin=0,
          ymax=pi,
          ylabel={$rho (omega; T)$ [si{joulepercubicmeter}]},
          ytick=empty,
          no markers,
          grid=both,domain=0.1:40,
          style={ultra thick}]

          addplot [shading=rainbow, shading angle=90, forget plot, draw=none, domain=5:10] {planck(x,5000)} closedcycle;

          pgfplotsinvokeforeach{3000, 4000, 5000}
          {
          addplot {planck(x,#1)};
          addlegendentryexpanded{$T = #1 [si{kelvin}]$}
          }

          end{axis}
          end{tikzpicture}
          end{document}





          share|improve this answer
























          • Thank you very much!

            – vulcano9
            8 hours ago
















          4














          shading can be used more or less instead of fill, so my answer to your previous question Planck's blackbody curve with "rainbow" in Tikz can be easily modified, you just need



          addplot [shading=rainbow, shading angle=90, forget plot, draw=none, domain=5:10] {planck(x,5000)} closedcycle;


          instead of what I used there. Modify the domain to whatever is correct.



          enter image description here



          (By the way, you seem to have made two accounts, I think you can have them merged: https://tex.stackexchange.com/help/merging-accounts)



          documentclass[border=3.14mm,tikz]{standalone}
          usepackage{siunitx}
          usepackage{pgfplots}
          pgfplotsset{compat=1.16}

          usetikzlibrary{shadings}

          pgfdeclareverticalshading{rainbow}{100bp}
          {color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow);
          color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue);
          color(75bp)=(violet); color(100bp)=(violet)}

          begin{document}
          begin{tikzpicture}[
          samples=100,
          declare function={
          planck(x,T)=(x^3)/((pi^2)*(exp(2000*x/(T))-1));
          }]
          begin{axis}[
          xmin=0,
          xlabel={$omega$ [si{hertz}]},
          ymin=0,
          ymax=pi,
          ylabel={$rho (omega; T)$ [si{joulepercubicmeter}]},
          ytick=empty,
          no markers,
          grid=both,domain=0.1:40,
          style={ultra thick}]

          addplot [shading=rainbow, shading angle=90, forget plot, draw=none, domain=5:10] {planck(x,5000)} closedcycle;

          pgfplotsinvokeforeach{3000, 4000, 5000}
          {
          addplot {planck(x,#1)};
          addlegendentryexpanded{$T = #1 [si{kelvin}]$}
          }

          end{axis}
          end{tikzpicture}
          end{document}





          share|improve this answer
























          • Thank you very much!

            – vulcano9
            8 hours ago














          4












          4








          4







          shading can be used more or less instead of fill, so my answer to your previous question Planck's blackbody curve with "rainbow" in Tikz can be easily modified, you just need



          addplot [shading=rainbow, shading angle=90, forget plot, draw=none, domain=5:10] {planck(x,5000)} closedcycle;


          instead of what I used there. Modify the domain to whatever is correct.



          enter image description here



          (By the way, you seem to have made two accounts, I think you can have them merged: https://tex.stackexchange.com/help/merging-accounts)



          documentclass[border=3.14mm,tikz]{standalone}
          usepackage{siunitx}
          usepackage{pgfplots}
          pgfplotsset{compat=1.16}

          usetikzlibrary{shadings}

          pgfdeclareverticalshading{rainbow}{100bp}
          {color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow);
          color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue);
          color(75bp)=(violet); color(100bp)=(violet)}

          begin{document}
          begin{tikzpicture}[
          samples=100,
          declare function={
          planck(x,T)=(x^3)/((pi^2)*(exp(2000*x/(T))-1));
          }]
          begin{axis}[
          xmin=0,
          xlabel={$omega$ [si{hertz}]},
          ymin=0,
          ymax=pi,
          ylabel={$rho (omega; T)$ [si{joulepercubicmeter}]},
          ytick=empty,
          no markers,
          grid=both,domain=0.1:40,
          style={ultra thick}]

          addplot [shading=rainbow, shading angle=90, forget plot, draw=none, domain=5:10] {planck(x,5000)} closedcycle;

          pgfplotsinvokeforeach{3000, 4000, 5000}
          {
          addplot {planck(x,#1)};
          addlegendentryexpanded{$T = #1 [si{kelvin}]$}
          }

          end{axis}
          end{tikzpicture}
          end{document}





          share|improve this answer













          shading can be used more or less instead of fill, so my answer to your previous question Planck's blackbody curve with "rainbow" in Tikz can be easily modified, you just need



          addplot [shading=rainbow, shading angle=90, forget plot, draw=none, domain=5:10] {planck(x,5000)} closedcycle;


          instead of what I used there. Modify the domain to whatever is correct.



          enter image description here



          (By the way, you seem to have made two accounts, I think you can have them merged: https://tex.stackexchange.com/help/merging-accounts)



          documentclass[border=3.14mm,tikz]{standalone}
          usepackage{siunitx}
          usepackage{pgfplots}
          pgfplotsset{compat=1.16}

          usetikzlibrary{shadings}

          pgfdeclareverticalshading{rainbow}{100bp}
          {color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow);
          color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue);
          color(75bp)=(violet); color(100bp)=(violet)}

          begin{document}
          begin{tikzpicture}[
          samples=100,
          declare function={
          planck(x,T)=(x^3)/((pi^2)*(exp(2000*x/(T))-1));
          }]
          begin{axis}[
          xmin=0,
          xlabel={$omega$ [si{hertz}]},
          ymin=0,
          ymax=pi,
          ylabel={$rho (omega; T)$ [si{joulepercubicmeter}]},
          ytick=empty,
          no markers,
          grid=both,domain=0.1:40,
          style={ultra thick}]

          addplot [shading=rainbow, shading angle=90, forget plot, draw=none, domain=5:10] {planck(x,5000)} closedcycle;

          pgfplotsinvokeforeach{3000, 4000, 5000}
          {
          addplot {planck(x,#1)};
          addlegendentryexpanded{$T = #1 [si{kelvin}]$}
          }

          end{axis}
          end{tikzpicture}
          end{document}






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 8 hours ago









          Torbjørn T.Torbjørn T.

          162k13 gold badges267 silver badges453 bronze badges




          162k13 gold badges267 silver badges453 bronze badges













          • Thank you very much!

            – vulcano9
            8 hours ago



















          • Thank you very much!

            – vulcano9
            8 hours ago

















          Thank you very much!

          – vulcano9
          8 hours ago





          Thank you very much!

          – vulcano9
          8 hours ago













          2














          Like this?



              documentclass{standalone}
          usepackage{pgfplots}
          usepackage{pgfmath}
          usepackage{amsmath}
          usepackage[ngerman]{babel}
          usepackage[utf8]{inputenc}


          usepackage[%
          %decimalsymbol=comma,
          locale=DE,
          ]{siunitx}

          usepgfplotslibrary{fillbetween}
          usetikzlibrary{shadings}
          pgfplotsset{compat=1.16}

          pgfdeclareverticalshading{rainbow}{100bp}
          {color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow);
          color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue);
          color(75bp)=(violet); color(100bp)=(violet)}

          begin{document}
          begin{tikzpicture}[samples=200, scale=1.15,declare function={
          planck(x,T)=(374177152466412/x^5)/(exp(14387.77/(x*T))-1);
          }]
          begin{axis}[
          xmin=0,
          xmax=3,
          xlabel={$omega$ [si{hertz}]},
          ymin=0,
          ylabel={$rho (omega; T)$ [si{joulepercubicmeter}]},
          ytick=empty,
          no markers,
          grid=both,
          domain=0.1:3,
          ]
          addplot+ [forget plot,name path=A] {planck(x,6000)};
          addplot [forget plot,name path=B,samples=2] {0};
          %-------------------------------
          % add shading code here...
          %-------------------------------
          addplot [forget plot,shading=rainbow,shading angle=270]
          fill between [of=A and B,soft clip={domain=.4:.72}];
          % addplot [forget plot,green] fill between [of=A and B,soft clip={domain=.47:.535}];
          % addplot [forget plot,yellow] fill between [of=A and B,soft clip={domain=.535:.6}];
          % addplot [forget plot,orange] fill between [of=A and B,soft clip={domain=.6:.66}];
          % addplot [forget plot,red] fill between [of=A and B,soft clip={domain=.66:.72}];

          pgfplotsinvokeforeach{3000, 4000, 5000, 6000}
          {
          addplot {planck(x,#1)};
          addlegendentryexpanded{$T = #1,si{kelvin}$}
          }
          end{axis}
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer
























          • Thank you guys!

            – vulcano9
            8 hours ago
















          2














          Like this?



              documentclass{standalone}
          usepackage{pgfplots}
          usepackage{pgfmath}
          usepackage{amsmath}
          usepackage[ngerman]{babel}
          usepackage[utf8]{inputenc}


          usepackage[%
          %decimalsymbol=comma,
          locale=DE,
          ]{siunitx}

          usepgfplotslibrary{fillbetween}
          usetikzlibrary{shadings}
          pgfplotsset{compat=1.16}

          pgfdeclareverticalshading{rainbow}{100bp}
          {color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow);
          color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue);
          color(75bp)=(violet); color(100bp)=(violet)}

          begin{document}
          begin{tikzpicture}[samples=200, scale=1.15,declare function={
          planck(x,T)=(374177152466412/x^5)/(exp(14387.77/(x*T))-1);
          }]
          begin{axis}[
          xmin=0,
          xmax=3,
          xlabel={$omega$ [si{hertz}]},
          ymin=0,
          ylabel={$rho (omega; T)$ [si{joulepercubicmeter}]},
          ytick=empty,
          no markers,
          grid=both,
          domain=0.1:3,
          ]
          addplot+ [forget plot,name path=A] {planck(x,6000)};
          addplot [forget plot,name path=B,samples=2] {0};
          %-------------------------------
          % add shading code here...
          %-------------------------------
          addplot [forget plot,shading=rainbow,shading angle=270]
          fill between [of=A and B,soft clip={domain=.4:.72}];
          % addplot [forget plot,green] fill between [of=A and B,soft clip={domain=.47:.535}];
          % addplot [forget plot,yellow] fill between [of=A and B,soft clip={domain=.535:.6}];
          % addplot [forget plot,orange] fill between [of=A and B,soft clip={domain=.6:.66}];
          % addplot [forget plot,red] fill between [of=A and B,soft clip={domain=.66:.72}];

          pgfplotsinvokeforeach{3000, 4000, 5000, 6000}
          {
          addplot {planck(x,#1)};
          addlegendentryexpanded{$T = #1,si{kelvin}$}
          }
          end{axis}
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer
























          • Thank you guys!

            – vulcano9
            8 hours ago














          2












          2








          2







          Like this?



              documentclass{standalone}
          usepackage{pgfplots}
          usepackage{pgfmath}
          usepackage{amsmath}
          usepackage[ngerman]{babel}
          usepackage[utf8]{inputenc}


          usepackage[%
          %decimalsymbol=comma,
          locale=DE,
          ]{siunitx}

          usepgfplotslibrary{fillbetween}
          usetikzlibrary{shadings}
          pgfplotsset{compat=1.16}

          pgfdeclareverticalshading{rainbow}{100bp}
          {color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow);
          color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue);
          color(75bp)=(violet); color(100bp)=(violet)}

          begin{document}
          begin{tikzpicture}[samples=200, scale=1.15,declare function={
          planck(x,T)=(374177152466412/x^5)/(exp(14387.77/(x*T))-1);
          }]
          begin{axis}[
          xmin=0,
          xmax=3,
          xlabel={$omega$ [si{hertz}]},
          ymin=0,
          ylabel={$rho (omega; T)$ [si{joulepercubicmeter}]},
          ytick=empty,
          no markers,
          grid=both,
          domain=0.1:3,
          ]
          addplot+ [forget plot,name path=A] {planck(x,6000)};
          addplot [forget plot,name path=B,samples=2] {0};
          %-------------------------------
          % add shading code here...
          %-------------------------------
          addplot [forget plot,shading=rainbow,shading angle=270]
          fill between [of=A and B,soft clip={domain=.4:.72}];
          % addplot [forget plot,green] fill between [of=A and B,soft clip={domain=.47:.535}];
          % addplot [forget plot,yellow] fill between [of=A and B,soft clip={domain=.535:.6}];
          % addplot [forget plot,orange] fill between [of=A and B,soft clip={domain=.6:.66}];
          % addplot [forget plot,red] fill between [of=A and B,soft clip={domain=.66:.72}];

          pgfplotsinvokeforeach{3000, 4000, 5000, 6000}
          {
          addplot {planck(x,#1)};
          addlegendentryexpanded{$T = #1,si{kelvin}$}
          }
          end{axis}
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer













          Like this?



              documentclass{standalone}
          usepackage{pgfplots}
          usepackage{pgfmath}
          usepackage{amsmath}
          usepackage[ngerman]{babel}
          usepackage[utf8]{inputenc}


          usepackage[%
          %decimalsymbol=comma,
          locale=DE,
          ]{siunitx}

          usepgfplotslibrary{fillbetween}
          usetikzlibrary{shadings}
          pgfplotsset{compat=1.16}

          pgfdeclareverticalshading{rainbow}{100bp}
          {color(0bp)=(red); color(25bp)=(red); color(35bp)=(yellow);
          color(45bp)=(green); color(55bp)=(cyan); color(65bp)=(blue);
          color(75bp)=(violet); color(100bp)=(violet)}

          begin{document}
          begin{tikzpicture}[samples=200, scale=1.15,declare function={
          planck(x,T)=(374177152466412/x^5)/(exp(14387.77/(x*T))-1);
          }]
          begin{axis}[
          xmin=0,
          xmax=3,
          xlabel={$omega$ [si{hertz}]},
          ymin=0,
          ylabel={$rho (omega; T)$ [si{joulepercubicmeter}]},
          ytick=empty,
          no markers,
          grid=both,
          domain=0.1:3,
          ]
          addplot+ [forget plot,name path=A] {planck(x,6000)};
          addplot [forget plot,name path=B,samples=2] {0};
          %-------------------------------
          % add shading code here...
          %-------------------------------
          addplot [forget plot,shading=rainbow,shading angle=270]
          fill between [of=A and B,soft clip={domain=.4:.72}];
          % addplot [forget plot,green] fill between [of=A and B,soft clip={domain=.47:.535}];
          % addplot [forget plot,yellow] fill between [of=A and B,soft clip={domain=.535:.6}];
          % addplot [forget plot,orange] fill between [of=A and B,soft clip={domain=.6:.66}];
          % addplot [forget plot,red] fill between [of=A and B,soft clip={domain=.66:.72}];

          pgfplotsinvokeforeach{3000, 4000, 5000, 6000}
          {
          addplot {planck(x,#1)};
          addlegendentryexpanded{$T = #1,si{kelvin}$}
          }
          end{axis}
          end{tikzpicture}
          end{document}


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 8 hours ago









          ferahfezaferahfeza

          9,0441 gold badge21 silver badges36 bronze badges




          9,0441 gold badge21 silver badges36 bronze badges













          • Thank you guys!

            – vulcano9
            8 hours ago



















          • Thank you guys!

            – vulcano9
            8 hours ago

















          Thank you guys!

          – vulcano9
          8 hours ago





          Thank you guys!

          – vulcano9
          8 hours ago










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










          draft saved

          draft discarded


















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













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












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
















          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%2f501160%2fpgfplots-fillbetween-and-tikz-shade%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

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...