Adding different Greek characters to individual axis tick labels in pgfplots

Multi tool use
up vote
1
down vote
favorite
I've been scouring the web and the pgfplots manual trying to find an example of labelling different x-axis ticks with different Greek characters.
The closest i've found is using
xticklabel={$pgfmathprintnumber{tick}sigma $},
xtick={-3,-2,-1,0,1,2,3},
My full code for the plot is as follows
pgfplotsset{width=7cm,compat=1.16}
begin{center}
begin{tikzpicture}[baseline]
begin{axis}[
axis lines=left,
title={Standard Normal Distribution $Zsim Nleft ( 0,1 right )$},
xlabel={$z$-score},
ylabel={Probability},
xticklabel={$pgfmathprintnumber{tick}sigma $},
xtick={-3,-2,-1,0,1,2,3},
ytick={0,0.1,0.2,0.3,0.4},
ymax=0.5
]
newcommandMU{0}
newcommandSIGMA{1}
addplot[
domain=-4*SIGMA:4*SIGMA,
samples=201,
]
{exp(-(x-MU)^2 / 2 / SIGMA^2) / (SIGMA * sqrt(2*pi))};
end{axis}
end{tikzpicture}
end{center}
But here it obviously just amends each xtick with a sigma next to the value.
What I want is for the xticks to read mu-3*sigma, mu-2*sigma, mu-sigma, mu etc etc.
Any ideas would be greatly appreciated.
pgfplots labels greek ticks
New contributor
Antony Stanley-Clarke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
1
down vote
favorite
I've been scouring the web and the pgfplots manual trying to find an example of labelling different x-axis ticks with different Greek characters.
The closest i've found is using
xticklabel={$pgfmathprintnumber{tick}sigma $},
xtick={-3,-2,-1,0,1,2,3},
My full code for the plot is as follows
pgfplotsset{width=7cm,compat=1.16}
begin{center}
begin{tikzpicture}[baseline]
begin{axis}[
axis lines=left,
title={Standard Normal Distribution $Zsim Nleft ( 0,1 right )$},
xlabel={$z$-score},
ylabel={Probability},
xticklabel={$pgfmathprintnumber{tick}sigma $},
xtick={-3,-2,-1,0,1,2,3},
ytick={0,0.1,0.2,0.3,0.4},
ymax=0.5
]
newcommandMU{0}
newcommandSIGMA{1}
addplot[
domain=-4*SIGMA:4*SIGMA,
samples=201,
]
{exp(-(x-MU)^2 / 2 / SIGMA^2) / (SIGMA * sqrt(2*pi))};
end{axis}
end{tikzpicture}
end{center}
But here it obviously just amends each xtick with a sigma next to the value.
What I want is for the xticks to read mu-3*sigma, mu-2*sigma, mu-sigma, mu etc etc.
Any ideas would be greatly appreciated.
pgfplots labels greek ticks
New contributor
Antony Stanley-Clarke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Welcome to TeX.SX! Please help us help you by providing a minimal compilable code example (MWE).
– TeXnician
yesterday
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I've been scouring the web and the pgfplots manual trying to find an example of labelling different x-axis ticks with different Greek characters.
The closest i've found is using
xticklabel={$pgfmathprintnumber{tick}sigma $},
xtick={-3,-2,-1,0,1,2,3},
My full code for the plot is as follows
pgfplotsset{width=7cm,compat=1.16}
begin{center}
begin{tikzpicture}[baseline]
begin{axis}[
axis lines=left,
title={Standard Normal Distribution $Zsim Nleft ( 0,1 right )$},
xlabel={$z$-score},
ylabel={Probability},
xticklabel={$pgfmathprintnumber{tick}sigma $},
xtick={-3,-2,-1,0,1,2,3},
ytick={0,0.1,0.2,0.3,0.4},
ymax=0.5
]
newcommandMU{0}
newcommandSIGMA{1}
addplot[
domain=-4*SIGMA:4*SIGMA,
samples=201,
]
{exp(-(x-MU)^2 / 2 / SIGMA^2) / (SIGMA * sqrt(2*pi))};
end{axis}
end{tikzpicture}
end{center}
But here it obviously just amends each xtick with a sigma next to the value.
What I want is for the xticks to read mu-3*sigma, mu-2*sigma, mu-sigma, mu etc etc.
Any ideas would be greatly appreciated.
pgfplots labels greek ticks
New contributor
Antony Stanley-Clarke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I've been scouring the web and the pgfplots manual trying to find an example of labelling different x-axis ticks with different Greek characters.
The closest i've found is using
xticklabel={$pgfmathprintnumber{tick}sigma $},
xtick={-3,-2,-1,0,1,2,3},
My full code for the plot is as follows
pgfplotsset{width=7cm,compat=1.16}
begin{center}
begin{tikzpicture}[baseline]
begin{axis}[
axis lines=left,
title={Standard Normal Distribution $Zsim Nleft ( 0,1 right )$},
xlabel={$z$-score},
ylabel={Probability},
xticklabel={$pgfmathprintnumber{tick}sigma $},
xtick={-3,-2,-1,0,1,2,3},
ytick={0,0.1,0.2,0.3,0.4},
ymax=0.5
]
newcommandMU{0}
newcommandSIGMA{1}
addplot[
domain=-4*SIGMA:4*SIGMA,
samples=201,
]
{exp(-(x-MU)^2 / 2 / SIGMA^2) / (SIGMA * sqrt(2*pi))};
end{axis}
end{tikzpicture}
end{center}
But here it obviously just amends each xtick with a sigma next to the value.
What I want is for the xticks to read mu-3*sigma, mu-2*sigma, mu-sigma, mu etc etc.
Any ideas would be greatly appreciated.
pgfplots labels greek ticks
pgfplots labels greek ticks
New contributor
Antony Stanley-Clarke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Antony Stanley-Clarke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited yesterday
New contributor
Antony Stanley-Clarke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked yesterday


Antony Stanley-Clarke
62
62
New contributor
Antony Stanley-Clarke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Antony Stanley-Clarke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Antony Stanley-Clarke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Welcome to TeX.SX! Please help us help you by providing a minimal compilable code example (MWE).
– TeXnician
yesterday
add a comment |
Welcome to TeX.SX! Please help us help you by providing a minimal compilable code example (MWE).
– TeXnician
yesterday
Welcome to TeX.SX! Please help us help you by providing a minimal compilable code example (MWE).
– TeXnician
yesterday
Welcome to TeX.SX! Please help us help you by providing a minimal compilable code example (MWE).
– TeXnician
yesterday
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
Welcome to TeX.SE! Something like this?
documentclass{article}
usepackage{pgfplots}
begin{document}
pgfplotsset{width=12cm,compat=1.16}
begin{center}
begin{tikzpicture}[baseline]
begin{axis}[
axis lines=left,
title={Standard Normal Distribution $Zsim Nleft ( 0,1 right )$},
xlabel={$z$-score},
ylabel={Probability},
xticklabel={$mupgfmathtruncatemacro{mytick}{int(tick)}
ifnummytick=0
else
pgfmathparse{ifthenelse(tick<0,"","+")}
pgfmathresultpgfmathprintnumber{tick}sigmafi $},
xtick={-3,-2,-1,0,1,2,3},
ytick={0,0.1,0.2,0.3,0.4},
ymax=0.5
]
newcommandMU{0}
newcommandSIGMA{1}
addplot[
domain=-4*SIGMA:4*SIGMA,
samples=201,
]
{exp(-(x-MU)^2 / 2 / SIGMA^2) / (SIGMA * sqrt(2*pi))};
end{axis}
end{tikzpicture}
end{center}
end{document}
I made the plot a bit wider such that the now wider labels do not overlap. Alternatively, you may rotate them.
That's awesome. Thanks very much. For future reference, should I want to, is there a way of creating completely unique tick labels that have no pattern, so they're completely bespoke but whilst still using greek characters?
– Antony Stanley-Clarke
yesterday
@AntonyStanley-Clarke Could you please try to reword your comment? I have a hard time figuring out what you're after. (Of course you could add a list of symbols toxticklabel
, is that what you want?)
– marmot
yesterday
Apologies for the ambiguous comment. Yes, adding symbols to xticklabel is what I'm after. I wasn't aware that it was possible. I'm completely new to LaTeX and all I have seen/explored is choosing the xticks as I have done above. This only seems to accept numeric characters. I assume there is another way to choose which xticks to print but also give them bespoke characters?
– Antony Stanley-Clarke
10 hours ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Welcome to TeX.SE! Something like this?
documentclass{article}
usepackage{pgfplots}
begin{document}
pgfplotsset{width=12cm,compat=1.16}
begin{center}
begin{tikzpicture}[baseline]
begin{axis}[
axis lines=left,
title={Standard Normal Distribution $Zsim Nleft ( 0,1 right )$},
xlabel={$z$-score},
ylabel={Probability},
xticklabel={$mupgfmathtruncatemacro{mytick}{int(tick)}
ifnummytick=0
else
pgfmathparse{ifthenelse(tick<0,"","+")}
pgfmathresultpgfmathprintnumber{tick}sigmafi $},
xtick={-3,-2,-1,0,1,2,3},
ytick={0,0.1,0.2,0.3,0.4},
ymax=0.5
]
newcommandMU{0}
newcommandSIGMA{1}
addplot[
domain=-4*SIGMA:4*SIGMA,
samples=201,
]
{exp(-(x-MU)^2 / 2 / SIGMA^2) / (SIGMA * sqrt(2*pi))};
end{axis}
end{tikzpicture}
end{center}
end{document}
I made the plot a bit wider such that the now wider labels do not overlap. Alternatively, you may rotate them.
That's awesome. Thanks very much. For future reference, should I want to, is there a way of creating completely unique tick labels that have no pattern, so they're completely bespoke but whilst still using greek characters?
– Antony Stanley-Clarke
yesterday
@AntonyStanley-Clarke Could you please try to reword your comment? I have a hard time figuring out what you're after. (Of course you could add a list of symbols toxticklabel
, is that what you want?)
– marmot
yesterday
Apologies for the ambiguous comment. Yes, adding symbols to xticklabel is what I'm after. I wasn't aware that it was possible. I'm completely new to LaTeX and all I have seen/explored is choosing the xticks as I have done above. This only seems to accept numeric characters. I assume there is another way to choose which xticks to print but also give them bespoke characters?
– Antony Stanley-Clarke
10 hours ago
add a comment |
up vote
1
down vote
Welcome to TeX.SE! Something like this?
documentclass{article}
usepackage{pgfplots}
begin{document}
pgfplotsset{width=12cm,compat=1.16}
begin{center}
begin{tikzpicture}[baseline]
begin{axis}[
axis lines=left,
title={Standard Normal Distribution $Zsim Nleft ( 0,1 right )$},
xlabel={$z$-score},
ylabel={Probability},
xticklabel={$mupgfmathtruncatemacro{mytick}{int(tick)}
ifnummytick=0
else
pgfmathparse{ifthenelse(tick<0,"","+")}
pgfmathresultpgfmathprintnumber{tick}sigmafi $},
xtick={-3,-2,-1,0,1,2,3},
ytick={0,0.1,0.2,0.3,0.4},
ymax=0.5
]
newcommandMU{0}
newcommandSIGMA{1}
addplot[
domain=-4*SIGMA:4*SIGMA,
samples=201,
]
{exp(-(x-MU)^2 / 2 / SIGMA^2) / (SIGMA * sqrt(2*pi))};
end{axis}
end{tikzpicture}
end{center}
end{document}
I made the plot a bit wider such that the now wider labels do not overlap. Alternatively, you may rotate them.
That's awesome. Thanks very much. For future reference, should I want to, is there a way of creating completely unique tick labels that have no pattern, so they're completely bespoke but whilst still using greek characters?
– Antony Stanley-Clarke
yesterday
@AntonyStanley-Clarke Could you please try to reword your comment? I have a hard time figuring out what you're after. (Of course you could add a list of symbols toxticklabel
, is that what you want?)
– marmot
yesterday
Apologies for the ambiguous comment. Yes, adding symbols to xticklabel is what I'm after. I wasn't aware that it was possible. I'm completely new to LaTeX and all I have seen/explored is choosing the xticks as I have done above. This only seems to accept numeric characters. I assume there is another way to choose which xticks to print but also give them bespoke characters?
– Antony Stanley-Clarke
10 hours ago
add a comment |
up vote
1
down vote
up vote
1
down vote
Welcome to TeX.SE! Something like this?
documentclass{article}
usepackage{pgfplots}
begin{document}
pgfplotsset{width=12cm,compat=1.16}
begin{center}
begin{tikzpicture}[baseline]
begin{axis}[
axis lines=left,
title={Standard Normal Distribution $Zsim Nleft ( 0,1 right )$},
xlabel={$z$-score},
ylabel={Probability},
xticklabel={$mupgfmathtruncatemacro{mytick}{int(tick)}
ifnummytick=0
else
pgfmathparse{ifthenelse(tick<0,"","+")}
pgfmathresultpgfmathprintnumber{tick}sigmafi $},
xtick={-3,-2,-1,0,1,2,3},
ytick={0,0.1,0.2,0.3,0.4},
ymax=0.5
]
newcommandMU{0}
newcommandSIGMA{1}
addplot[
domain=-4*SIGMA:4*SIGMA,
samples=201,
]
{exp(-(x-MU)^2 / 2 / SIGMA^2) / (SIGMA * sqrt(2*pi))};
end{axis}
end{tikzpicture}
end{center}
end{document}
I made the plot a bit wider such that the now wider labels do not overlap. Alternatively, you may rotate them.
Welcome to TeX.SE! Something like this?
documentclass{article}
usepackage{pgfplots}
begin{document}
pgfplotsset{width=12cm,compat=1.16}
begin{center}
begin{tikzpicture}[baseline]
begin{axis}[
axis lines=left,
title={Standard Normal Distribution $Zsim Nleft ( 0,1 right )$},
xlabel={$z$-score},
ylabel={Probability},
xticklabel={$mupgfmathtruncatemacro{mytick}{int(tick)}
ifnummytick=0
else
pgfmathparse{ifthenelse(tick<0,"","+")}
pgfmathresultpgfmathprintnumber{tick}sigmafi $},
xtick={-3,-2,-1,0,1,2,3},
ytick={0,0.1,0.2,0.3,0.4},
ymax=0.5
]
newcommandMU{0}
newcommandSIGMA{1}
addplot[
domain=-4*SIGMA:4*SIGMA,
samples=201,
]
{exp(-(x-MU)^2 / 2 / SIGMA^2) / (SIGMA * sqrt(2*pi))};
end{axis}
end{tikzpicture}
end{center}
end{document}
I made the plot a bit wider such that the now wider labels do not overlap. Alternatively, you may rotate them.
answered yesterday


marmot
74.5k482157
74.5k482157
That's awesome. Thanks very much. For future reference, should I want to, is there a way of creating completely unique tick labels that have no pattern, so they're completely bespoke but whilst still using greek characters?
– Antony Stanley-Clarke
yesterday
@AntonyStanley-Clarke Could you please try to reword your comment? I have a hard time figuring out what you're after. (Of course you could add a list of symbols toxticklabel
, is that what you want?)
– marmot
yesterday
Apologies for the ambiguous comment. Yes, adding symbols to xticklabel is what I'm after. I wasn't aware that it was possible. I'm completely new to LaTeX and all I have seen/explored is choosing the xticks as I have done above. This only seems to accept numeric characters. I assume there is another way to choose which xticks to print but also give them bespoke characters?
– Antony Stanley-Clarke
10 hours ago
add a comment |
That's awesome. Thanks very much. For future reference, should I want to, is there a way of creating completely unique tick labels that have no pattern, so they're completely bespoke but whilst still using greek characters?
– Antony Stanley-Clarke
yesterday
@AntonyStanley-Clarke Could you please try to reword your comment? I have a hard time figuring out what you're after. (Of course you could add a list of symbols toxticklabel
, is that what you want?)
– marmot
yesterday
Apologies for the ambiguous comment. Yes, adding symbols to xticklabel is what I'm after. I wasn't aware that it was possible. I'm completely new to LaTeX and all I have seen/explored is choosing the xticks as I have done above. This only seems to accept numeric characters. I assume there is another way to choose which xticks to print but also give them bespoke characters?
– Antony Stanley-Clarke
10 hours ago
That's awesome. Thanks very much. For future reference, should I want to, is there a way of creating completely unique tick labels that have no pattern, so they're completely bespoke but whilst still using greek characters?
– Antony Stanley-Clarke
yesterday
That's awesome. Thanks very much. For future reference, should I want to, is there a way of creating completely unique tick labels that have no pattern, so they're completely bespoke but whilst still using greek characters?
– Antony Stanley-Clarke
yesterday
@AntonyStanley-Clarke Could you please try to reword your comment? I have a hard time figuring out what you're after. (Of course you could add a list of symbols to
xticklabel
, is that what you want?)– marmot
yesterday
@AntonyStanley-Clarke Could you please try to reword your comment? I have a hard time figuring out what you're after. (Of course you could add a list of symbols to
xticklabel
, is that what you want?)– marmot
yesterday
Apologies for the ambiguous comment. Yes, adding symbols to xticklabel is what I'm after. I wasn't aware that it was possible. I'm completely new to LaTeX and all I have seen/explored is choosing the xticks as I have done above. This only seems to accept numeric characters. I assume there is another way to choose which xticks to print but also give them bespoke characters?
– Antony Stanley-Clarke
10 hours ago
Apologies for the ambiguous comment. Yes, adding symbols to xticklabel is what I'm after. I wasn't aware that it was possible. I'm completely new to LaTeX and all I have seen/explored is choosing the xticks as I have done above. This only seems to accept numeric characters. I assume there is another way to choose which xticks to print but also give them bespoke characters?
– Antony Stanley-Clarke
10 hours ago
add a comment |
Antony Stanley-Clarke is a new contributor. Be nice, and check out our Code of Conduct.
Antony Stanley-Clarke is a new contributor. Be nice, and check out our Code of Conduct.
Antony Stanley-Clarke is a new contributor. Be nice, and check out our Code of Conduct.
Antony Stanley-Clarke is a new contributor. Be nice, and check out our Code of Conduct.
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
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f459597%2fadding-different-greek-characters-to-individual-axis-tick-labels-in-pgfplots%23new-answer', 'question_page');
}
);
Post as a guest
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
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
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
zGQmpPRY8X9FKft,GJ,O2wOcRjbZc,J7t 9p78qCJ153l,ALSHXv9NTgk9H4i0 bYmrdA5U1ce2pAwSVNjOR5UXbq,PBim
Welcome to TeX.SX! Please help us help you by providing a minimal compilable code example (MWE).
– TeXnician
yesterday