Legendary entry

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











up vote
2
down vote

favorite












How can i change the picture of the legendary? I would like to have to lines insted...



documentclass[margin=5mm]standalone 
usepackagetikz,pgfplots
begindocument
begintikzpicture
beginaxis[
axis lines=center,
axis equal image,
%unit vector ratio=1 1,
scale=0.6,
%width=4.5cm,
%height=3cm,
xlabel=$theta$,
xtick=-1,-0.5,0.5,1,
xlabel style=anchor=west,
ylabel=$O(theta^3)$,
ylabel style=anchor=south,
ytick=-0.5,0.5,
xmin=-1.25, xmax=1.25,
ymin=-0.7, ymax=0.7,
samples=500,
every tick/.style=black,line width=0.5pt,
legend style=
anchor=outer north east,
nodes=scale=0.9,inner sep=1pt, transform shape
,
]
addplot[mesh,
colormap=
color=(white)
color=(blue)
color=(white)
,
point meta=x,
thick,
%forget plot,
domain=-1.1:1.1] cos(deg(x))-1;
addlegendentry(sin(theta)-theta)
addplot[mesh,
colormap=
color=(white)
color=(red)
color=(white)
,
point meta=x,
thick,
%forget plot,
domain=-1.1:1.1] sin(deg(x))-x;
addlegendentry(cos(theta)-1)
endaxis
endtikzpicture
enddocument


enter image description here










share|improve this question



























    up vote
    2
    down vote

    favorite












    How can i change the picture of the legendary? I would like to have to lines insted...



    documentclass[margin=5mm]standalone 
    usepackagetikz,pgfplots
    begindocument
    begintikzpicture
    beginaxis[
    axis lines=center,
    axis equal image,
    %unit vector ratio=1 1,
    scale=0.6,
    %width=4.5cm,
    %height=3cm,
    xlabel=$theta$,
    xtick=-1,-0.5,0.5,1,
    xlabel style=anchor=west,
    ylabel=$O(theta^3)$,
    ylabel style=anchor=south,
    ytick=-0.5,0.5,
    xmin=-1.25, xmax=1.25,
    ymin=-0.7, ymax=0.7,
    samples=500,
    every tick/.style=black,line width=0.5pt,
    legend style=
    anchor=outer north east,
    nodes=scale=0.9,inner sep=1pt, transform shape
    ,
    ]
    addplot[mesh,
    colormap=
    color=(white)
    color=(blue)
    color=(white)
    ,
    point meta=x,
    thick,
    %forget plot,
    domain=-1.1:1.1] cos(deg(x))-1;
    addlegendentry(sin(theta)-theta)
    addplot[mesh,
    colormap=
    color=(white)
    color=(red)
    color=(white)
    ,
    point meta=x,
    thick,
    %forget plot,
    domain=-1.1:1.1] sin(deg(x))-x;
    addlegendentry(cos(theta)-1)
    endaxis
    endtikzpicture
    enddocument


    enter image description here










    share|improve this question

























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      How can i change the picture of the legendary? I would like to have to lines insted...



      documentclass[margin=5mm]standalone 
      usepackagetikz,pgfplots
      begindocument
      begintikzpicture
      beginaxis[
      axis lines=center,
      axis equal image,
      %unit vector ratio=1 1,
      scale=0.6,
      %width=4.5cm,
      %height=3cm,
      xlabel=$theta$,
      xtick=-1,-0.5,0.5,1,
      xlabel style=anchor=west,
      ylabel=$O(theta^3)$,
      ylabel style=anchor=south,
      ytick=-0.5,0.5,
      xmin=-1.25, xmax=1.25,
      ymin=-0.7, ymax=0.7,
      samples=500,
      every tick/.style=black,line width=0.5pt,
      legend style=
      anchor=outer north east,
      nodes=scale=0.9,inner sep=1pt, transform shape
      ,
      ]
      addplot[mesh,
      colormap=
      color=(white)
      color=(blue)
      color=(white)
      ,
      point meta=x,
      thick,
      %forget plot,
      domain=-1.1:1.1] cos(deg(x))-1;
      addlegendentry(sin(theta)-theta)
      addplot[mesh,
      colormap=
      color=(white)
      color=(red)
      color=(white)
      ,
      point meta=x,
      thick,
      %forget plot,
      domain=-1.1:1.1] sin(deg(x))-x;
      addlegendentry(cos(theta)-1)
      endaxis
      endtikzpicture
      enddocument


      enter image description here










      share|improve this question















      How can i change the picture of the legendary? I would like to have to lines insted...



      documentclass[margin=5mm]standalone 
      usepackagetikz,pgfplots
      begindocument
      begintikzpicture
      beginaxis[
      axis lines=center,
      axis equal image,
      %unit vector ratio=1 1,
      scale=0.6,
      %width=4.5cm,
      %height=3cm,
      xlabel=$theta$,
      xtick=-1,-0.5,0.5,1,
      xlabel style=anchor=west,
      ylabel=$O(theta^3)$,
      ylabel style=anchor=south,
      ytick=-0.5,0.5,
      xmin=-1.25, xmax=1.25,
      ymin=-0.7, ymax=0.7,
      samples=500,
      every tick/.style=black,line width=0.5pt,
      legend style=
      anchor=outer north east,
      nodes=scale=0.9,inner sep=1pt, transform shape
      ,
      ]
      addplot[mesh,
      colormap=
      color=(white)
      color=(blue)
      color=(white)
      ,
      point meta=x,
      thick,
      %forget plot,
      domain=-1.1:1.1] cos(deg(x))-1;
      addlegendentry(sin(theta)-theta)
      addplot[mesh,
      colormap=
      color=(white)
      color=(red)
      color=(white)
      ,
      point meta=x,
      thick,
      %forget plot,
      domain=-1.1:1.1] sin(deg(x))-x;
      addlegendentry(cos(theta)-1)
      endaxis
      endtikzpicture
      enddocument


      enter image description here







      tikz-pgf axis






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 1 hour ago









      Zarko

      112k861150




      112k861150










      asked 3 hours ago









      Derr Herr

      674




      674




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          One possibility is to simply use this legendary answer.



          documentclass[margin=5mm]standalone 
          usepackagetikz,pgfplots
          pgfplotsset%
          mesh line legend/.style=legend image code/.code=meshlinelegend#1,%

          makeatletter
          longdefmeshlinelegend#1%
          scope[%
          #1,
          /pgfplots/mesh/rows=1,
          /pgfplots/mesh/cols=4,
          /pgfplots/mesh/num points=,
          /tikz/x=(0.44237cm,0cm),
          /tikz/y=(0cm,0.23932cm),
          /tikz/z=(0.0cm,0cm),
          scale=0.4,
          ]
          letpgfplots@metamax=pgfutil@empty
          pgfplots@curplot@threedimtrue

          pgfplotsplothandlermesh
          pgfplotstreamstart

          defsimplecoordinate(##1,##2,##3)%
          pgfmathparse1000*(##3)%
          pgfmathfloatparsenumberpgfmathresult
          letpgfplots@current@point@meta=pgfmathresult
          pgfplotstreampointpgfqpointxyz@orig##1##2##3%
          %

          pgfplotsforeachungrouped x in 0,...,pgfkeysvalueof/pgfplots/samples
          pgfmathsetmacroyx/pgfkeysvalueof/pgfplots/samples
          pgfmathsetmacroxx/pgfkeysvalueof/pgfplots/samples*3
          simplecoordinate(x,0,y)


          pgfplotstreamend
          pgfusepathstroke
          endscope
          %
          makeatother
          begindocument
          begintikzpicture
          beginaxis[
          axis lines=center,
          axis equal image,
          %unit vector ratio=1 1,
          scale=0.6,
          %width=4.5cm,
          %height=3cm,
          xlabel=$theta$,
          xtick=-1,-0.5,0.5,1,
          xlabel style=anchor=west,
          ylabel=$O(theta^3)$,
          ylabel style=anchor=south,
          ytick=-0.5,0.5,
          xmin=-1.25, xmax=1.25,
          ymin=-0.7, ymax=0.7,
          samples=500,
          every tick/.style=black,line width=0.5pt,
          legend style=mesh line legend,
          anchor=south east,
          xshift=20pt,
          nodes=scale=0.9,inner sep=1pt, transform shape
          ,
          ]
          addplot[mesh,mesh line legend,
          colormap=
          color=(white)
          color=(blue)
          color=(white)
          ,
          point meta=x,
          thick,
          %forget plot,
          domain=-1.1:1.1] cos(deg(x))-1;
          addlegendentry(sin(theta)-theta)
          addplot[mesh,mesh line legend,
          colormap=
          color=(white)
          color=(red)
          color=(white)
          ,
          point meta=x,
          thick,
          %forget plot,
          domain=-1.1:1.1] sin(deg(x))-x;
          addlegendentry(cos(theta)-1)
          endaxis
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer






















          • Just asking for my own personal interest... I suppose that the legend symbol comes from the fact that the plots has mesh option!? What if two dummy invisible line plots were added, just to create the legend?
            – hpekristiansen
            1 hour ago










          • @hpekristiansen Yes, you could do that. A slight downside is that you need to give the dummy plots the same color. If you do that, addlegendimage will be an even more straightforward choice. There you can add whatever you like. The point here is that you could adjust pgfmathparsefactor*(##3 - rangea) to create a legend image in which the color changes. This is how tex.stackexchange.com/a/59075/121799 works.
            – marmot
            1 hour ago











          • @hpekristiansen I completely switched gears and now just use Jake's great answer.
            – marmot
            1 hour ago










          • Nice answer although I do not understand the low level code.
            – hpekristiansen
            1 hour ago










          • @hpekristiansen I guess what happened in Jake's answer is that Jake looked up the definition of pgfplotsplothandlermesh@defaultlegend@img in pgfplotsmeshplothandler.code.tex and adjusted it to his needs. There you can find a bunch of simplecoordinate statements, which define the surface symbol of the ordinary mesh legend. The perhaps most important thing there is the statement letpgfplots@current@point@meta=pgfmathresult, which sets the meta (i.e. color) of a point. This gets linked to the third entry of the coordinates, and is how the fading effect is achieved.
            – marmot
            54 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
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f450818%2flegendary-entry%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



          accepted










          One possibility is to simply use this legendary answer.



          documentclass[margin=5mm]standalone 
          usepackagetikz,pgfplots
          pgfplotsset%
          mesh line legend/.style=legend image code/.code=meshlinelegend#1,%

          makeatletter
          longdefmeshlinelegend#1%
          scope[%
          #1,
          /pgfplots/mesh/rows=1,
          /pgfplots/mesh/cols=4,
          /pgfplots/mesh/num points=,
          /tikz/x=(0.44237cm,0cm),
          /tikz/y=(0cm,0.23932cm),
          /tikz/z=(0.0cm,0cm),
          scale=0.4,
          ]
          letpgfplots@metamax=pgfutil@empty
          pgfplots@curplot@threedimtrue

          pgfplotsplothandlermesh
          pgfplotstreamstart

          defsimplecoordinate(##1,##2,##3)%
          pgfmathparse1000*(##3)%
          pgfmathfloatparsenumberpgfmathresult
          letpgfplots@current@point@meta=pgfmathresult
          pgfplotstreampointpgfqpointxyz@orig##1##2##3%
          %

          pgfplotsforeachungrouped x in 0,...,pgfkeysvalueof/pgfplots/samples
          pgfmathsetmacroyx/pgfkeysvalueof/pgfplots/samples
          pgfmathsetmacroxx/pgfkeysvalueof/pgfplots/samples*3
          simplecoordinate(x,0,y)


          pgfplotstreamend
          pgfusepathstroke
          endscope
          %
          makeatother
          begindocument
          begintikzpicture
          beginaxis[
          axis lines=center,
          axis equal image,
          %unit vector ratio=1 1,
          scale=0.6,
          %width=4.5cm,
          %height=3cm,
          xlabel=$theta$,
          xtick=-1,-0.5,0.5,1,
          xlabel style=anchor=west,
          ylabel=$O(theta^3)$,
          ylabel style=anchor=south,
          ytick=-0.5,0.5,
          xmin=-1.25, xmax=1.25,
          ymin=-0.7, ymax=0.7,
          samples=500,
          every tick/.style=black,line width=0.5pt,
          legend style=mesh line legend,
          anchor=south east,
          xshift=20pt,
          nodes=scale=0.9,inner sep=1pt, transform shape
          ,
          ]
          addplot[mesh,mesh line legend,
          colormap=
          color=(white)
          color=(blue)
          color=(white)
          ,
          point meta=x,
          thick,
          %forget plot,
          domain=-1.1:1.1] cos(deg(x))-1;
          addlegendentry(sin(theta)-theta)
          addplot[mesh,mesh line legend,
          colormap=
          color=(white)
          color=(red)
          color=(white)
          ,
          point meta=x,
          thick,
          %forget plot,
          domain=-1.1:1.1] sin(deg(x))-x;
          addlegendentry(cos(theta)-1)
          endaxis
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer






















          • Just asking for my own personal interest... I suppose that the legend symbol comes from the fact that the plots has mesh option!? What if two dummy invisible line plots were added, just to create the legend?
            – hpekristiansen
            1 hour ago










          • @hpekristiansen Yes, you could do that. A slight downside is that you need to give the dummy plots the same color. If you do that, addlegendimage will be an even more straightforward choice. There you can add whatever you like. The point here is that you could adjust pgfmathparsefactor*(##3 - rangea) to create a legend image in which the color changes. This is how tex.stackexchange.com/a/59075/121799 works.
            – marmot
            1 hour ago











          • @hpekristiansen I completely switched gears and now just use Jake's great answer.
            – marmot
            1 hour ago










          • Nice answer although I do not understand the low level code.
            – hpekristiansen
            1 hour ago










          • @hpekristiansen I guess what happened in Jake's answer is that Jake looked up the definition of pgfplotsplothandlermesh@defaultlegend@img in pgfplotsmeshplothandler.code.tex and adjusted it to his needs. There you can find a bunch of simplecoordinate statements, which define the surface symbol of the ordinary mesh legend. The perhaps most important thing there is the statement letpgfplots@current@point@meta=pgfmathresult, which sets the meta (i.e. color) of a point. This gets linked to the third entry of the coordinates, and is how the fading effect is achieved.
            – marmot
            54 mins ago














          up vote
          3
          down vote



          accepted










          One possibility is to simply use this legendary answer.



          documentclass[margin=5mm]standalone 
          usepackagetikz,pgfplots
          pgfplotsset%
          mesh line legend/.style=legend image code/.code=meshlinelegend#1,%

          makeatletter
          longdefmeshlinelegend#1%
          scope[%
          #1,
          /pgfplots/mesh/rows=1,
          /pgfplots/mesh/cols=4,
          /pgfplots/mesh/num points=,
          /tikz/x=(0.44237cm,0cm),
          /tikz/y=(0cm,0.23932cm),
          /tikz/z=(0.0cm,0cm),
          scale=0.4,
          ]
          letpgfplots@metamax=pgfutil@empty
          pgfplots@curplot@threedimtrue

          pgfplotsplothandlermesh
          pgfplotstreamstart

          defsimplecoordinate(##1,##2,##3)%
          pgfmathparse1000*(##3)%
          pgfmathfloatparsenumberpgfmathresult
          letpgfplots@current@point@meta=pgfmathresult
          pgfplotstreampointpgfqpointxyz@orig##1##2##3%
          %

          pgfplotsforeachungrouped x in 0,...,pgfkeysvalueof/pgfplots/samples
          pgfmathsetmacroyx/pgfkeysvalueof/pgfplots/samples
          pgfmathsetmacroxx/pgfkeysvalueof/pgfplots/samples*3
          simplecoordinate(x,0,y)


          pgfplotstreamend
          pgfusepathstroke
          endscope
          %
          makeatother
          begindocument
          begintikzpicture
          beginaxis[
          axis lines=center,
          axis equal image,
          %unit vector ratio=1 1,
          scale=0.6,
          %width=4.5cm,
          %height=3cm,
          xlabel=$theta$,
          xtick=-1,-0.5,0.5,1,
          xlabel style=anchor=west,
          ylabel=$O(theta^3)$,
          ylabel style=anchor=south,
          ytick=-0.5,0.5,
          xmin=-1.25, xmax=1.25,
          ymin=-0.7, ymax=0.7,
          samples=500,
          every tick/.style=black,line width=0.5pt,
          legend style=mesh line legend,
          anchor=south east,
          xshift=20pt,
          nodes=scale=0.9,inner sep=1pt, transform shape
          ,
          ]
          addplot[mesh,mesh line legend,
          colormap=
          color=(white)
          color=(blue)
          color=(white)
          ,
          point meta=x,
          thick,
          %forget plot,
          domain=-1.1:1.1] cos(deg(x))-1;
          addlegendentry(sin(theta)-theta)
          addplot[mesh,mesh line legend,
          colormap=
          color=(white)
          color=(red)
          color=(white)
          ,
          point meta=x,
          thick,
          %forget plot,
          domain=-1.1:1.1] sin(deg(x))-x;
          addlegendentry(cos(theta)-1)
          endaxis
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer






















          • Just asking for my own personal interest... I suppose that the legend symbol comes from the fact that the plots has mesh option!? What if two dummy invisible line plots were added, just to create the legend?
            – hpekristiansen
            1 hour ago










          • @hpekristiansen Yes, you could do that. A slight downside is that you need to give the dummy plots the same color. If you do that, addlegendimage will be an even more straightforward choice. There you can add whatever you like. The point here is that you could adjust pgfmathparsefactor*(##3 - rangea) to create a legend image in which the color changes. This is how tex.stackexchange.com/a/59075/121799 works.
            – marmot
            1 hour ago











          • @hpekristiansen I completely switched gears and now just use Jake's great answer.
            – marmot
            1 hour ago










          • Nice answer although I do not understand the low level code.
            – hpekristiansen
            1 hour ago










          • @hpekristiansen I guess what happened in Jake's answer is that Jake looked up the definition of pgfplotsplothandlermesh@defaultlegend@img in pgfplotsmeshplothandler.code.tex and adjusted it to his needs. There you can find a bunch of simplecoordinate statements, which define the surface symbol of the ordinary mesh legend. The perhaps most important thing there is the statement letpgfplots@current@point@meta=pgfmathresult, which sets the meta (i.e. color) of a point. This gets linked to the third entry of the coordinates, and is how the fading effect is achieved.
            – marmot
            54 mins ago












          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          One possibility is to simply use this legendary answer.



          documentclass[margin=5mm]standalone 
          usepackagetikz,pgfplots
          pgfplotsset%
          mesh line legend/.style=legend image code/.code=meshlinelegend#1,%

          makeatletter
          longdefmeshlinelegend#1%
          scope[%
          #1,
          /pgfplots/mesh/rows=1,
          /pgfplots/mesh/cols=4,
          /pgfplots/mesh/num points=,
          /tikz/x=(0.44237cm,0cm),
          /tikz/y=(0cm,0.23932cm),
          /tikz/z=(0.0cm,0cm),
          scale=0.4,
          ]
          letpgfplots@metamax=pgfutil@empty
          pgfplots@curplot@threedimtrue

          pgfplotsplothandlermesh
          pgfplotstreamstart

          defsimplecoordinate(##1,##2,##3)%
          pgfmathparse1000*(##3)%
          pgfmathfloatparsenumberpgfmathresult
          letpgfplots@current@point@meta=pgfmathresult
          pgfplotstreampointpgfqpointxyz@orig##1##2##3%
          %

          pgfplotsforeachungrouped x in 0,...,pgfkeysvalueof/pgfplots/samples
          pgfmathsetmacroyx/pgfkeysvalueof/pgfplots/samples
          pgfmathsetmacroxx/pgfkeysvalueof/pgfplots/samples*3
          simplecoordinate(x,0,y)


          pgfplotstreamend
          pgfusepathstroke
          endscope
          %
          makeatother
          begindocument
          begintikzpicture
          beginaxis[
          axis lines=center,
          axis equal image,
          %unit vector ratio=1 1,
          scale=0.6,
          %width=4.5cm,
          %height=3cm,
          xlabel=$theta$,
          xtick=-1,-0.5,0.5,1,
          xlabel style=anchor=west,
          ylabel=$O(theta^3)$,
          ylabel style=anchor=south,
          ytick=-0.5,0.5,
          xmin=-1.25, xmax=1.25,
          ymin=-0.7, ymax=0.7,
          samples=500,
          every tick/.style=black,line width=0.5pt,
          legend style=mesh line legend,
          anchor=south east,
          xshift=20pt,
          nodes=scale=0.9,inner sep=1pt, transform shape
          ,
          ]
          addplot[mesh,mesh line legend,
          colormap=
          color=(white)
          color=(blue)
          color=(white)
          ,
          point meta=x,
          thick,
          %forget plot,
          domain=-1.1:1.1] cos(deg(x))-1;
          addlegendentry(sin(theta)-theta)
          addplot[mesh,mesh line legend,
          colormap=
          color=(white)
          color=(red)
          color=(white)
          ,
          point meta=x,
          thick,
          %forget plot,
          domain=-1.1:1.1] sin(deg(x))-x;
          addlegendentry(cos(theta)-1)
          endaxis
          endtikzpicture
          enddocument


          enter image description here






          share|improve this answer














          One possibility is to simply use this legendary answer.



          documentclass[margin=5mm]standalone 
          usepackagetikz,pgfplots
          pgfplotsset%
          mesh line legend/.style=legend image code/.code=meshlinelegend#1,%

          makeatletter
          longdefmeshlinelegend#1%
          scope[%
          #1,
          /pgfplots/mesh/rows=1,
          /pgfplots/mesh/cols=4,
          /pgfplots/mesh/num points=,
          /tikz/x=(0.44237cm,0cm),
          /tikz/y=(0cm,0.23932cm),
          /tikz/z=(0.0cm,0cm),
          scale=0.4,
          ]
          letpgfplots@metamax=pgfutil@empty
          pgfplots@curplot@threedimtrue

          pgfplotsplothandlermesh
          pgfplotstreamstart

          defsimplecoordinate(##1,##2,##3)%
          pgfmathparse1000*(##3)%
          pgfmathfloatparsenumberpgfmathresult
          letpgfplots@current@point@meta=pgfmathresult
          pgfplotstreampointpgfqpointxyz@orig##1##2##3%
          %

          pgfplotsforeachungrouped x in 0,...,pgfkeysvalueof/pgfplots/samples
          pgfmathsetmacroyx/pgfkeysvalueof/pgfplots/samples
          pgfmathsetmacroxx/pgfkeysvalueof/pgfplots/samples*3
          simplecoordinate(x,0,y)


          pgfplotstreamend
          pgfusepathstroke
          endscope
          %
          makeatother
          begindocument
          begintikzpicture
          beginaxis[
          axis lines=center,
          axis equal image,
          %unit vector ratio=1 1,
          scale=0.6,
          %width=4.5cm,
          %height=3cm,
          xlabel=$theta$,
          xtick=-1,-0.5,0.5,1,
          xlabel style=anchor=west,
          ylabel=$O(theta^3)$,
          ylabel style=anchor=south,
          ytick=-0.5,0.5,
          xmin=-1.25, xmax=1.25,
          ymin=-0.7, ymax=0.7,
          samples=500,
          every tick/.style=black,line width=0.5pt,
          legend style=mesh line legend,
          anchor=south east,
          xshift=20pt,
          nodes=scale=0.9,inner sep=1pt, transform shape
          ,
          ]
          addplot[mesh,mesh line legend,
          colormap=
          color=(white)
          color=(blue)
          color=(white)
          ,
          point meta=x,
          thick,
          %forget plot,
          domain=-1.1:1.1] cos(deg(x))-1;
          addlegendentry(sin(theta)-theta)
          addplot[mesh,mesh line legend,
          colormap=
          color=(white)
          color=(red)
          color=(white)
          ,
          point meta=x,
          thick,
          %forget plot,
          domain=-1.1:1.1] sin(deg(x))-x;
          addlegendentry(cos(theta)-1)
          endaxis
          endtikzpicture
          enddocument


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 1 hour ago

























          answered 1 hour ago









          marmot

          57.2k462124




          57.2k462124











          • Just asking for my own personal interest... I suppose that the legend symbol comes from the fact that the plots has mesh option!? What if two dummy invisible line plots were added, just to create the legend?
            – hpekristiansen
            1 hour ago










          • @hpekristiansen Yes, you could do that. A slight downside is that you need to give the dummy plots the same color. If you do that, addlegendimage will be an even more straightforward choice. There you can add whatever you like. The point here is that you could adjust pgfmathparsefactor*(##3 - rangea) to create a legend image in which the color changes. This is how tex.stackexchange.com/a/59075/121799 works.
            – marmot
            1 hour ago











          • @hpekristiansen I completely switched gears and now just use Jake's great answer.
            – marmot
            1 hour ago










          • Nice answer although I do not understand the low level code.
            – hpekristiansen
            1 hour ago










          • @hpekristiansen I guess what happened in Jake's answer is that Jake looked up the definition of pgfplotsplothandlermesh@defaultlegend@img in pgfplotsmeshplothandler.code.tex and adjusted it to his needs. There you can find a bunch of simplecoordinate statements, which define the surface symbol of the ordinary mesh legend. The perhaps most important thing there is the statement letpgfplots@current@point@meta=pgfmathresult, which sets the meta (i.e. color) of a point. This gets linked to the third entry of the coordinates, and is how the fading effect is achieved.
            – marmot
            54 mins ago
















          • Just asking for my own personal interest... I suppose that the legend symbol comes from the fact that the plots has mesh option!? What if two dummy invisible line plots were added, just to create the legend?
            – hpekristiansen
            1 hour ago










          • @hpekristiansen Yes, you could do that. A slight downside is that you need to give the dummy plots the same color. If you do that, addlegendimage will be an even more straightforward choice. There you can add whatever you like. The point here is that you could adjust pgfmathparsefactor*(##3 - rangea) to create a legend image in which the color changes. This is how tex.stackexchange.com/a/59075/121799 works.
            – marmot
            1 hour ago











          • @hpekristiansen I completely switched gears and now just use Jake's great answer.
            – marmot
            1 hour ago










          • Nice answer although I do not understand the low level code.
            – hpekristiansen
            1 hour ago










          • @hpekristiansen I guess what happened in Jake's answer is that Jake looked up the definition of pgfplotsplothandlermesh@defaultlegend@img in pgfplotsmeshplothandler.code.tex and adjusted it to his needs. There you can find a bunch of simplecoordinate statements, which define the surface symbol of the ordinary mesh legend. The perhaps most important thing there is the statement letpgfplots@current@point@meta=pgfmathresult, which sets the meta (i.e. color) of a point. This gets linked to the third entry of the coordinates, and is how the fading effect is achieved.
            – marmot
            54 mins ago















          Just asking for my own personal interest... I suppose that the legend symbol comes from the fact that the plots has mesh option!? What if two dummy invisible line plots were added, just to create the legend?
          – hpekristiansen
          1 hour ago




          Just asking for my own personal interest... I suppose that the legend symbol comes from the fact that the plots has mesh option!? What if two dummy invisible line plots were added, just to create the legend?
          – hpekristiansen
          1 hour ago












          @hpekristiansen Yes, you could do that. A slight downside is that you need to give the dummy plots the same color. If you do that, addlegendimage will be an even more straightforward choice. There you can add whatever you like. The point here is that you could adjust pgfmathparsefactor*(##3 - rangea) to create a legend image in which the color changes. This is how tex.stackexchange.com/a/59075/121799 works.
          – marmot
          1 hour ago





          @hpekristiansen Yes, you could do that. A slight downside is that you need to give the dummy plots the same color. If you do that, addlegendimage will be an even more straightforward choice. There you can add whatever you like. The point here is that you could adjust pgfmathparsefactor*(##3 - rangea) to create a legend image in which the color changes. This is how tex.stackexchange.com/a/59075/121799 works.
          – marmot
          1 hour ago













          @hpekristiansen I completely switched gears and now just use Jake's great answer.
          – marmot
          1 hour ago




          @hpekristiansen I completely switched gears and now just use Jake's great answer.
          – marmot
          1 hour ago












          Nice answer although I do not understand the low level code.
          – hpekristiansen
          1 hour ago




          Nice answer although I do not understand the low level code.
          – hpekristiansen
          1 hour ago












          @hpekristiansen I guess what happened in Jake's answer is that Jake looked up the definition of pgfplotsplothandlermesh@defaultlegend@img in pgfplotsmeshplothandler.code.tex and adjusted it to his needs. There you can find a bunch of simplecoordinate statements, which define the surface symbol of the ordinary mesh legend. The perhaps most important thing there is the statement letpgfplots@current@point@meta=pgfmathresult, which sets the meta (i.e. color) of a point. This gets linked to the third entry of the coordinates, and is how the fading effect is achieved.
          – marmot
          54 mins ago




          @hpekristiansen I guess what happened in Jake's answer is that Jake looked up the definition of pgfplotsplothandlermesh@defaultlegend@img in pgfplotsmeshplothandler.code.tex and adjusted it to his needs. There you can find a bunch of simplecoordinate statements, which define the surface symbol of the ordinary mesh legend. The perhaps most important thing there is the statement letpgfplots@current@point@meta=pgfmathresult, which sets the meta (i.e. color) of a point. This gets linked to the third entry of the coordinates, and is how the fading effect is achieved.
          – marmot
          54 mins ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f450818%2flegendary-entry%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          Installing NextGIS Connect into QGIS 3?

          One-line joke