PGFPlots + TikZ: Stranger Beamer behavior
I am trying to include a PGFPlots
+ TikZ
figure in a beamer
presentation made with the metropolis
theme. If I compile the figure in a normal article
class (or standalone
), the figure is fine. The code for the figure is the following:
documentclass[tikz]{standalone}
usetikzlibrary{shapes}
usepackage{pgfplots}
pgfplotsset{compat=newest}
usepackage[utf8]{inputenc} % Required for including letters with accents
begin{document}
begin{tikzpicture}
begin{axis}[
width=textwidth,
height=8cm,
hide y axis,
axis x line*=bottom,
xtick={-3,-2,-1,0,1,2,3},
xticklabels={$bar x-3s$,$bar x-2s$,$bar x-s$,$bar x$,$bar x+s$,$bar x+2s$,$bar x+3s$},
xmin = -3.5,
xmax = 3.5,
ymin = 0,
ymax = 0.9,
]
draw[dashed] (axis cs:-3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-3,0.85);
draw[dashed] (axis cs:-2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-2,0.7);
draw[dashed] (axis cs:-1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-1,0.55);
draw[dashed] (axis cs:1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:1,0.55);
draw[dashed] (axis cs:2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:2,0.7);
draw[dashed] (axis cs:3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:3,0.85);
draw[stealth-stealth](-1,0.55) -- (1,0.55) node[midway,fill=white]{68%};
node at(0,0.5) {1 desviación};
node at(0,0.45) {estándar};
draw[stealth-stealth](-2,0.7) -- (2,0.7) node[midway,fill=white]{95%};
node at(0,0.65) {2 desviaciones estándar};
draw[stealth-stealth](-3,0.85) -- (3,0.85) node[midway,fill=white]{99.7%};
node at(0,0.8) {3 desviaciones estándar};
addplot[samples=201,ultra thick] {exp(-x^2/2)/sqrt(2*pi)};
draw[thick,dashed] (axis cs:0,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,{1/sqrt(2*pi)});
end{axis}
end{tikzpicture}
end{document}
This produces this figure:
If I now try to put that figure inside a beamer
presentation (using the metropolis theme
), the code I am using is:
%!TEX TS-program = xelatex
documentclass{beamer}
usetheme{metropolis} % Use metropolis theme
usepackage[utf8]{inputenc} % Required for including letters with accents
usepackage{tikz}
usetikzlibrary{shapes}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
begin{frame}{Test}
centering
begin{tikzpicture}
begin{axis}[
width=textwidth,
height=8cm,
hide y axis,
axis x line*=bottom,
xtick={-3,-2,-1,0,1,2,3},
xticklabels={$bar x-3s$,$bar x-2s$,$bar x-s$,$bar x$,$bar x+s$,$bar x+2s$,$bar x+3s$},
xmin = -3.5,
xmax = 3.5,
ymin = 0,
ymax = 0.9,
]
draw[dashed] (axis cs:-3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-3,0.85);
draw[dashed] (axis cs:-2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-2,0.7);
draw[dashed] (axis cs:-1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-1,0.55);
draw[dashed] (axis cs:1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:1,0.55);
draw[dashed] (axis cs:2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:2,0.7);
draw[dashed] (axis cs:3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:3,0.85);
draw[stealth-stealth](-1,0.55) -- (1,0.55) node[midway,fill=white]{68%};
node at(0,0.5) {1 desviación};
node at(0,0.45) {estándar};
draw[stealth-stealth](-2,0.7) -- (2,0.7) node[midway,fill=white]{95%};
node at(0,0.65) {2 desviaciones estándar};
draw[stealth-stealth](-3,0.85) -- (3,0.85) node[midway,fill=white]{99.7%};
node at(0,0.8) {3 desviaciones estándar};
addplot[samples=201,ultra thick] {exp(-x^2/2)/sqrt(2*pi)};
draw[thick,dashed] (axis cs:0,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,{1/sqrt(2*pi)});
end{axis}
end{tikzpicture}
end{frame}
end{document}
which produces this when compiled:
I have no clue about what is happening. Any help will be much appreciated.
tikz-pgf beamer pgfplots beamer-metropolis
add a comment |
I am trying to include a PGFPlots
+ TikZ
figure in a beamer
presentation made with the metropolis
theme. If I compile the figure in a normal article
class (or standalone
), the figure is fine. The code for the figure is the following:
documentclass[tikz]{standalone}
usetikzlibrary{shapes}
usepackage{pgfplots}
pgfplotsset{compat=newest}
usepackage[utf8]{inputenc} % Required for including letters with accents
begin{document}
begin{tikzpicture}
begin{axis}[
width=textwidth,
height=8cm,
hide y axis,
axis x line*=bottom,
xtick={-3,-2,-1,0,1,2,3},
xticklabels={$bar x-3s$,$bar x-2s$,$bar x-s$,$bar x$,$bar x+s$,$bar x+2s$,$bar x+3s$},
xmin = -3.5,
xmax = 3.5,
ymin = 0,
ymax = 0.9,
]
draw[dashed] (axis cs:-3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-3,0.85);
draw[dashed] (axis cs:-2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-2,0.7);
draw[dashed] (axis cs:-1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-1,0.55);
draw[dashed] (axis cs:1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:1,0.55);
draw[dashed] (axis cs:2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:2,0.7);
draw[dashed] (axis cs:3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:3,0.85);
draw[stealth-stealth](-1,0.55) -- (1,0.55) node[midway,fill=white]{68%};
node at(0,0.5) {1 desviación};
node at(0,0.45) {estándar};
draw[stealth-stealth](-2,0.7) -- (2,0.7) node[midway,fill=white]{95%};
node at(0,0.65) {2 desviaciones estándar};
draw[stealth-stealth](-3,0.85) -- (3,0.85) node[midway,fill=white]{99.7%};
node at(0,0.8) {3 desviaciones estándar};
addplot[samples=201,ultra thick] {exp(-x^2/2)/sqrt(2*pi)};
draw[thick,dashed] (axis cs:0,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,{1/sqrt(2*pi)});
end{axis}
end{tikzpicture}
end{document}
This produces this figure:
If I now try to put that figure inside a beamer
presentation (using the metropolis theme
), the code I am using is:
%!TEX TS-program = xelatex
documentclass{beamer}
usetheme{metropolis} % Use metropolis theme
usepackage[utf8]{inputenc} % Required for including letters with accents
usepackage{tikz}
usetikzlibrary{shapes}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
begin{frame}{Test}
centering
begin{tikzpicture}
begin{axis}[
width=textwidth,
height=8cm,
hide y axis,
axis x line*=bottom,
xtick={-3,-2,-1,0,1,2,3},
xticklabels={$bar x-3s$,$bar x-2s$,$bar x-s$,$bar x$,$bar x+s$,$bar x+2s$,$bar x+3s$},
xmin = -3.5,
xmax = 3.5,
ymin = 0,
ymax = 0.9,
]
draw[dashed] (axis cs:-3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-3,0.85);
draw[dashed] (axis cs:-2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-2,0.7);
draw[dashed] (axis cs:-1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-1,0.55);
draw[dashed] (axis cs:1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:1,0.55);
draw[dashed] (axis cs:2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:2,0.7);
draw[dashed] (axis cs:3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:3,0.85);
draw[stealth-stealth](-1,0.55) -- (1,0.55) node[midway,fill=white]{68%};
node at(0,0.5) {1 desviación};
node at(0,0.45) {estándar};
draw[stealth-stealth](-2,0.7) -- (2,0.7) node[midway,fill=white]{95%};
node at(0,0.65) {2 desviaciones estándar};
draw[stealth-stealth](-3,0.85) -- (3,0.85) node[midway,fill=white]{99.7%};
node at(0,0.8) {3 desviaciones estándar};
addplot[samples=201,ultra thick] {exp(-x^2/2)/sqrt(2*pi)};
draw[thick,dashed] (axis cs:0,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,{1/sqrt(2*pi)});
end{axis}
end{tikzpicture}
end{frame}
end{document}
which produces this when compiled:
I have no clue about what is happening. Any help will be much appreciated.
tikz-pgf beamer pgfplots beamer-metropolis
add a comment |
I am trying to include a PGFPlots
+ TikZ
figure in a beamer
presentation made with the metropolis
theme. If I compile the figure in a normal article
class (or standalone
), the figure is fine. The code for the figure is the following:
documentclass[tikz]{standalone}
usetikzlibrary{shapes}
usepackage{pgfplots}
pgfplotsset{compat=newest}
usepackage[utf8]{inputenc} % Required for including letters with accents
begin{document}
begin{tikzpicture}
begin{axis}[
width=textwidth,
height=8cm,
hide y axis,
axis x line*=bottom,
xtick={-3,-2,-1,0,1,2,3},
xticklabels={$bar x-3s$,$bar x-2s$,$bar x-s$,$bar x$,$bar x+s$,$bar x+2s$,$bar x+3s$},
xmin = -3.5,
xmax = 3.5,
ymin = 0,
ymax = 0.9,
]
draw[dashed] (axis cs:-3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-3,0.85);
draw[dashed] (axis cs:-2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-2,0.7);
draw[dashed] (axis cs:-1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-1,0.55);
draw[dashed] (axis cs:1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:1,0.55);
draw[dashed] (axis cs:2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:2,0.7);
draw[dashed] (axis cs:3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:3,0.85);
draw[stealth-stealth](-1,0.55) -- (1,0.55) node[midway,fill=white]{68%};
node at(0,0.5) {1 desviación};
node at(0,0.45) {estándar};
draw[stealth-stealth](-2,0.7) -- (2,0.7) node[midway,fill=white]{95%};
node at(0,0.65) {2 desviaciones estándar};
draw[stealth-stealth](-3,0.85) -- (3,0.85) node[midway,fill=white]{99.7%};
node at(0,0.8) {3 desviaciones estándar};
addplot[samples=201,ultra thick] {exp(-x^2/2)/sqrt(2*pi)};
draw[thick,dashed] (axis cs:0,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,{1/sqrt(2*pi)});
end{axis}
end{tikzpicture}
end{document}
This produces this figure:
If I now try to put that figure inside a beamer
presentation (using the metropolis theme
), the code I am using is:
%!TEX TS-program = xelatex
documentclass{beamer}
usetheme{metropolis} % Use metropolis theme
usepackage[utf8]{inputenc} % Required for including letters with accents
usepackage{tikz}
usetikzlibrary{shapes}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
begin{frame}{Test}
centering
begin{tikzpicture}
begin{axis}[
width=textwidth,
height=8cm,
hide y axis,
axis x line*=bottom,
xtick={-3,-2,-1,0,1,2,3},
xticklabels={$bar x-3s$,$bar x-2s$,$bar x-s$,$bar x$,$bar x+s$,$bar x+2s$,$bar x+3s$},
xmin = -3.5,
xmax = 3.5,
ymin = 0,
ymax = 0.9,
]
draw[dashed] (axis cs:-3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-3,0.85);
draw[dashed] (axis cs:-2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-2,0.7);
draw[dashed] (axis cs:-1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-1,0.55);
draw[dashed] (axis cs:1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:1,0.55);
draw[dashed] (axis cs:2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:2,0.7);
draw[dashed] (axis cs:3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:3,0.85);
draw[stealth-stealth](-1,0.55) -- (1,0.55) node[midway,fill=white]{68%};
node at(0,0.5) {1 desviación};
node at(0,0.45) {estándar};
draw[stealth-stealth](-2,0.7) -- (2,0.7) node[midway,fill=white]{95%};
node at(0,0.65) {2 desviaciones estándar};
draw[stealth-stealth](-3,0.85) -- (3,0.85) node[midway,fill=white]{99.7%};
node at(0,0.8) {3 desviaciones estándar};
addplot[samples=201,ultra thick] {exp(-x^2/2)/sqrt(2*pi)};
draw[thick,dashed] (axis cs:0,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,{1/sqrt(2*pi)});
end{axis}
end{tikzpicture}
end{frame}
end{document}
which produces this when compiled:
I have no clue about what is happening. Any help will be much appreciated.
tikz-pgf beamer pgfplots beamer-metropolis
I am trying to include a PGFPlots
+ TikZ
figure in a beamer
presentation made with the metropolis
theme. If I compile the figure in a normal article
class (or standalone
), the figure is fine. The code for the figure is the following:
documentclass[tikz]{standalone}
usetikzlibrary{shapes}
usepackage{pgfplots}
pgfplotsset{compat=newest}
usepackage[utf8]{inputenc} % Required for including letters with accents
begin{document}
begin{tikzpicture}
begin{axis}[
width=textwidth,
height=8cm,
hide y axis,
axis x line*=bottom,
xtick={-3,-2,-1,0,1,2,3},
xticklabels={$bar x-3s$,$bar x-2s$,$bar x-s$,$bar x$,$bar x+s$,$bar x+2s$,$bar x+3s$},
xmin = -3.5,
xmax = 3.5,
ymin = 0,
ymax = 0.9,
]
draw[dashed] (axis cs:-3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-3,0.85);
draw[dashed] (axis cs:-2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-2,0.7);
draw[dashed] (axis cs:-1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-1,0.55);
draw[dashed] (axis cs:1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:1,0.55);
draw[dashed] (axis cs:2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:2,0.7);
draw[dashed] (axis cs:3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:3,0.85);
draw[stealth-stealth](-1,0.55) -- (1,0.55) node[midway,fill=white]{68%};
node at(0,0.5) {1 desviación};
node at(0,0.45) {estándar};
draw[stealth-stealth](-2,0.7) -- (2,0.7) node[midway,fill=white]{95%};
node at(0,0.65) {2 desviaciones estándar};
draw[stealth-stealth](-3,0.85) -- (3,0.85) node[midway,fill=white]{99.7%};
node at(0,0.8) {3 desviaciones estándar};
addplot[samples=201,ultra thick] {exp(-x^2/2)/sqrt(2*pi)};
draw[thick,dashed] (axis cs:0,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,{1/sqrt(2*pi)});
end{axis}
end{tikzpicture}
end{document}
This produces this figure:
If I now try to put that figure inside a beamer
presentation (using the metropolis theme
), the code I am using is:
%!TEX TS-program = xelatex
documentclass{beamer}
usetheme{metropolis} % Use metropolis theme
usepackage[utf8]{inputenc} % Required for including letters with accents
usepackage{tikz}
usetikzlibrary{shapes}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
begin{frame}{Test}
centering
begin{tikzpicture}
begin{axis}[
width=textwidth,
height=8cm,
hide y axis,
axis x line*=bottom,
xtick={-3,-2,-1,0,1,2,3},
xticklabels={$bar x-3s$,$bar x-2s$,$bar x-s$,$bar x$,$bar x+s$,$bar x+2s$,$bar x+3s$},
xmin = -3.5,
xmax = 3.5,
ymin = 0,
ymax = 0.9,
]
draw[dashed] (axis cs:-3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-3,0.85);
draw[dashed] (axis cs:-2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-2,0.7);
draw[dashed] (axis cs:-1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-1,0.55);
draw[dashed] (axis cs:1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:1,0.55);
draw[dashed] (axis cs:2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:2,0.7);
draw[dashed] (axis cs:3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:3,0.85);
draw[stealth-stealth](-1,0.55) -- (1,0.55) node[midway,fill=white]{68%};
node at(0,0.5) {1 desviación};
node at(0,0.45) {estándar};
draw[stealth-stealth](-2,0.7) -- (2,0.7) node[midway,fill=white]{95%};
node at(0,0.65) {2 desviaciones estándar};
draw[stealth-stealth](-3,0.85) -- (3,0.85) node[midway,fill=white]{99.7%};
node at(0,0.8) {3 desviaciones estándar};
addplot[samples=201,ultra thick] {exp(-x^2/2)/sqrt(2*pi)};
draw[thick,dashed] (axis cs:0,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,{1/sqrt(2*pi)});
end{axis}
end{tikzpicture}
end{frame}
end{document}
which produces this when compiled:
I have no clue about what is happening. Any help will be much appreciated.
tikz-pgf beamer pgfplots beamer-metropolis
tikz-pgf beamer pgfplots beamer-metropolis
edited Jan 15 at 22:16
samcarter
87.9k797281
87.9k797281
asked Aug 23 '17 at 17:08
RAORAO
254
254
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
So after a bit of detective work, it turns out that the problem is caused by
- the metropolis theme
- and therein from the
pgfplotsthemetol
package which is loaded at the end of the peramble - which sets
pgfplotsset{compat=1.9}
as a workaround, use pgfplotsset{compat=newest}
after begin{document}
%!TEX TS-program = xelatex
documentclass{beamer}
usetheme{metropolis} % Use metropolis theme
%
usepackage[utf8]{inputenc} % Required for including letters with accents
usepackage{tikz}
usetikzlibrary{shapes}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
pgfplotsset{compat=newest}
begin{frame}{Test}
centering
begin{tikzpicture}[x=1cm,y=1cm]
begin{axis}[
width=textwidth,
height=8cm,
hide y axis,
axis x line*=bottom,
xtick={-3,-2,-1,0,1,2,3},
xticklabels={$bar x-3s$,$bar x-2s$,$bar x-s$,$bar x$,$bar x+s$,$bar x+2s$,$bar x+3s$},
xmin = -3.5,
xmax = 3.5,
ymin = 0,
ymax = 0.9,
]
draw[dashed] (axis cs:-3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-3,0.85);
draw[dashed] (axis cs:-2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-2,0.7);
draw[dashed] (axis cs:-1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-1,0.55);
draw[dashed] (axis cs:1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:1,0.55);
draw[dashed] (axis cs:2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:2,0.7);
draw[dashed] (axis cs:3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:3,0.85);
begin{scope}
draw[stealth-stealth](-1,0.55) -- (1,0.55) node[midway,fill=white]{68%};
node at(0,0.5) {1 desviación};
node at(0,0.45) {estándar};
draw[stealth-stealth](-2,0.7) -- (2,0.7) node[midway,fill=white]{95%};
node at(0,0.65) {2 desviaciones estándar};
draw[stealth-stealth](-3,0.85) -- (3,0.85) node[midway,fill=white]{99.7%};
node at(0,0.8) {3 desviaciones estándar};
end{scope}
addplot[samples=201,ultra thick] {exp(-x^2/2)/sqrt(2*pi)};
draw[thick,dashed] (axis cs:0,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,{1/sqrt(2*pi)});
end{axis}
end{tikzpicture}
end{frame}
end{document}
Thank you very much @samcarter! Indeed this solved the problem. I will warn themetropolis
developers. I have no idea how theLaTeX
engine works but shouldn'tpgfplotsset{compat=newest}
override any previous version statement, even putting it in the preamble?
– RAO
Aug 24 '17 at 7:48
@RAO It does overwrite the previous statement, but metropolis instructs to loadpgfplotsset{compat=1.9}
at the end of the preamble and thus overwrites your statement which was issued before.
– samcarter
Aug 24 '17 at 8:19
Oh I see. I will ask themetropolis
developers to have a look at it. Thank you very much!
– RAO
Aug 24 '17 at 10:05
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%2f387870%2fpgfplots-tikz-stranger-beamer-behavior%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
So after a bit of detective work, it turns out that the problem is caused by
- the metropolis theme
- and therein from the
pgfplotsthemetol
package which is loaded at the end of the peramble - which sets
pgfplotsset{compat=1.9}
as a workaround, use pgfplotsset{compat=newest}
after begin{document}
%!TEX TS-program = xelatex
documentclass{beamer}
usetheme{metropolis} % Use metropolis theme
%
usepackage[utf8]{inputenc} % Required for including letters with accents
usepackage{tikz}
usetikzlibrary{shapes}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
pgfplotsset{compat=newest}
begin{frame}{Test}
centering
begin{tikzpicture}[x=1cm,y=1cm]
begin{axis}[
width=textwidth,
height=8cm,
hide y axis,
axis x line*=bottom,
xtick={-3,-2,-1,0,1,2,3},
xticklabels={$bar x-3s$,$bar x-2s$,$bar x-s$,$bar x$,$bar x+s$,$bar x+2s$,$bar x+3s$},
xmin = -3.5,
xmax = 3.5,
ymin = 0,
ymax = 0.9,
]
draw[dashed] (axis cs:-3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-3,0.85);
draw[dashed] (axis cs:-2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-2,0.7);
draw[dashed] (axis cs:-1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-1,0.55);
draw[dashed] (axis cs:1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:1,0.55);
draw[dashed] (axis cs:2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:2,0.7);
draw[dashed] (axis cs:3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:3,0.85);
begin{scope}
draw[stealth-stealth](-1,0.55) -- (1,0.55) node[midway,fill=white]{68%};
node at(0,0.5) {1 desviación};
node at(0,0.45) {estándar};
draw[stealth-stealth](-2,0.7) -- (2,0.7) node[midway,fill=white]{95%};
node at(0,0.65) {2 desviaciones estándar};
draw[stealth-stealth](-3,0.85) -- (3,0.85) node[midway,fill=white]{99.7%};
node at(0,0.8) {3 desviaciones estándar};
end{scope}
addplot[samples=201,ultra thick] {exp(-x^2/2)/sqrt(2*pi)};
draw[thick,dashed] (axis cs:0,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,{1/sqrt(2*pi)});
end{axis}
end{tikzpicture}
end{frame}
end{document}
Thank you very much @samcarter! Indeed this solved the problem. I will warn themetropolis
developers. I have no idea how theLaTeX
engine works but shouldn'tpgfplotsset{compat=newest}
override any previous version statement, even putting it in the preamble?
– RAO
Aug 24 '17 at 7:48
@RAO It does overwrite the previous statement, but metropolis instructs to loadpgfplotsset{compat=1.9}
at the end of the preamble and thus overwrites your statement which was issued before.
– samcarter
Aug 24 '17 at 8:19
Oh I see. I will ask themetropolis
developers to have a look at it. Thank you very much!
– RAO
Aug 24 '17 at 10:05
add a comment |
So after a bit of detective work, it turns out that the problem is caused by
- the metropolis theme
- and therein from the
pgfplotsthemetol
package which is loaded at the end of the peramble - which sets
pgfplotsset{compat=1.9}
as a workaround, use pgfplotsset{compat=newest}
after begin{document}
%!TEX TS-program = xelatex
documentclass{beamer}
usetheme{metropolis} % Use metropolis theme
%
usepackage[utf8]{inputenc} % Required for including letters with accents
usepackage{tikz}
usetikzlibrary{shapes}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
pgfplotsset{compat=newest}
begin{frame}{Test}
centering
begin{tikzpicture}[x=1cm,y=1cm]
begin{axis}[
width=textwidth,
height=8cm,
hide y axis,
axis x line*=bottom,
xtick={-3,-2,-1,0,1,2,3},
xticklabels={$bar x-3s$,$bar x-2s$,$bar x-s$,$bar x$,$bar x+s$,$bar x+2s$,$bar x+3s$},
xmin = -3.5,
xmax = 3.5,
ymin = 0,
ymax = 0.9,
]
draw[dashed] (axis cs:-3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-3,0.85);
draw[dashed] (axis cs:-2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-2,0.7);
draw[dashed] (axis cs:-1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-1,0.55);
draw[dashed] (axis cs:1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:1,0.55);
draw[dashed] (axis cs:2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:2,0.7);
draw[dashed] (axis cs:3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:3,0.85);
begin{scope}
draw[stealth-stealth](-1,0.55) -- (1,0.55) node[midway,fill=white]{68%};
node at(0,0.5) {1 desviación};
node at(0,0.45) {estándar};
draw[stealth-stealth](-2,0.7) -- (2,0.7) node[midway,fill=white]{95%};
node at(0,0.65) {2 desviaciones estándar};
draw[stealth-stealth](-3,0.85) -- (3,0.85) node[midway,fill=white]{99.7%};
node at(0,0.8) {3 desviaciones estándar};
end{scope}
addplot[samples=201,ultra thick] {exp(-x^2/2)/sqrt(2*pi)};
draw[thick,dashed] (axis cs:0,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,{1/sqrt(2*pi)});
end{axis}
end{tikzpicture}
end{frame}
end{document}
Thank you very much @samcarter! Indeed this solved the problem. I will warn themetropolis
developers. I have no idea how theLaTeX
engine works but shouldn'tpgfplotsset{compat=newest}
override any previous version statement, even putting it in the preamble?
– RAO
Aug 24 '17 at 7:48
@RAO It does overwrite the previous statement, but metropolis instructs to loadpgfplotsset{compat=1.9}
at the end of the preamble and thus overwrites your statement which was issued before.
– samcarter
Aug 24 '17 at 8:19
Oh I see. I will ask themetropolis
developers to have a look at it. Thank you very much!
– RAO
Aug 24 '17 at 10:05
add a comment |
So after a bit of detective work, it turns out that the problem is caused by
- the metropolis theme
- and therein from the
pgfplotsthemetol
package which is loaded at the end of the peramble - which sets
pgfplotsset{compat=1.9}
as a workaround, use pgfplotsset{compat=newest}
after begin{document}
%!TEX TS-program = xelatex
documentclass{beamer}
usetheme{metropolis} % Use metropolis theme
%
usepackage[utf8]{inputenc} % Required for including letters with accents
usepackage{tikz}
usetikzlibrary{shapes}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
pgfplotsset{compat=newest}
begin{frame}{Test}
centering
begin{tikzpicture}[x=1cm,y=1cm]
begin{axis}[
width=textwidth,
height=8cm,
hide y axis,
axis x line*=bottom,
xtick={-3,-2,-1,0,1,2,3},
xticklabels={$bar x-3s$,$bar x-2s$,$bar x-s$,$bar x$,$bar x+s$,$bar x+2s$,$bar x+3s$},
xmin = -3.5,
xmax = 3.5,
ymin = 0,
ymax = 0.9,
]
draw[dashed] (axis cs:-3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-3,0.85);
draw[dashed] (axis cs:-2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-2,0.7);
draw[dashed] (axis cs:-1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-1,0.55);
draw[dashed] (axis cs:1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:1,0.55);
draw[dashed] (axis cs:2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:2,0.7);
draw[dashed] (axis cs:3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:3,0.85);
begin{scope}
draw[stealth-stealth](-1,0.55) -- (1,0.55) node[midway,fill=white]{68%};
node at(0,0.5) {1 desviación};
node at(0,0.45) {estándar};
draw[stealth-stealth](-2,0.7) -- (2,0.7) node[midway,fill=white]{95%};
node at(0,0.65) {2 desviaciones estándar};
draw[stealth-stealth](-3,0.85) -- (3,0.85) node[midway,fill=white]{99.7%};
node at(0,0.8) {3 desviaciones estándar};
end{scope}
addplot[samples=201,ultra thick] {exp(-x^2/2)/sqrt(2*pi)};
draw[thick,dashed] (axis cs:0,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,{1/sqrt(2*pi)});
end{axis}
end{tikzpicture}
end{frame}
end{document}
So after a bit of detective work, it turns out that the problem is caused by
- the metropolis theme
- and therein from the
pgfplotsthemetol
package which is loaded at the end of the peramble - which sets
pgfplotsset{compat=1.9}
as a workaround, use pgfplotsset{compat=newest}
after begin{document}
%!TEX TS-program = xelatex
documentclass{beamer}
usetheme{metropolis} % Use metropolis theme
%
usepackage[utf8]{inputenc} % Required for including letters with accents
usepackage{tikz}
usetikzlibrary{shapes}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
pgfplotsset{compat=newest}
begin{frame}{Test}
centering
begin{tikzpicture}[x=1cm,y=1cm]
begin{axis}[
width=textwidth,
height=8cm,
hide y axis,
axis x line*=bottom,
xtick={-3,-2,-1,0,1,2,3},
xticklabels={$bar x-3s$,$bar x-2s$,$bar x-s$,$bar x$,$bar x+s$,$bar x+2s$,$bar x+3s$},
xmin = -3.5,
xmax = 3.5,
ymin = 0,
ymax = 0.9,
]
draw[dashed] (axis cs:-3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-3,0.85);
draw[dashed] (axis cs:-2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-2,0.7);
draw[dashed] (axis cs:-1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:-1,0.55);
draw[dashed] (axis cs:1,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:1,0.55);
draw[dashed] (axis cs:2,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:2,0.7);
draw[dashed] (axis cs:3,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:3,0.85);
begin{scope}
draw[stealth-stealth](-1,0.55) -- (1,0.55) node[midway,fill=white]{68%};
node at(0,0.5) {1 desviación};
node at(0,0.45) {estándar};
draw[stealth-stealth](-2,0.7) -- (2,0.7) node[midway,fill=white]{95%};
node at(0,0.65) {2 desviaciones estándar};
draw[stealth-stealth](-3,0.85) -- (3,0.85) node[midway,fill=white]{99.7%};
node at(0,0.8) {3 desviaciones estándar};
end{scope}
addplot[samples=201,ultra thick] {exp(-x^2/2)/sqrt(2*pi)};
draw[thick,dashed] (axis cs:0,pgfkeysvalueof{/pgfplots/ymin}) -- (axis cs:0,{1/sqrt(2*pi)});
end{axis}
end{tikzpicture}
end{frame}
end{document}
answered Aug 23 '17 at 17:36
samcartersamcarter
87.9k797281
87.9k797281
Thank you very much @samcarter! Indeed this solved the problem. I will warn themetropolis
developers. I have no idea how theLaTeX
engine works but shouldn'tpgfplotsset{compat=newest}
override any previous version statement, even putting it in the preamble?
– RAO
Aug 24 '17 at 7:48
@RAO It does overwrite the previous statement, but metropolis instructs to loadpgfplotsset{compat=1.9}
at the end of the preamble and thus overwrites your statement which was issued before.
– samcarter
Aug 24 '17 at 8:19
Oh I see. I will ask themetropolis
developers to have a look at it. Thank you very much!
– RAO
Aug 24 '17 at 10:05
add a comment |
Thank you very much @samcarter! Indeed this solved the problem. I will warn themetropolis
developers. I have no idea how theLaTeX
engine works but shouldn'tpgfplotsset{compat=newest}
override any previous version statement, even putting it in the preamble?
– RAO
Aug 24 '17 at 7:48
@RAO It does overwrite the previous statement, but metropolis instructs to loadpgfplotsset{compat=1.9}
at the end of the preamble and thus overwrites your statement which was issued before.
– samcarter
Aug 24 '17 at 8:19
Oh I see. I will ask themetropolis
developers to have a look at it. Thank you very much!
– RAO
Aug 24 '17 at 10:05
Thank you very much @samcarter! Indeed this solved the problem. I will warn the
metropolis
developers. I have no idea how the LaTeX
engine works but shouldn't pgfplotsset{compat=newest}
override any previous version statement, even putting it in the preamble?– RAO
Aug 24 '17 at 7:48
Thank you very much @samcarter! Indeed this solved the problem. I will warn the
metropolis
developers. I have no idea how the LaTeX
engine works but shouldn't pgfplotsset{compat=newest}
override any previous version statement, even putting it in the preamble?– RAO
Aug 24 '17 at 7:48
@RAO It does overwrite the previous statement, but metropolis instructs to load
pgfplotsset{compat=1.9}
at the end of the preamble and thus overwrites your statement which was issued before.– samcarter
Aug 24 '17 at 8:19
@RAO It does overwrite the previous statement, but metropolis instructs to load
pgfplotsset{compat=1.9}
at the end of the preamble and thus overwrites your statement which was issued before.– samcarter
Aug 24 '17 at 8:19
Oh I see. I will ask the
metropolis
developers to have a look at it. Thank you very much!– RAO
Aug 24 '17 at 10:05
Oh I see. I will ask the
metropolis
developers to have a look at it. Thank you very much!– RAO
Aug 24 '17 at 10:05
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%2f387870%2fpgfplots-tikz-stranger-beamer-behavior%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