Aligning group plot titles horizontallyGrouped bar chartbar width not recognized in group plotCentering group...
Does it matter what way the tires go if no directional arrow?
Were any toxic metals used in the International Space Station?
What metal is most suitable for a ladder submerged in an underground water tank?
Will there be more tax deductions if I put the house completely under my name, versus doing a joint ownership?
How to not get blinded by an attack at dawn
How will the lack of ground stations affect navigation?
Does this "yield your space to an ally" rule my 3.5 group uses appear anywhere in the official rules?
Should I communicate in my applications that I'm unemployed out of choice rather than because nobody will have me?
Assembly writer vs compiler
Capital gains on stocks sold to take initial investment off the table
Promotion comes with unexpected 24/7/365 on-call
What do the "optional" resistor and capacitor do in this circuit?
Why is the marginal distribution/marginal probability described as "marginal"?
Is the seat-belt sign activation when a pilot goes to the lavatory standard procedure?
How does a permutation act on a string?
I recently started my machine learning PhD and I have absolutely no idea what I'm doing
Formal Definition of Dot Product
Can anyone give me examples of the relative-determinative 'which'?
Why would company (decision makers) wait for someone to retire, rather than lay them off, when their role is no longer needed?
Windows 10 lock screen - display my own random images
tikz drawing rectangle discretized with triangle lattices and its centroids
Understanding Python syntax in lists vs series
When did game consoles begin including FPUs?
What information exactly does an instruction cache store?
Aligning group plot titles horizontally
Grouped bar chartbar width not recognized in group plotCentering group plot figureHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?How to hide empty (value 0) ybars with pgfplots?Show mark labels near marks and not centered in ybar interaval graphpgfplots: percentage in matrix plotPgfplots for every group plotSpy glasses in a group plotCenter the axes in the coordinate origin
I'm trying to figure out why my plot titles are not horizontally aligned. I tried several sources but could not find an option to control title alignment. Below image is what I get. As you can see Kingsbury and Northcote are not on the same level.
This is my latex code
documentclass[preview]{standalone}
usepackage{filecontents}
usepackage{pgfplots}
usepackage{tikz}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=newest}
usepackage{caption,subcaption}
begin{filecontents*}{cossim.csv}
SAE,Kingsbury large,Kingsbury very small,Northcote large,Northcote very small
0.01,0.999968942313215,0.999999495420309,0.99996093797435,0.999999519021115
0.02,0.999871138637117,0.999998360123856,0.999845179891564,0.999997875670629
0.03,0.999719561898977,0.999995711779553,0.999650464340874,0.999995691207506
0.04,0.999501451940394,0.999992937485087,0.999380356722573,0.999991943604557
0.05,0.999209403163912,0.99998965609147,0.999026294939076,0.999988236057768
0.06,0.998864174035993,0.999986379082264,0.998602080363523,0.999982264001694
0.07,0.998482447668418,0.999979693720795,0.998095945546854,0.999975630444692
end{filecontents*}
begin{document}
pgfplotsset{
axis background/.style={fill=mygrey},
tick style=mygrey2,
tick label style=mygrey2,
grid=both,
ytick pos=left,
tick style={
major grid style={style=white,line width=1pt},
minor grid style=mygrey3,
tick align=outside,
},
commonstyle/.style={
draw=white,
mark=*,
},
midystyle/.style = {
yticklabels={,,},
ytick style={draw=none},
ylabel = {},
},
midxstyle/.style = {
xtick style={draw=none},
xlabel = {},
},
cossimstyle/.style = {
ymin = 0.998,
},
}
definecolor{mygrey}{RGB}{229,229,229}
definecolor{mygrey2}{RGB}{127,127,127}
definecolor{mygrey3}{RGB}{240,240,240}
definecolor{cLarge}{RGB}{31,120,180}
definecolor{cVerySmall}{RGB}{253,191,111}
begin{tikzpicture}%
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
]%
%%%%% ROW1 Start %%%%%
nextgroupplot[%
commonstyle,
midxstyle,
cossimstyle,
legend to name=mainplot,%
legend style={legend columns=4},%
ylabel={Cosine similarity},%
title=Kingsbury,
]%
addplot[color=cLarge] table [x={SAE}, y={Kingsbury large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Kingsbury very small},
col sep=comma]{cossim.csv};%
nextgroupplot[%
commonstyle,
midystyle,
midxstyle,
cossimstyle,
title={Northcote},
]%
addplot[color=cLarge] table [x={SAE}, y={Northcote large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Northcote very small},
col sep=comma]{cossim.csv};%
end{groupplot}
end{tikzpicture}
end{document}
tikz-pgf pgfplots groupplots
add a comment |
I'm trying to figure out why my plot titles are not horizontally aligned. I tried several sources but could not find an option to control title alignment. Below image is what I get. As you can see Kingsbury and Northcote are not on the same level.
This is my latex code
documentclass[preview]{standalone}
usepackage{filecontents}
usepackage{pgfplots}
usepackage{tikz}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=newest}
usepackage{caption,subcaption}
begin{filecontents*}{cossim.csv}
SAE,Kingsbury large,Kingsbury very small,Northcote large,Northcote very small
0.01,0.999968942313215,0.999999495420309,0.99996093797435,0.999999519021115
0.02,0.999871138637117,0.999998360123856,0.999845179891564,0.999997875670629
0.03,0.999719561898977,0.999995711779553,0.999650464340874,0.999995691207506
0.04,0.999501451940394,0.999992937485087,0.999380356722573,0.999991943604557
0.05,0.999209403163912,0.99998965609147,0.999026294939076,0.999988236057768
0.06,0.998864174035993,0.999986379082264,0.998602080363523,0.999982264001694
0.07,0.998482447668418,0.999979693720795,0.998095945546854,0.999975630444692
end{filecontents*}
begin{document}
pgfplotsset{
axis background/.style={fill=mygrey},
tick style=mygrey2,
tick label style=mygrey2,
grid=both,
ytick pos=left,
tick style={
major grid style={style=white,line width=1pt},
minor grid style=mygrey3,
tick align=outside,
},
commonstyle/.style={
draw=white,
mark=*,
},
midystyle/.style = {
yticklabels={,,},
ytick style={draw=none},
ylabel = {},
},
midxstyle/.style = {
xtick style={draw=none},
xlabel = {},
},
cossimstyle/.style = {
ymin = 0.998,
},
}
definecolor{mygrey}{RGB}{229,229,229}
definecolor{mygrey2}{RGB}{127,127,127}
definecolor{mygrey3}{RGB}{240,240,240}
definecolor{cLarge}{RGB}{31,120,180}
definecolor{cVerySmall}{RGB}{253,191,111}
begin{tikzpicture}%
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
]%
%%%%% ROW1 Start %%%%%
nextgroupplot[%
commonstyle,
midxstyle,
cossimstyle,
legend to name=mainplot,%
legend style={legend columns=4},%
ylabel={Cosine similarity},%
title=Kingsbury,
]%
addplot[color=cLarge] table [x={SAE}, y={Kingsbury large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Kingsbury very small},
col sep=comma]{cossim.csv};%
nextgroupplot[%
commonstyle,
midystyle,
midxstyle,
cossimstyle,
title={Northcote},
]%
addplot[color=cLarge] table [x={SAE}, y={Northcote large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Northcote very small},
col sep=comma]{cossim.csv};%
end{groupplot}
end{tikzpicture}
end{document}
tikz-pgf pgfplots groupplots
1
because the "Northop" hasnt leter "y". if you will addvphantom{y}
to it, words will become aligned as you like to have. however, you can definetitle
style in which you addtext depth=0.5ex
.
– Zarko
1 hour ago
add a comment |
I'm trying to figure out why my plot titles are not horizontally aligned. I tried several sources but could not find an option to control title alignment. Below image is what I get. As you can see Kingsbury and Northcote are not on the same level.
This is my latex code
documentclass[preview]{standalone}
usepackage{filecontents}
usepackage{pgfplots}
usepackage{tikz}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=newest}
usepackage{caption,subcaption}
begin{filecontents*}{cossim.csv}
SAE,Kingsbury large,Kingsbury very small,Northcote large,Northcote very small
0.01,0.999968942313215,0.999999495420309,0.99996093797435,0.999999519021115
0.02,0.999871138637117,0.999998360123856,0.999845179891564,0.999997875670629
0.03,0.999719561898977,0.999995711779553,0.999650464340874,0.999995691207506
0.04,0.999501451940394,0.999992937485087,0.999380356722573,0.999991943604557
0.05,0.999209403163912,0.99998965609147,0.999026294939076,0.999988236057768
0.06,0.998864174035993,0.999986379082264,0.998602080363523,0.999982264001694
0.07,0.998482447668418,0.999979693720795,0.998095945546854,0.999975630444692
end{filecontents*}
begin{document}
pgfplotsset{
axis background/.style={fill=mygrey},
tick style=mygrey2,
tick label style=mygrey2,
grid=both,
ytick pos=left,
tick style={
major grid style={style=white,line width=1pt},
minor grid style=mygrey3,
tick align=outside,
},
commonstyle/.style={
draw=white,
mark=*,
},
midystyle/.style = {
yticklabels={,,},
ytick style={draw=none},
ylabel = {},
},
midxstyle/.style = {
xtick style={draw=none},
xlabel = {},
},
cossimstyle/.style = {
ymin = 0.998,
},
}
definecolor{mygrey}{RGB}{229,229,229}
definecolor{mygrey2}{RGB}{127,127,127}
definecolor{mygrey3}{RGB}{240,240,240}
definecolor{cLarge}{RGB}{31,120,180}
definecolor{cVerySmall}{RGB}{253,191,111}
begin{tikzpicture}%
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
]%
%%%%% ROW1 Start %%%%%
nextgroupplot[%
commonstyle,
midxstyle,
cossimstyle,
legend to name=mainplot,%
legend style={legend columns=4},%
ylabel={Cosine similarity},%
title=Kingsbury,
]%
addplot[color=cLarge] table [x={SAE}, y={Kingsbury large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Kingsbury very small},
col sep=comma]{cossim.csv};%
nextgroupplot[%
commonstyle,
midystyle,
midxstyle,
cossimstyle,
title={Northcote},
]%
addplot[color=cLarge] table [x={SAE}, y={Northcote large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Northcote very small},
col sep=comma]{cossim.csv};%
end{groupplot}
end{tikzpicture}
end{document}
tikz-pgf pgfplots groupplots
I'm trying to figure out why my plot titles are not horizontally aligned. I tried several sources but could not find an option to control title alignment. Below image is what I get. As you can see Kingsbury and Northcote are not on the same level.
This is my latex code
documentclass[preview]{standalone}
usepackage{filecontents}
usepackage{pgfplots}
usepackage{tikz}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=newest}
usepackage{caption,subcaption}
begin{filecontents*}{cossim.csv}
SAE,Kingsbury large,Kingsbury very small,Northcote large,Northcote very small
0.01,0.999968942313215,0.999999495420309,0.99996093797435,0.999999519021115
0.02,0.999871138637117,0.999998360123856,0.999845179891564,0.999997875670629
0.03,0.999719561898977,0.999995711779553,0.999650464340874,0.999995691207506
0.04,0.999501451940394,0.999992937485087,0.999380356722573,0.999991943604557
0.05,0.999209403163912,0.99998965609147,0.999026294939076,0.999988236057768
0.06,0.998864174035993,0.999986379082264,0.998602080363523,0.999982264001694
0.07,0.998482447668418,0.999979693720795,0.998095945546854,0.999975630444692
end{filecontents*}
begin{document}
pgfplotsset{
axis background/.style={fill=mygrey},
tick style=mygrey2,
tick label style=mygrey2,
grid=both,
ytick pos=left,
tick style={
major grid style={style=white,line width=1pt},
minor grid style=mygrey3,
tick align=outside,
},
commonstyle/.style={
draw=white,
mark=*,
},
midystyle/.style = {
yticklabels={,,},
ytick style={draw=none},
ylabel = {},
},
midxstyle/.style = {
xtick style={draw=none},
xlabel = {},
},
cossimstyle/.style = {
ymin = 0.998,
},
}
definecolor{mygrey}{RGB}{229,229,229}
definecolor{mygrey2}{RGB}{127,127,127}
definecolor{mygrey3}{RGB}{240,240,240}
definecolor{cLarge}{RGB}{31,120,180}
definecolor{cVerySmall}{RGB}{253,191,111}
begin{tikzpicture}%
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
]%
%%%%% ROW1 Start %%%%%
nextgroupplot[%
commonstyle,
midxstyle,
cossimstyle,
legend to name=mainplot,%
legend style={legend columns=4},%
ylabel={Cosine similarity},%
title=Kingsbury,
]%
addplot[color=cLarge] table [x={SAE}, y={Kingsbury large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Kingsbury very small},
col sep=comma]{cossim.csv};%
nextgroupplot[%
commonstyle,
midystyle,
midxstyle,
cossimstyle,
title={Northcote},
]%
addplot[color=cLarge] table [x={SAE}, y={Northcote large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Northcote very small},
col sep=comma]{cossim.csv};%
end{groupplot}
end{tikzpicture}
end{document}
tikz-pgf pgfplots groupplots
tikz-pgf pgfplots groupplots
edited 4 mins ago
Niroshan
asked 1 hour ago
NiroshanNiroshan
2311310
2311310
1
because the "Northop" hasnt leter "y". if you will addvphantom{y}
to it, words will become aligned as you like to have. however, you can definetitle
style in which you addtext depth=0.5ex
.
– Zarko
1 hour ago
add a comment |
1
because the "Northop" hasnt leter "y". if you will addvphantom{y}
to it, words will become aligned as you like to have. however, you can definetitle
style in which you addtext depth=0.5ex
.
– Zarko
1 hour ago
1
1
because the "Northop" hasnt leter "y". if you will add
vphantom{y}
to it, words will become aligned as you like to have. however, you can define title
style in which you add text depth=0.5ex
.– Zarko
1 hour ago
because the "Northop" hasnt leter "y". if you will add
vphantom{y}
to it, words will become aligned as you like to have. however, you can define title
style in which you add text depth=0.5ex
.– Zarko
1 hour ago
add a comment |
3 Answers
3
active
oldest
votes
As I mentioned in my comment, change your groupplot
settings to:
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
title style = {text depth=0.5ex} % <--- added
]%
and you will get desired result:
add a comment |
You can add title style={text depth = 0pt}
to your nextgroupplot[...]
options to both of the plots and you will have everything aligned horizontally.
documentclass[preview]{standalone}
usepackage{filecontents}
usepackage{pgfplots}
usepackage{tikz}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=newest}
usepackage{caption,subcaption}
begin{filecontents*}{cossim.csv}
SAE,Kingsbury large,Kingsbury very small,Northcote large,Northcote very small
0.01,0.999968942313215,0.999999495420309,0.99996093797435,0.999999519021115
0.02,0.999871138637117,0.999998360123856,0.999845179891564,0.999997875670629
0.03,0.999719561898977,0.999995711779553,0.999650464340874,0.999995691207506
0.04,0.999501451940394,0.999992937485087,0.999380356722573,0.999991943604557
0.05,0.999209403163912,0.99998965609147,0.999026294939076,0.999988236057768
0.06,0.998864174035993,0.999986379082264,0.998602080363523,0.999982264001694
0.07,0.998482447668418,0.999979693720795,0.998095945546854,0.999975630444692
end{filecontents*}
begin{document}
pgfplotsset{
axis background/.style={fill=mygrey},
tick style=mygrey2,
tick label style=mygrey2,
grid=both,
ytick pos=left,
tick style={
major grid style={style=white,line width=1pt},
minor grid style=mygrey3,
tick align=outside,
},
commonstyle/.style={
draw=white,
mark=*,
},
midystyle/.style = {
yticklabels={,,},
ytick style={draw=none},
ylabel = {},
},
midxstyle/.style = {
xtick style={draw=none},
xlabel = {},
},
cossimstyle/.style = {
ymin = 0.998,
},
}
definecolor{mygrey}{RGB}{229,229,229}
definecolor{mygrey2}{RGB}{127,127,127}
definecolor{mygrey3}{RGB}{240,240,240}
definecolor{cLarge}{RGB}{31,120,180}
definecolor{cVerySmall}{RGB}{253,191,111}
begin{tikzpicture}%
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
]%
%%%%% ROW1 Start %%%%%
nextgroupplot[%
commonstyle,
midxstyle,
cossimstyle,
legend to name=mainplot,%
legend style={legend columns=4},%
ylabel={Cosine similarity},%
title style={text depth = 0pt}, % NEED THIS!
title=Kingsbury,
]%
addplot[color=cLarge] table [x={SAE}, y={Kingsbury large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Kingsbury very small},
col sep=comma]{cossim.csv};%
nextgroupplot[%
commonstyle,
midystyle,
midxstyle,
cossimstyle,
title style={text depth = 0pt}, % NEED THIS!
title={Northcote},
]%
addplot[color=cLarge] table [x={SAE}, y={Northcote large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Northcote very small},
col sep=comma]{cossim.csv};%
end{groupplot}
end{tikzpicture}
end{document}
add a comment |
An alternative to previous two answers is anchoring the title text to top (north) and adding some distance between the titles and the plots with title style={anchor=north, yshift=2ex}
.
The reason for the problem is explained in Zarko's comment. That is why the title with "g" and "y" is higher than the other one. My solution is aligning the title text to top of the letters rather than to the bottom. But this cause the plot to overlap with the title. So we have to add some distance between them with yshift.
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
title style={anchor=north, yshift=2ex} % <--- FIX
]%
add a comment |
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',
autoActivateHeartbeat: false,
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
});
}
});
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%2f490898%2faligning-group-plot-titles-horizontally%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
As I mentioned in my comment, change your groupplot
settings to:
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
title style = {text depth=0.5ex} % <--- added
]%
and you will get desired result:
add a comment |
As I mentioned in my comment, change your groupplot
settings to:
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
title style = {text depth=0.5ex} % <--- added
]%
and you will get desired result:
add a comment |
As I mentioned in my comment, change your groupplot
settings to:
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
title style = {text depth=0.5ex} % <--- added
]%
and you will get desired result:
As I mentioned in my comment, change your groupplot
settings to:
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
title style = {text depth=0.5ex} % <--- added
]%
and you will get desired result:
answered 1 hour ago
ZarkoZarko
134k872178
134k872178
add a comment |
add a comment |
You can add title style={text depth = 0pt}
to your nextgroupplot[...]
options to both of the plots and you will have everything aligned horizontally.
documentclass[preview]{standalone}
usepackage{filecontents}
usepackage{pgfplots}
usepackage{tikz}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=newest}
usepackage{caption,subcaption}
begin{filecontents*}{cossim.csv}
SAE,Kingsbury large,Kingsbury very small,Northcote large,Northcote very small
0.01,0.999968942313215,0.999999495420309,0.99996093797435,0.999999519021115
0.02,0.999871138637117,0.999998360123856,0.999845179891564,0.999997875670629
0.03,0.999719561898977,0.999995711779553,0.999650464340874,0.999995691207506
0.04,0.999501451940394,0.999992937485087,0.999380356722573,0.999991943604557
0.05,0.999209403163912,0.99998965609147,0.999026294939076,0.999988236057768
0.06,0.998864174035993,0.999986379082264,0.998602080363523,0.999982264001694
0.07,0.998482447668418,0.999979693720795,0.998095945546854,0.999975630444692
end{filecontents*}
begin{document}
pgfplotsset{
axis background/.style={fill=mygrey},
tick style=mygrey2,
tick label style=mygrey2,
grid=both,
ytick pos=left,
tick style={
major grid style={style=white,line width=1pt},
minor grid style=mygrey3,
tick align=outside,
},
commonstyle/.style={
draw=white,
mark=*,
},
midystyle/.style = {
yticklabels={,,},
ytick style={draw=none},
ylabel = {},
},
midxstyle/.style = {
xtick style={draw=none},
xlabel = {},
},
cossimstyle/.style = {
ymin = 0.998,
},
}
definecolor{mygrey}{RGB}{229,229,229}
definecolor{mygrey2}{RGB}{127,127,127}
definecolor{mygrey3}{RGB}{240,240,240}
definecolor{cLarge}{RGB}{31,120,180}
definecolor{cVerySmall}{RGB}{253,191,111}
begin{tikzpicture}%
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
]%
%%%%% ROW1 Start %%%%%
nextgroupplot[%
commonstyle,
midxstyle,
cossimstyle,
legend to name=mainplot,%
legend style={legend columns=4},%
ylabel={Cosine similarity},%
title style={text depth = 0pt}, % NEED THIS!
title=Kingsbury,
]%
addplot[color=cLarge] table [x={SAE}, y={Kingsbury large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Kingsbury very small},
col sep=comma]{cossim.csv};%
nextgroupplot[%
commonstyle,
midystyle,
midxstyle,
cossimstyle,
title style={text depth = 0pt}, % NEED THIS!
title={Northcote},
]%
addplot[color=cLarge] table [x={SAE}, y={Northcote large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Northcote very small},
col sep=comma]{cossim.csv};%
end{groupplot}
end{tikzpicture}
end{document}
add a comment |
You can add title style={text depth = 0pt}
to your nextgroupplot[...]
options to both of the plots and you will have everything aligned horizontally.
documentclass[preview]{standalone}
usepackage{filecontents}
usepackage{pgfplots}
usepackage{tikz}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=newest}
usepackage{caption,subcaption}
begin{filecontents*}{cossim.csv}
SAE,Kingsbury large,Kingsbury very small,Northcote large,Northcote very small
0.01,0.999968942313215,0.999999495420309,0.99996093797435,0.999999519021115
0.02,0.999871138637117,0.999998360123856,0.999845179891564,0.999997875670629
0.03,0.999719561898977,0.999995711779553,0.999650464340874,0.999995691207506
0.04,0.999501451940394,0.999992937485087,0.999380356722573,0.999991943604557
0.05,0.999209403163912,0.99998965609147,0.999026294939076,0.999988236057768
0.06,0.998864174035993,0.999986379082264,0.998602080363523,0.999982264001694
0.07,0.998482447668418,0.999979693720795,0.998095945546854,0.999975630444692
end{filecontents*}
begin{document}
pgfplotsset{
axis background/.style={fill=mygrey},
tick style=mygrey2,
tick label style=mygrey2,
grid=both,
ytick pos=left,
tick style={
major grid style={style=white,line width=1pt},
minor grid style=mygrey3,
tick align=outside,
},
commonstyle/.style={
draw=white,
mark=*,
},
midystyle/.style = {
yticklabels={,,},
ytick style={draw=none},
ylabel = {},
},
midxstyle/.style = {
xtick style={draw=none},
xlabel = {},
},
cossimstyle/.style = {
ymin = 0.998,
},
}
definecolor{mygrey}{RGB}{229,229,229}
definecolor{mygrey2}{RGB}{127,127,127}
definecolor{mygrey3}{RGB}{240,240,240}
definecolor{cLarge}{RGB}{31,120,180}
definecolor{cVerySmall}{RGB}{253,191,111}
begin{tikzpicture}%
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
]%
%%%%% ROW1 Start %%%%%
nextgroupplot[%
commonstyle,
midxstyle,
cossimstyle,
legend to name=mainplot,%
legend style={legend columns=4},%
ylabel={Cosine similarity},%
title style={text depth = 0pt}, % NEED THIS!
title=Kingsbury,
]%
addplot[color=cLarge] table [x={SAE}, y={Kingsbury large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Kingsbury very small},
col sep=comma]{cossim.csv};%
nextgroupplot[%
commonstyle,
midystyle,
midxstyle,
cossimstyle,
title style={text depth = 0pt}, % NEED THIS!
title={Northcote},
]%
addplot[color=cLarge] table [x={SAE}, y={Northcote large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Northcote very small},
col sep=comma]{cossim.csv};%
end{groupplot}
end{tikzpicture}
end{document}
add a comment |
You can add title style={text depth = 0pt}
to your nextgroupplot[...]
options to both of the plots and you will have everything aligned horizontally.
documentclass[preview]{standalone}
usepackage{filecontents}
usepackage{pgfplots}
usepackage{tikz}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=newest}
usepackage{caption,subcaption}
begin{filecontents*}{cossim.csv}
SAE,Kingsbury large,Kingsbury very small,Northcote large,Northcote very small
0.01,0.999968942313215,0.999999495420309,0.99996093797435,0.999999519021115
0.02,0.999871138637117,0.999998360123856,0.999845179891564,0.999997875670629
0.03,0.999719561898977,0.999995711779553,0.999650464340874,0.999995691207506
0.04,0.999501451940394,0.999992937485087,0.999380356722573,0.999991943604557
0.05,0.999209403163912,0.99998965609147,0.999026294939076,0.999988236057768
0.06,0.998864174035993,0.999986379082264,0.998602080363523,0.999982264001694
0.07,0.998482447668418,0.999979693720795,0.998095945546854,0.999975630444692
end{filecontents*}
begin{document}
pgfplotsset{
axis background/.style={fill=mygrey},
tick style=mygrey2,
tick label style=mygrey2,
grid=both,
ytick pos=left,
tick style={
major grid style={style=white,line width=1pt},
minor grid style=mygrey3,
tick align=outside,
},
commonstyle/.style={
draw=white,
mark=*,
},
midystyle/.style = {
yticklabels={,,},
ytick style={draw=none},
ylabel = {},
},
midxstyle/.style = {
xtick style={draw=none},
xlabel = {},
},
cossimstyle/.style = {
ymin = 0.998,
},
}
definecolor{mygrey}{RGB}{229,229,229}
definecolor{mygrey2}{RGB}{127,127,127}
definecolor{mygrey3}{RGB}{240,240,240}
definecolor{cLarge}{RGB}{31,120,180}
definecolor{cVerySmall}{RGB}{253,191,111}
begin{tikzpicture}%
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
]%
%%%%% ROW1 Start %%%%%
nextgroupplot[%
commonstyle,
midxstyle,
cossimstyle,
legend to name=mainplot,%
legend style={legend columns=4},%
ylabel={Cosine similarity},%
title style={text depth = 0pt}, % NEED THIS!
title=Kingsbury,
]%
addplot[color=cLarge] table [x={SAE}, y={Kingsbury large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Kingsbury very small},
col sep=comma]{cossim.csv};%
nextgroupplot[%
commonstyle,
midystyle,
midxstyle,
cossimstyle,
title style={text depth = 0pt}, % NEED THIS!
title={Northcote},
]%
addplot[color=cLarge] table [x={SAE}, y={Northcote large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Northcote very small},
col sep=comma]{cossim.csv};%
end{groupplot}
end{tikzpicture}
end{document}
You can add title style={text depth = 0pt}
to your nextgroupplot[...]
options to both of the plots and you will have everything aligned horizontally.
documentclass[preview]{standalone}
usepackage{filecontents}
usepackage{pgfplots}
usepackage{tikz}
usepgfplotslibrary{groupplots}
pgfplotsset{compat=newest}
usepackage{caption,subcaption}
begin{filecontents*}{cossim.csv}
SAE,Kingsbury large,Kingsbury very small,Northcote large,Northcote very small
0.01,0.999968942313215,0.999999495420309,0.99996093797435,0.999999519021115
0.02,0.999871138637117,0.999998360123856,0.999845179891564,0.999997875670629
0.03,0.999719561898977,0.999995711779553,0.999650464340874,0.999995691207506
0.04,0.999501451940394,0.999992937485087,0.999380356722573,0.999991943604557
0.05,0.999209403163912,0.99998965609147,0.999026294939076,0.999988236057768
0.06,0.998864174035993,0.999986379082264,0.998602080363523,0.999982264001694
0.07,0.998482447668418,0.999979693720795,0.998095945546854,0.999975630444692
end{filecontents*}
begin{document}
pgfplotsset{
axis background/.style={fill=mygrey},
tick style=mygrey2,
tick label style=mygrey2,
grid=both,
ytick pos=left,
tick style={
major grid style={style=white,line width=1pt},
minor grid style=mygrey3,
tick align=outside,
},
commonstyle/.style={
draw=white,
mark=*,
},
midystyle/.style = {
yticklabels={,,},
ytick style={draw=none},
ylabel = {},
},
midxstyle/.style = {
xtick style={draw=none},
xlabel = {},
},
cossimstyle/.style = {
ymin = 0.998,
},
}
definecolor{mygrey}{RGB}{229,229,229}
definecolor{mygrey2}{RGB}{127,127,127}
definecolor{mygrey3}{RGB}{240,240,240}
definecolor{cLarge}{RGB}{31,120,180}
definecolor{cVerySmall}{RGB}{253,191,111}
begin{tikzpicture}%
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
]%
%%%%% ROW1 Start %%%%%
nextgroupplot[%
commonstyle,
midxstyle,
cossimstyle,
legend to name=mainplot,%
legend style={legend columns=4},%
ylabel={Cosine similarity},%
title style={text depth = 0pt}, % NEED THIS!
title=Kingsbury,
]%
addplot[color=cLarge] table [x={SAE}, y={Kingsbury large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Kingsbury very small},
col sep=comma]{cossim.csv};%
nextgroupplot[%
commonstyle,
midystyle,
midxstyle,
cossimstyle,
title style={text depth = 0pt}, % NEED THIS!
title={Northcote},
]%
addplot[color=cLarge] table [x={SAE}, y={Northcote large}, col
sep=comma]{cossim.csv};%
addplot[color=cVerySmall] table [x={SAE}, y={Northcote very small},
col sep=comma]{cossim.csv};%
end{groupplot}
end{tikzpicture}
end{document}
answered 1 hour ago
M. Al JumailyM. Al Jumaily
1,0561210
1,0561210
add a comment |
add a comment |
An alternative to previous two answers is anchoring the title text to top (north) and adding some distance between the titles and the plots with title style={anchor=north, yshift=2ex}
.
The reason for the problem is explained in Zarko's comment. That is why the title with "g" and "y" is higher than the other one. My solution is aligning the title text to top of the letters rather than to the bottom. But this cause the plot to overlap with the title. So we have to add some distance between them with yshift.
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
title style={anchor=north, yshift=2ex} % <--- FIX
]%
add a comment |
An alternative to previous two answers is anchoring the title text to top (north) and adding some distance between the titles and the plots with title style={anchor=north, yshift=2ex}
.
The reason for the problem is explained in Zarko's comment. That is why the title with "g" and "y" is higher than the other one. My solution is aligning the title text to top of the letters rather than to the bottom. But this cause the plot to overlap with the title. So we have to add some distance between them with yshift.
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
title style={anchor=north, yshift=2ex} % <--- FIX
]%
add a comment |
An alternative to previous two answers is anchoring the title text to top (north) and adding some distance between the titles and the plots with title style={anchor=north, yshift=2ex}
.
The reason for the problem is explained in Zarko's comment. That is why the title with "g" and "y" is higher than the other one. My solution is aligning the title text to top of the letters rather than to the bottom. But this cause the plot to overlap with the title. So we have to add some distance between them with yshift.
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
title style={anchor=north, yshift=2ex} % <--- FIX
]%
An alternative to previous two answers is anchoring the title text to top (north) and adding some distance between the titles and the plots with title style={anchor=north, yshift=2ex}
.
The reason for the problem is explained in Zarko's comment. That is why the title with "g" and "y" is higher than the other one. My solution is aligning the title text to top of the letters rather than to the bottom. But this cause the plot to overlap with the title. So we have to add some distance between them with yshift.
begin{groupplot}[%
group style={%
group name=QuantileError,%
group size= 2 by 1,%
horizontal sep = 0.1cm,
},%
width=0.3textwidth,
height=0.4textwidth,
legend cell align={left}, %
legend style={draw=white, fill=mygrey3},%
every axis label/.style={font=small},%
ticklabel style = {font=tiny},%
yticklabel style={/pgf/number
format/.cd,fixed,precision=4,zerofill,/tikz/.cd},%
x tick label style={rotate=90, anchor=east},
scaled x ticks=false,
xticklabel style={/pgf/number
format/.cd,fixed,precision=2,zerofill,/tikz/.cd},
title style={anchor=north, yshift=2ex} % <--- FIX
]%
edited 6 mins ago
answered 14 mins ago
NiroshanNiroshan
2311310
2311310
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f490898%2faligning-group-plot-titles-horizontally%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
1
because the "Northop" hasnt leter "y". if you will add
vphantom{y}
to it, words will become aligned as you like to have. however, you can definetitle
style in which you addtext depth=0.5ex
.– Zarko
1 hour ago