PGFplots: Changing style of labels of nodes near coords











up vote
2
down vote

favorite












Trying to adopt this answer approach, I didn't manage to get what I want of changing the style of the nodes near coords labels.



I would like to make this code poles={red, fill = blue, draw} work and accordingly change nodes near coords labels styles in addition to printing the correct labels (e.g. (-8,0) instead of 0).



documentclass[border=1cm]{standalone}
usepackage{pgfplots}

pgfplotsset{compat=newest,
poles/.style= { only marks, mark=x, mark size = 1ex, thick},
nodes on coords/.style={
nodes near coords,
point meta = explicit symbolic,
every node near coord/.style args={[#1]}%
{
anchor=south, label={[black,#1]myangle:{mylabel}}
},
visualization depends on={thisrow{angle} as myangle},
visualization depends on={value thisrow{label} as mylabel},
}
}

usepackage{filecontents}
begin{filecontents*}{poles.dat}
Re Im label angle
-2 2 (-2,2) 270
-2 -2 (-2,-2) 90
-8 0 (-8,0) 60
end{filecontents*}

begin{document}
begin{tikzpicture}
begin{axis}
addplot[poles={red, fill = blue, draw}, nodes near coords]
table {poles.dat};
end{axis}
end{tikzpicture}
end{document}


enter image description here










share|improve this question


























    up vote
    2
    down vote

    favorite












    Trying to adopt this answer approach, I didn't manage to get what I want of changing the style of the nodes near coords labels.



    I would like to make this code poles={red, fill = blue, draw} work and accordingly change nodes near coords labels styles in addition to printing the correct labels (e.g. (-8,0) instead of 0).



    documentclass[border=1cm]{standalone}
    usepackage{pgfplots}

    pgfplotsset{compat=newest,
    poles/.style= { only marks, mark=x, mark size = 1ex, thick},
    nodes on coords/.style={
    nodes near coords,
    point meta = explicit symbolic,
    every node near coord/.style args={[#1]}%
    {
    anchor=south, label={[black,#1]myangle:{mylabel}}
    },
    visualization depends on={thisrow{angle} as myangle},
    visualization depends on={value thisrow{label} as mylabel},
    }
    }

    usepackage{filecontents}
    begin{filecontents*}{poles.dat}
    Re Im label angle
    -2 2 (-2,2) 270
    -2 -2 (-2,-2) 90
    -8 0 (-8,0) 60
    end{filecontents*}

    begin{document}
    begin{tikzpicture}
    begin{axis}
    addplot[poles={red, fill = blue, draw}, nodes near coords]
    table {poles.dat};
    end{axis}
    end{tikzpicture}
    end{document}


    enter image description here










    share|improve this question
























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      Trying to adopt this answer approach, I didn't manage to get what I want of changing the style of the nodes near coords labels.



      I would like to make this code poles={red, fill = blue, draw} work and accordingly change nodes near coords labels styles in addition to printing the correct labels (e.g. (-8,0) instead of 0).



      documentclass[border=1cm]{standalone}
      usepackage{pgfplots}

      pgfplotsset{compat=newest,
      poles/.style= { only marks, mark=x, mark size = 1ex, thick},
      nodes on coords/.style={
      nodes near coords,
      point meta = explicit symbolic,
      every node near coord/.style args={[#1]}%
      {
      anchor=south, label={[black,#1]myangle:{mylabel}}
      },
      visualization depends on={thisrow{angle} as myangle},
      visualization depends on={value thisrow{label} as mylabel},
      }
      }

      usepackage{filecontents}
      begin{filecontents*}{poles.dat}
      Re Im label angle
      -2 2 (-2,2) 270
      -2 -2 (-2,-2) 90
      -8 0 (-8,0) 60
      end{filecontents*}

      begin{document}
      begin{tikzpicture}
      begin{axis}
      addplot[poles={red, fill = blue, draw}, nodes near coords]
      table {poles.dat};
      end{axis}
      end{tikzpicture}
      end{document}


      enter image description here










      share|improve this question













      Trying to adopt this answer approach, I didn't manage to get what I want of changing the style of the nodes near coords labels.



      I would like to make this code poles={red, fill = blue, draw} work and accordingly change nodes near coords labels styles in addition to printing the correct labels (e.g. (-8,0) instead of 0).



      documentclass[border=1cm]{standalone}
      usepackage{pgfplots}

      pgfplotsset{compat=newest,
      poles/.style= { only marks, mark=x, mark size = 1ex, thick},
      nodes on coords/.style={
      nodes near coords,
      point meta = explicit symbolic,
      every node near coord/.style args={[#1]}%
      {
      anchor=south, label={[black,#1]myangle:{mylabel}}
      },
      visualization depends on={thisrow{angle} as myangle},
      visualization depends on={value thisrow{label} as mylabel},
      }
      }

      usepackage{filecontents}
      begin{filecontents*}{poles.dat}
      Re Im label angle
      -2 2 (-2,2) 270
      -2 -2 (-2,-2) 90
      -8 0 (-8,0) 60
      end{filecontents*}

      begin{document}
      begin{tikzpicture}
      begin{axis}
      addplot[poles={red, fill = blue, draw}, nodes near coords]
      table {poles.dat};
      end{axis}
      end{tikzpicture}
      end{document}


      enter image description here







      tikz-pgf pgfplots tikz-styles nodes-near-coords






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked yesterday









      Diaa

      2,63211644




      2,63211644






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote













          This is an attempt of a partial answer. What it does is to allow you to add the labels to the nodes in the way I think you may have had in mind. In your code, you have a style nodes on coords, which you define but never use. More specifically, you use nodes near coords (rather than nodes on coords), which unless instructed otherwise, just places the coordindex on top of the coordinates. Just trying to install nodes on coords lead to errors, so I decided to go step by step and just pasted the keys into the axis options after I modified them.



          documentclass[border=1cm]{standalone}
          usepackage{pgfplots}
          tikzset{my node/.style={}}
          pgfplotsset{compat=newest,
          poles/.style= { only marks, mark=x, mark size = 1ex, thick},
          }

          usepackage{filecontents}
          begin{filecontents*}{poles.dat}
          Re Im label angle
          -2 2 (-2,2) 270
          -2 -2 (-2,-2) 90
          -8 0 (-8,0) 60
          end{filecontents*}

          begin{document}
          begin{tikzpicture}
          begin{axis}[point meta = explicit symbolic,
          visualization depends on={thisrow{angle} as myangle},
          visualization depends on={value thisrow{label} as mylabel},
          every node near coord/.append style={
          anchor=south, label={[black]myangle:{mylabel}}
          }]
          addplot[poles={red, fill = blue, draw},nodes near coords]
          table {poles.dat};
          end{axis}
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer





















          • Many thanks. I didn't realize that I have defined something I never used.
            – Diaa
            22 hours ago










          • Thanks to your answer and this one, I managed to do it right in the answer I posted.
            – Diaa
            22 hours ago


















          up vote
          1
          down vote













          Thanks to @marmot's answer and this one, I think I figured out how to do it the right way.



          documentclass[border=1cm]{standalone}

          usepackage{pgfplots}

          pgfplotsset{compat=newest,
          poles/.style= { only marks, mark=x, mark size = 1ex, thick},
          point meta = explicit symbolic,
          visualization depends on={thisrow{angle} as myangle},
          visualization depends on={value thisrow{label} as mylabel},
          Label Style/.style args = {#1}{
          nodes near coords,
          every node near coord/.style = %
          {
          anchor=south, label={[#1]myangle:{mylabel}}
          },
          }
          }

          usepackage{filecontents}
          begin{filecontents*}{poles.dat}
          Re Im label angle
          -2 2 (-2,2) 270
          -2 -2 (-2,-2) 90
          -8 0 (-8,0) 60
          end{filecontents*}

          begin{document}
          begin{tikzpicture}
          begin{axis}
          addplot[Label Style={blue,fill = gray!20},poles]
          table {poles.dat};
          end{axis}
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer





















            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: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461083%2fpgfplots-changing-style-of-labels-of-nodes-near-coords%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








            up vote
            2
            down vote













            This is an attempt of a partial answer. What it does is to allow you to add the labels to the nodes in the way I think you may have had in mind. In your code, you have a style nodes on coords, which you define but never use. More specifically, you use nodes near coords (rather than nodes on coords), which unless instructed otherwise, just places the coordindex on top of the coordinates. Just trying to install nodes on coords lead to errors, so I decided to go step by step and just pasted the keys into the axis options after I modified them.



            documentclass[border=1cm]{standalone}
            usepackage{pgfplots}
            tikzset{my node/.style={}}
            pgfplotsset{compat=newest,
            poles/.style= { only marks, mark=x, mark size = 1ex, thick},
            }

            usepackage{filecontents}
            begin{filecontents*}{poles.dat}
            Re Im label angle
            -2 2 (-2,2) 270
            -2 -2 (-2,-2) 90
            -8 0 (-8,0) 60
            end{filecontents*}

            begin{document}
            begin{tikzpicture}
            begin{axis}[point meta = explicit symbolic,
            visualization depends on={thisrow{angle} as myangle},
            visualization depends on={value thisrow{label} as mylabel},
            every node near coord/.append style={
            anchor=south, label={[black]myangle:{mylabel}}
            }]
            addplot[poles={red, fill = blue, draw},nodes near coords]
            table {poles.dat};
            end{axis}
            end{tikzpicture}
            end{document}


            enter image description here






            share|improve this answer





















            • Many thanks. I didn't realize that I have defined something I never used.
              – Diaa
              22 hours ago










            • Thanks to your answer and this one, I managed to do it right in the answer I posted.
              – Diaa
              22 hours ago















            up vote
            2
            down vote













            This is an attempt of a partial answer. What it does is to allow you to add the labels to the nodes in the way I think you may have had in mind. In your code, you have a style nodes on coords, which you define but never use. More specifically, you use nodes near coords (rather than nodes on coords), which unless instructed otherwise, just places the coordindex on top of the coordinates. Just trying to install nodes on coords lead to errors, so I decided to go step by step and just pasted the keys into the axis options after I modified them.



            documentclass[border=1cm]{standalone}
            usepackage{pgfplots}
            tikzset{my node/.style={}}
            pgfplotsset{compat=newest,
            poles/.style= { only marks, mark=x, mark size = 1ex, thick},
            }

            usepackage{filecontents}
            begin{filecontents*}{poles.dat}
            Re Im label angle
            -2 2 (-2,2) 270
            -2 -2 (-2,-2) 90
            -8 0 (-8,0) 60
            end{filecontents*}

            begin{document}
            begin{tikzpicture}
            begin{axis}[point meta = explicit symbolic,
            visualization depends on={thisrow{angle} as myangle},
            visualization depends on={value thisrow{label} as mylabel},
            every node near coord/.append style={
            anchor=south, label={[black]myangle:{mylabel}}
            }]
            addplot[poles={red, fill = blue, draw},nodes near coords]
            table {poles.dat};
            end{axis}
            end{tikzpicture}
            end{document}


            enter image description here






            share|improve this answer





















            • Many thanks. I didn't realize that I have defined something I never used.
              – Diaa
              22 hours ago










            • Thanks to your answer and this one, I managed to do it right in the answer I posted.
              – Diaa
              22 hours ago













            up vote
            2
            down vote










            up vote
            2
            down vote









            This is an attempt of a partial answer. What it does is to allow you to add the labels to the nodes in the way I think you may have had in mind. In your code, you have a style nodes on coords, which you define but never use. More specifically, you use nodes near coords (rather than nodes on coords), which unless instructed otherwise, just places the coordindex on top of the coordinates. Just trying to install nodes on coords lead to errors, so I decided to go step by step and just pasted the keys into the axis options after I modified them.



            documentclass[border=1cm]{standalone}
            usepackage{pgfplots}
            tikzset{my node/.style={}}
            pgfplotsset{compat=newest,
            poles/.style= { only marks, mark=x, mark size = 1ex, thick},
            }

            usepackage{filecontents}
            begin{filecontents*}{poles.dat}
            Re Im label angle
            -2 2 (-2,2) 270
            -2 -2 (-2,-2) 90
            -8 0 (-8,0) 60
            end{filecontents*}

            begin{document}
            begin{tikzpicture}
            begin{axis}[point meta = explicit symbolic,
            visualization depends on={thisrow{angle} as myangle},
            visualization depends on={value thisrow{label} as mylabel},
            every node near coord/.append style={
            anchor=south, label={[black]myangle:{mylabel}}
            }]
            addplot[poles={red, fill = blue, draw},nodes near coords]
            table {poles.dat};
            end{axis}
            end{tikzpicture}
            end{document}


            enter image description here






            share|improve this answer












            This is an attempt of a partial answer. What it does is to allow you to add the labels to the nodes in the way I think you may have had in mind. In your code, you have a style nodes on coords, which you define but never use. More specifically, you use nodes near coords (rather than nodes on coords), which unless instructed otherwise, just places the coordindex on top of the coordinates. Just trying to install nodes on coords lead to errors, so I decided to go step by step and just pasted the keys into the axis options after I modified them.



            documentclass[border=1cm]{standalone}
            usepackage{pgfplots}
            tikzset{my node/.style={}}
            pgfplotsset{compat=newest,
            poles/.style= { only marks, mark=x, mark size = 1ex, thick},
            }

            usepackage{filecontents}
            begin{filecontents*}{poles.dat}
            Re Im label angle
            -2 2 (-2,2) 270
            -2 -2 (-2,-2) 90
            -8 0 (-8,0) 60
            end{filecontents*}

            begin{document}
            begin{tikzpicture}
            begin{axis}[point meta = explicit symbolic,
            visualization depends on={thisrow{angle} as myangle},
            visualization depends on={value thisrow{label} as mylabel},
            every node near coord/.append style={
            anchor=south, label={[black]myangle:{mylabel}}
            }]
            addplot[poles={red, fill = blue, draw},nodes near coords]
            table {poles.dat};
            end{axis}
            end{tikzpicture}
            end{document}


            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered yesterday









            marmot

            77.1k487162




            77.1k487162












            • Many thanks. I didn't realize that I have defined something I never used.
              – Diaa
              22 hours ago










            • Thanks to your answer and this one, I managed to do it right in the answer I posted.
              – Diaa
              22 hours ago


















            • Many thanks. I didn't realize that I have defined something I never used.
              – Diaa
              22 hours ago










            • Thanks to your answer and this one, I managed to do it right in the answer I posted.
              – Diaa
              22 hours ago
















            Many thanks. I didn't realize that I have defined something I never used.
            – Diaa
            22 hours ago




            Many thanks. I didn't realize that I have defined something I never used.
            – Diaa
            22 hours ago












            Thanks to your answer and this one, I managed to do it right in the answer I posted.
            – Diaa
            22 hours ago




            Thanks to your answer and this one, I managed to do it right in the answer I posted.
            – Diaa
            22 hours ago










            up vote
            1
            down vote













            Thanks to @marmot's answer and this one, I think I figured out how to do it the right way.



            documentclass[border=1cm]{standalone}

            usepackage{pgfplots}

            pgfplotsset{compat=newest,
            poles/.style= { only marks, mark=x, mark size = 1ex, thick},
            point meta = explicit symbolic,
            visualization depends on={thisrow{angle} as myangle},
            visualization depends on={value thisrow{label} as mylabel},
            Label Style/.style args = {#1}{
            nodes near coords,
            every node near coord/.style = %
            {
            anchor=south, label={[#1]myangle:{mylabel}}
            },
            }
            }

            usepackage{filecontents}
            begin{filecontents*}{poles.dat}
            Re Im label angle
            -2 2 (-2,2) 270
            -2 -2 (-2,-2) 90
            -8 0 (-8,0) 60
            end{filecontents*}

            begin{document}
            begin{tikzpicture}
            begin{axis}
            addplot[Label Style={blue,fill = gray!20},poles]
            table {poles.dat};
            end{axis}
            end{tikzpicture}
            end{document}


            enter image description here






            share|improve this answer

























              up vote
              1
              down vote













              Thanks to @marmot's answer and this one, I think I figured out how to do it the right way.



              documentclass[border=1cm]{standalone}

              usepackage{pgfplots}

              pgfplotsset{compat=newest,
              poles/.style= { only marks, mark=x, mark size = 1ex, thick},
              point meta = explicit symbolic,
              visualization depends on={thisrow{angle} as myangle},
              visualization depends on={value thisrow{label} as mylabel},
              Label Style/.style args = {#1}{
              nodes near coords,
              every node near coord/.style = %
              {
              anchor=south, label={[#1]myangle:{mylabel}}
              },
              }
              }

              usepackage{filecontents}
              begin{filecontents*}{poles.dat}
              Re Im label angle
              -2 2 (-2,2) 270
              -2 -2 (-2,-2) 90
              -8 0 (-8,0) 60
              end{filecontents*}

              begin{document}
              begin{tikzpicture}
              begin{axis}
              addplot[Label Style={blue,fill = gray!20},poles]
              table {poles.dat};
              end{axis}
              end{tikzpicture}
              end{document}


              enter image description here






              share|improve this answer























                up vote
                1
                down vote










                up vote
                1
                down vote









                Thanks to @marmot's answer and this one, I think I figured out how to do it the right way.



                documentclass[border=1cm]{standalone}

                usepackage{pgfplots}

                pgfplotsset{compat=newest,
                poles/.style= { only marks, mark=x, mark size = 1ex, thick},
                point meta = explicit symbolic,
                visualization depends on={thisrow{angle} as myangle},
                visualization depends on={value thisrow{label} as mylabel},
                Label Style/.style args = {#1}{
                nodes near coords,
                every node near coord/.style = %
                {
                anchor=south, label={[#1]myangle:{mylabel}}
                },
                }
                }

                usepackage{filecontents}
                begin{filecontents*}{poles.dat}
                Re Im label angle
                -2 2 (-2,2) 270
                -2 -2 (-2,-2) 90
                -8 0 (-8,0) 60
                end{filecontents*}

                begin{document}
                begin{tikzpicture}
                begin{axis}
                addplot[Label Style={blue,fill = gray!20},poles]
                table {poles.dat};
                end{axis}
                end{tikzpicture}
                end{document}


                enter image description here






                share|improve this answer












                Thanks to @marmot's answer and this one, I think I figured out how to do it the right way.



                documentclass[border=1cm]{standalone}

                usepackage{pgfplots}

                pgfplotsset{compat=newest,
                poles/.style= { only marks, mark=x, mark size = 1ex, thick},
                point meta = explicit symbolic,
                visualization depends on={thisrow{angle} as myangle},
                visualization depends on={value thisrow{label} as mylabel},
                Label Style/.style args = {#1}{
                nodes near coords,
                every node near coord/.style = %
                {
                anchor=south, label={[#1]myangle:{mylabel}}
                },
                }
                }

                usepackage{filecontents}
                begin{filecontents*}{poles.dat}
                Re Im label angle
                -2 2 (-2,2) 270
                -2 -2 (-2,-2) 90
                -8 0 (-8,0) 60
                end{filecontents*}

                begin{document}
                begin{tikzpicture}
                begin{axis}
                addplot[Label Style={blue,fill = gray!20},poles]
                table {poles.dat};
                end{axis}
                end{tikzpicture}
                end{document}


                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 22 hours ago









                Diaa

                2,63211644




                2,63211644






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461083%2fpgfplots-changing-style-of-labels-of-nodes-near-coords%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

                    Accessing regular linux commands in Huawei's Dopra Linux

                    Can't connect RFCOMM socket: Host is down

                    Kernel panic - not syncing: Fatal Exception in Interrupt