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}
tikz-pgf pgfplots tikz-styles nodes-near-coords
add a comment |
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}
tikz-pgf pgfplots tikz-styles nodes-near-coords
add a comment |
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}
tikz-pgf pgfplots tikz-styles nodes-near-coords
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}
tikz-pgf pgfplots tikz-styles nodes-near-coords
tikz-pgf pgfplots tikz-styles nodes-near-coords
asked yesterday
Diaa
2,63211644
2,63211644
add a comment |
add a comment |
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}
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
add a comment |
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}
add a comment |
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}
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
add a comment |
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}
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
add a comment |
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}
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}
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
add a comment |
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
add a comment |
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}
add a comment |
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}
add a comment |
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}
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}
answered 22 hours ago
Diaa
2,63211644
2,63211644
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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