Adding different Greek characters to individual axis tick labels in pgfplots











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.










share|improve this question









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















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.










share|improve this question









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













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.










share|improve this question









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






share|improve this question









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.











share|improve this question









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.









share|improve this question




share|improve this question








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


















  • 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










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}


enter image description here



I made the plot a bit wider such that the now wider labels do not overlap. Alternatively, you may rotate them.






share|improve this answer





















  • 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










  • 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











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
});


}
});






Antony Stanley-Clarke is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f459597%2fadding-different-greek-characters-to-individual-axis-tick-labels-in-pgfplots%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
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}


enter image description here



I made the plot a bit wider such that the now wider labels do not overlap. Alternatively, you may rotate them.






share|improve this answer





















  • 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










  • 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















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}


enter image description here



I made the plot a bit wider such that the now wider labels do not overlap. Alternatively, you may rotate them.






share|improve this answer





















  • 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










  • 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













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}


enter image description here



I made the plot a bit wider such that the now wider labels do not overlap. Alternatively, you may rotate them.






share|improve this answer












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}


enter image description here



I made the plot a bit wider such that the now wider labels do not overlap. Alternatively, you may rotate them.







share|improve this answer












share|improve this answer



share|improve this answer










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 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


















  • 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










  • 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










Antony Stanley-Clarke is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















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.















 


draft saved


draft discarded














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




















































































Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?