Dynamically hide and show Plots
I would like to know if it's possible to do something like this, using axis in tikzpicture:

I'm currently ploting curves this way :
documentclass{article}
usepackage[latin1]{inputenc}
usepackage[T1]{fontenc}
usepackage[french]{babel}
usepackage{pgf,tikz}
usetikzlibrary{fit}
usetikzlibrary{arrows,patterns}
usepackage{amsmath,siunitx,xcolor}
usepackage{pgfplotstable,pgfplots,filecontents}
pgfplotsset{compat=1.6} %Update pgfplots package version.
usepackage{lscape,rotating,pdflscape}
begin{document}
begin{landscape}
begin{tikzpicture}
begin{axis}[
width=22cm,height=12cm,
legend columns=1,grid=both, legend cell align={left},
ymin=-4,ymax=4,xmin=0,xmax=4,
xlabel = Lenght L (m),ylabel = Wave amplitude A (-),
]
addplot[domain=0:4,samples=200,red] {2*sin(2*pi/4*deg(x))};
addplot[domain=0:4,samples=200,blue] {2*sin(2*pi/5*deg((x))};
addlegendentry{Wave1}
addlegendentry{Wave2}
end{axis}
end{tikzpicture}
end{landscape}
end{document}
tikz-pgf interaction
|
show 10 more comments
I would like to know if it's possible to do something like this, using axis in tikzpicture:

I'm currently ploting curves this way :
documentclass{article}
usepackage[latin1]{inputenc}
usepackage[T1]{fontenc}
usepackage[french]{babel}
usepackage{pgf,tikz}
usetikzlibrary{fit}
usetikzlibrary{arrows,patterns}
usepackage{amsmath,siunitx,xcolor}
usepackage{pgfplotstable,pgfplots,filecontents}
pgfplotsset{compat=1.6} %Update pgfplots package version.
usepackage{lscape,rotating,pdflscape}
begin{document}
begin{landscape}
begin{tikzpicture}
begin{axis}[
width=22cm,height=12cm,
legend columns=1,grid=both, legend cell align={left},
ymin=-4,ymax=4,xmin=0,xmax=4,
xlabel = Lenght L (m),ylabel = Wave amplitude A (-),
]
addplot[domain=0:4,samples=200,red] {2*sin(2*pi/4*deg(x))};
addplot[domain=0:4,samples=200,blue] {2*sin(2*pi/5*deg((x))};
addlegendentry{Wave1}
addlegendentry{Wave2}
end{axis}
end{tikzpicture}
end{landscape}
end{document}
tikz-pgf interaction
@JouleV Sadly nothing, I would like some help to start working on this (maybe a specific package or something else).
– joseldsm
12 hours ago
1
As you can see: I misunderstood your question. Please explain your question furthuer, and maybe a sketch of what you want to achieve.
– JouleV
12 hours ago
3
I am not sure that's possible without having a multipage pdf with all possible combinations of on and off. With a multipage pdf it is certainly possible, this is how the beamer buttons work. And sorry, your example is not particular useful. Apart from missing the preamble andend{document}you are loading data that no one has (in order to plot seemingly straight lines...).
– marmot
11 hours ago
1
@marmot, exactly what I am doing, but withi,j,k... :-)
– Sigur
11 hours ago
1
@marmot, oh, just now I saw that OP didn't provide the csv data.
– Sigur
11 hours ago
|
show 10 more comments
I would like to know if it's possible to do something like this, using axis in tikzpicture:

I'm currently ploting curves this way :
documentclass{article}
usepackage[latin1]{inputenc}
usepackage[T1]{fontenc}
usepackage[french]{babel}
usepackage{pgf,tikz}
usetikzlibrary{fit}
usetikzlibrary{arrows,patterns}
usepackage{amsmath,siunitx,xcolor}
usepackage{pgfplotstable,pgfplots,filecontents}
pgfplotsset{compat=1.6} %Update pgfplots package version.
usepackage{lscape,rotating,pdflscape}
begin{document}
begin{landscape}
begin{tikzpicture}
begin{axis}[
width=22cm,height=12cm,
legend columns=1,grid=both, legend cell align={left},
ymin=-4,ymax=4,xmin=0,xmax=4,
xlabel = Lenght L (m),ylabel = Wave amplitude A (-),
]
addplot[domain=0:4,samples=200,red] {2*sin(2*pi/4*deg(x))};
addplot[domain=0:4,samples=200,blue] {2*sin(2*pi/5*deg((x))};
addlegendentry{Wave1}
addlegendentry{Wave2}
end{axis}
end{tikzpicture}
end{landscape}
end{document}
tikz-pgf interaction
I would like to know if it's possible to do something like this, using axis in tikzpicture:

I'm currently ploting curves this way :
documentclass{article}
usepackage[latin1]{inputenc}
usepackage[T1]{fontenc}
usepackage[french]{babel}
usepackage{pgf,tikz}
usetikzlibrary{fit}
usetikzlibrary{arrows,patterns}
usepackage{amsmath,siunitx,xcolor}
usepackage{pgfplotstable,pgfplots,filecontents}
pgfplotsset{compat=1.6} %Update pgfplots package version.
usepackage{lscape,rotating,pdflscape}
begin{document}
begin{landscape}
begin{tikzpicture}
begin{axis}[
width=22cm,height=12cm,
legend columns=1,grid=both, legend cell align={left},
ymin=-4,ymax=4,xmin=0,xmax=4,
xlabel = Lenght L (m),ylabel = Wave amplitude A (-),
]
addplot[domain=0:4,samples=200,red] {2*sin(2*pi/4*deg(x))};
addplot[domain=0:4,samples=200,blue] {2*sin(2*pi/5*deg((x))};
addlegendentry{Wave1}
addlegendentry{Wave2}
end{axis}
end{tikzpicture}
end{landscape}
end{document}
tikz-pgf interaction
tikz-pgf interaction
edited 7 hours ago
AndréC
9,08411447
9,08411447
asked 12 hours ago
joseldsmjoseldsm
837
837
@JouleV Sadly nothing, I would like some help to start working on this (maybe a specific package or something else).
– joseldsm
12 hours ago
1
As you can see: I misunderstood your question. Please explain your question furthuer, and maybe a sketch of what you want to achieve.
– JouleV
12 hours ago
3
I am not sure that's possible without having a multipage pdf with all possible combinations of on and off. With a multipage pdf it is certainly possible, this is how the beamer buttons work. And sorry, your example is not particular useful. Apart from missing the preamble andend{document}you are loading data that no one has (in order to plot seemingly straight lines...).
– marmot
11 hours ago
1
@marmot, exactly what I am doing, but withi,j,k... :-)
– Sigur
11 hours ago
1
@marmot, oh, just now I saw that OP didn't provide the csv data.
– Sigur
11 hours ago
|
show 10 more comments
@JouleV Sadly nothing, I would like some help to start working on this (maybe a specific package or something else).
– joseldsm
12 hours ago
1
As you can see: I misunderstood your question. Please explain your question furthuer, and maybe a sketch of what you want to achieve.
– JouleV
12 hours ago
3
I am not sure that's possible without having a multipage pdf with all possible combinations of on and off. With a multipage pdf it is certainly possible, this is how the beamer buttons work. And sorry, your example is not particular useful. Apart from missing the preamble andend{document}you are loading data that no one has (in order to plot seemingly straight lines...).
– marmot
11 hours ago
1
@marmot, exactly what I am doing, but withi,j,k... :-)
– Sigur
11 hours ago
1
@marmot, oh, just now I saw that OP didn't provide the csv data.
– Sigur
11 hours ago
@JouleV Sadly nothing, I would like some help to start working on this (maybe a specific package or something else).
– joseldsm
12 hours ago
@JouleV Sadly nothing, I would like some help to start working on this (maybe a specific package or something else).
– joseldsm
12 hours ago
1
1
As you can see: I misunderstood your question. Please explain your question furthuer, and maybe a sketch of what you want to achieve.
– JouleV
12 hours ago
As you can see: I misunderstood your question. Please explain your question furthuer, and maybe a sketch of what you want to achieve.
– JouleV
12 hours ago
3
3
I am not sure that's possible without having a multipage pdf with all possible combinations of on and off. With a multipage pdf it is certainly possible, this is how the beamer buttons work. And sorry, your example is not particular useful. Apart from missing the preamble and
end{document} you are loading data that no one has (in order to plot seemingly straight lines...).– marmot
11 hours ago
I am not sure that's possible without having a multipage pdf with all possible combinations of on and off. With a multipage pdf it is certainly possible, this is how the beamer buttons work. And sorry, your example is not particular useful. Apart from missing the preamble and
end{document} you are loading data that no one has (in order to plot seemingly straight lines...).– marmot
11 hours ago
1
1
@marmot, exactly what I am doing, but with
i,j,k... :-)– Sigur
11 hours ago
@marmot, exactly what I am doing, but with
i,j,k... :-)– Sigur
11 hours ago
1
1
@marmot, oh, just now I saw that OP didn't provide the csv data.
– Sigur
11 hours ago
@marmot, oh, just now I saw that OP didn't provide the csv data.
– Sigur
11 hours ago
|
show 10 more comments
2 Answers
2
active
oldest
votes
To be compiled twice. Use Adobe Reader, Foxit Reader, (evince ?) or PDF readers that manage OCG layers.
I simply adapted the code of the example given in the ocgx and ocgx2 package.
I'll leave it to you to do the finishing touches.
documentclass{article}
usepackage[latin1]{inputenc}
usepackage[T1]{fontenc}
usepackage[french]{babel}
usepackage{lmodern}
usepackage[top=1.5cm, bottom=4cm, left=2cm, right=2cm]{geometry}
%usepackage{pgf,tikz}
usepackage[tikz]{ocgx2}
usetikzlibrary{backgrounds,calc,shadows,chains,shapes.geometric}
usetikzlibrary{fit}
usetikzlibrary{matrix}
usetikzlibrary{arrows,patterns}
usepackage{amsmath,siunitx,xcolor}
usepackage{pgfplotstable,pgfplots,filecontents}
pgfplotsset{compat=1.6} %Update pgfplots package version.
usepackage{calculator,float}
usepackage{lscape,rotating,pdflscape}
tikzset{%
button on/.style={%
draw,minimum size=5mm,
line width=1pt,
fill=blue!50,rounded corners,
switch ocg with mark on={#1}{},
},
}
begin{document}
begin{landscape}
begin{figure}[H]
begin{tikzpicture}
begin{axis}[
width=22cm,height=12cm,
legend columns=1,grid=both, legend cell align={left},
ymin=-4,ymax=4,xmin=0,xmax=4,
xlabel = Lenght L (m),ylabel = Wave amplitude A (-),
]
begin{scope}[ocg={name=Wawe1 example,ref=Wawe1,status=invisible}]
addplot[domain=0:4,samples=200,red] {2*sin(2*pi/4*deg(x))};
end{scope}
begin{scope}[ocg={name=Wawe2 example,ref=Wawe2,status=invisible}]
addplot[domain=0:4,samples=200,blue] {2*sin(2*pi/5*deg((x))};
end{scope}
addlegendentry{Wave1}
addlegendentry{Wave2}
end{axis}
node[button on=Wawe1]at (-2,10)(but){};
node[right=0 of but]{Wawe1};
node[below=3pt of but,button on=Wawe2](but){};
node[right=0 of but]{Wawe2};
end{tikzpicture}
end{figure}
end{landscape}
end{document}

Very nice!pagestyle{empty}would be good.
– Sigur
10 hours ago
With evince in Linux Mint, in full screen mode, the button does not work, since when clicked on it, it goes to next page, that is, end of file. Maybe a problem with my evince.
– Sigur
10 hours ago
I don't have evince and therefore I can't test. This compatibility is the one given by Paul Gaborit in his demo of theocgxpackage here: mirrors.rit.edu/CTAN/macros/latex/contrib/ocgx/demo-ocgx.pdf pagestyle{empty} would be good but it's his MWE
– AndréC
9 hours ago
add a comment |
For 2 functions we have 2^2=4 possibilities. for more functions, the code would be much complicated.
In full screen mode, click on the check mark to navigate to pdf page and see the functions.


M(W)E
documentclass[tikz,margin=2mm]{standalone}
usepackage{pgfplots,amssymb}
usepackage[hidelinks]{hyperref}
newcommand{colorOn}{green!80!black}
newcommand{colorOff}{black!30}
begin{document}
foreach i in {0,1}{
foreach j in {0,1}{
begin{tikzpicture}
begin{axis}[
width=22cm,height=12cm,
legend columns=1,grid=both, legend cell align={left},
ymin=-4,ymax=4,xmin=0,xmax=4,
xlabel = Lenght $L$ (m), ylabel = Wave amplitude $A$ (-),
]
ifnum i=1
addplot[domain=0:4,samples=200,red] {2*sin(2*pi/4*deg(x))};
addlegendentry{Wave1}
fi
ifnum j=1
addplot[domain=0:4,samples=200,blue] {2*sin(2*pi/5*deg((x))};
addlegendentry{Wave2}
fi
end{axis}
node[anchor=east,minimum width=4cm] (f) at (-2,6) {%
$f(x)=2sin(frac{2pi}{4}deg(x))$
ifnum i=0
ifnum j=0
hypertarget{fOffgOff}{}%
hyperlink{fOngOff}{textcolor{colorOff}{checkmark}}
else
hypertarget{fOffgOn}{}%
hyperlink{fOngOn} {textcolor{colorOff}{checkmark}}
fi
else
ifnum j=0
hypertarget{fOngOff}{}%
hyperlink{fOffgOff}{textcolor{colorOn}{checkmark}}
else
hypertarget{fOngOn}{}%
hyperlink{fOffgOn} {textcolor{colorOn}{checkmark}}
fi
fi
};
node[below of=f] (g) {%
$g(x)=2sin(frac{2pi}{5}deg(x))$
ifnum i=0
ifnum j=0
hyperlink{fOffgOn}{textcolor{colorOff}{checkmark}}
else
hyperlink{fOffgOff} {textcolor{colorOn}{checkmark}}
fi
else
ifnum j=0
hyperlink{fOngOn}{textcolor{colorOff}{checkmark}}
else
hyperlink{fOngOff} {textcolor{colorOn}{checkmark}}
fi
fi
};
end{tikzpicture}
}}
end{document}
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%2f474860%2fdynamically-hide-and-show-plots%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
To be compiled twice. Use Adobe Reader, Foxit Reader, (evince ?) or PDF readers that manage OCG layers.
I simply adapted the code of the example given in the ocgx and ocgx2 package.
I'll leave it to you to do the finishing touches.
documentclass{article}
usepackage[latin1]{inputenc}
usepackage[T1]{fontenc}
usepackage[french]{babel}
usepackage{lmodern}
usepackage[top=1.5cm, bottom=4cm, left=2cm, right=2cm]{geometry}
%usepackage{pgf,tikz}
usepackage[tikz]{ocgx2}
usetikzlibrary{backgrounds,calc,shadows,chains,shapes.geometric}
usetikzlibrary{fit}
usetikzlibrary{matrix}
usetikzlibrary{arrows,patterns}
usepackage{amsmath,siunitx,xcolor}
usepackage{pgfplotstable,pgfplots,filecontents}
pgfplotsset{compat=1.6} %Update pgfplots package version.
usepackage{calculator,float}
usepackage{lscape,rotating,pdflscape}
tikzset{%
button on/.style={%
draw,minimum size=5mm,
line width=1pt,
fill=blue!50,rounded corners,
switch ocg with mark on={#1}{},
},
}
begin{document}
begin{landscape}
begin{figure}[H]
begin{tikzpicture}
begin{axis}[
width=22cm,height=12cm,
legend columns=1,grid=both, legend cell align={left},
ymin=-4,ymax=4,xmin=0,xmax=4,
xlabel = Lenght L (m),ylabel = Wave amplitude A (-),
]
begin{scope}[ocg={name=Wawe1 example,ref=Wawe1,status=invisible}]
addplot[domain=0:4,samples=200,red] {2*sin(2*pi/4*deg(x))};
end{scope}
begin{scope}[ocg={name=Wawe2 example,ref=Wawe2,status=invisible}]
addplot[domain=0:4,samples=200,blue] {2*sin(2*pi/5*deg((x))};
end{scope}
addlegendentry{Wave1}
addlegendentry{Wave2}
end{axis}
node[button on=Wawe1]at (-2,10)(but){};
node[right=0 of but]{Wawe1};
node[below=3pt of but,button on=Wawe2](but){};
node[right=0 of but]{Wawe2};
end{tikzpicture}
end{figure}
end{landscape}
end{document}

Very nice!pagestyle{empty}would be good.
– Sigur
10 hours ago
With evince in Linux Mint, in full screen mode, the button does not work, since when clicked on it, it goes to next page, that is, end of file. Maybe a problem with my evince.
– Sigur
10 hours ago
I don't have evince and therefore I can't test. This compatibility is the one given by Paul Gaborit in his demo of theocgxpackage here: mirrors.rit.edu/CTAN/macros/latex/contrib/ocgx/demo-ocgx.pdf pagestyle{empty} would be good but it's his MWE
– AndréC
9 hours ago
add a comment |
To be compiled twice. Use Adobe Reader, Foxit Reader, (evince ?) or PDF readers that manage OCG layers.
I simply adapted the code of the example given in the ocgx and ocgx2 package.
I'll leave it to you to do the finishing touches.
documentclass{article}
usepackage[latin1]{inputenc}
usepackage[T1]{fontenc}
usepackage[french]{babel}
usepackage{lmodern}
usepackage[top=1.5cm, bottom=4cm, left=2cm, right=2cm]{geometry}
%usepackage{pgf,tikz}
usepackage[tikz]{ocgx2}
usetikzlibrary{backgrounds,calc,shadows,chains,shapes.geometric}
usetikzlibrary{fit}
usetikzlibrary{matrix}
usetikzlibrary{arrows,patterns}
usepackage{amsmath,siunitx,xcolor}
usepackage{pgfplotstable,pgfplots,filecontents}
pgfplotsset{compat=1.6} %Update pgfplots package version.
usepackage{calculator,float}
usepackage{lscape,rotating,pdflscape}
tikzset{%
button on/.style={%
draw,minimum size=5mm,
line width=1pt,
fill=blue!50,rounded corners,
switch ocg with mark on={#1}{},
},
}
begin{document}
begin{landscape}
begin{figure}[H]
begin{tikzpicture}
begin{axis}[
width=22cm,height=12cm,
legend columns=1,grid=both, legend cell align={left},
ymin=-4,ymax=4,xmin=0,xmax=4,
xlabel = Lenght L (m),ylabel = Wave amplitude A (-),
]
begin{scope}[ocg={name=Wawe1 example,ref=Wawe1,status=invisible}]
addplot[domain=0:4,samples=200,red] {2*sin(2*pi/4*deg(x))};
end{scope}
begin{scope}[ocg={name=Wawe2 example,ref=Wawe2,status=invisible}]
addplot[domain=0:4,samples=200,blue] {2*sin(2*pi/5*deg((x))};
end{scope}
addlegendentry{Wave1}
addlegendentry{Wave2}
end{axis}
node[button on=Wawe1]at (-2,10)(but){};
node[right=0 of but]{Wawe1};
node[below=3pt of but,button on=Wawe2](but){};
node[right=0 of but]{Wawe2};
end{tikzpicture}
end{figure}
end{landscape}
end{document}

Very nice!pagestyle{empty}would be good.
– Sigur
10 hours ago
With evince in Linux Mint, in full screen mode, the button does not work, since when clicked on it, it goes to next page, that is, end of file. Maybe a problem with my evince.
– Sigur
10 hours ago
I don't have evince and therefore I can't test. This compatibility is the one given by Paul Gaborit in his demo of theocgxpackage here: mirrors.rit.edu/CTAN/macros/latex/contrib/ocgx/demo-ocgx.pdf pagestyle{empty} would be good but it's his MWE
– AndréC
9 hours ago
add a comment |
To be compiled twice. Use Adobe Reader, Foxit Reader, (evince ?) or PDF readers that manage OCG layers.
I simply adapted the code of the example given in the ocgx and ocgx2 package.
I'll leave it to you to do the finishing touches.
documentclass{article}
usepackage[latin1]{inputenc}
usepackage[T1]{fontenc}
usepackage[french]{babel}
usepackage{lmodern}
usepackage[top=1.5cm, bottom=4cm, left=2cm, right=2cm]{geometry}
%usepackage{pgf,tikz}
usepackage[tikz]{ocgx2}
usetikzlibrary{backgrounds,calc,shadows,chains,shapes.geometric}
usetikzlibrary{fit}
usetikzlibrary{matrix}
usetikzlibrary{arrows,patterns}
usepackage{amsmath,siunitx,xcolor}
usepackage{pgfplotstable,pgfplots,filecontents}
pgfplotsset{compat=1.6} %Update pgfplots package version.
usepackage{calculator,float}
usepackage{lscape,rotating,pdflscape}
tikzset{%
button on/.style={%
draw,minimum size=5mm,
line width=1pt,
fill=blue!50,rounded corners,
switch ocg with mark on={#1}{},
},
}
begin{document}
begin{landscape}
begin{figure}[H]
begin{tikzpicture}
begin{axis}[
width=22cm,height=12cm,
legend columns=1,grid=both, legend cell align={left},
ymin=-4,ymax=4,xmin=0,xmax=4,
xlabel = Lenght L (m),ylabel = Wave amplitude A (-),
]
begin{scope}[ocg={name=Wawe1 example,ref=Wawe1,status=invisible}]
addplot[domain=0:4,samples=200,red] {2*sin(2*pi/4*deg(x))};
end{scope}
begin{scope}[ocg={name=Wawe2 example,ref=Wawe2,status=invisible}]
addplot[domain=0:4,samples=200,blue] {2*sin(2*pi/5*deg((x))};
end{scope}
addlegendentry{Wave1}
addlegendentry{Wave2}
end{axis}
node[button on=Wawe1]at (-2,10)(but){};
node[right=0 of but]{Wawe1};
node[below=3pt of but,button on=Wawe2](but){};
node[right=0 of but]{Wawe2};
end{tikzpicture}
end{figure}
end{landscape}
end{document}

To be compiled twice. Use Adobe Reader, Foxit Reader, (evince ?) or PDF readers that manage OCG layers.
I simply adapted the code of the example given in the ocgx and ocgx2 package.
I'll leave it to you to do the finishing touches.
documentclass{article}
usepackage[latin1]{inputenc}
usepackage[T1]{fontenc}
usepackage[french]{babel}
usepackage{lmodern}
usepackage[top=1.5cm, bottom=4cm, left=2cm, right=2cm]{geometry}
%usepackage{pgf,tikz}
usepackage[tikz]{ocgx2}
usetikzlibrary{backgrounds,calc,shadows,chains,shapes.geometric}
usetikzlibrary{fit}
usetikzlibrary{matrix}
usetikzlibrary{arrows,patterns}
usepackage{amsmath,siunitx,xcolor}
usepackage{pgfplotstable,pgfplots,filecontents}
pgfplotsset{compat=1.6} %Update pgfplots package version.
usepackage{calculator,float}
usepackage{lscape,rotating,pdflscape}
tikzset{%
button on/.style={%
draw,minimum size=5mm,
line width=1pt,
fill=blue!50,rounded corners,
switch ocg with mark on={#1}{},
},
}
begin{document}
begin{landscape}
begin{figure}[H]
begin{tikzpicture}
begin{axis}[
width=22cm,height=12cm,
legend columns=1,grid=both, legend cell align={left},
ymin=-4,ymax=4,xmin=0,xmax=4,
xlabel = Lenght L (m),ylabel = Wave amplitude A (-),
]
begin{scope}[ocg={name=Wawe1 example,ref=Wawe1,status=invisible}]
addplot[domain=0:4,samples=200,red] {2*sin(2*pi/4*deg(x))};
end{scope}
begin{scope}[ocg={name=Wawe2 example,ref=Wawe2,status=invisible}]
addplot[domain=0:4,samples=200,blue] {2*sin(2*pi/5*deg((x))};
end{scope}
addlegendentry{Wave1}
addlegendentry{Wave2}
end{axis}
node[button on=Wawe1]at (-2,10)(but){};
node[right=0 of but]{Wawe1};
node[below=3pt of but,button on=Wawe2](but){};
node[right=0 of but]{Wawe2};
end{tikzpicture}
end{figure}
end{landscape}
end{document}

edited 9 hours ago
answered 10 hours ago
AndréCAndréC
9,08411447
9,08411447
Very nice!pagestyle{empty}would be good.
– Sigur
10 hours ago
With evince in Linux Mint, in full screen mode, the button does not work, since when clicked on it, it goes to next page, that is, end of file. Maybe a problem with my evince.
– Sigur
10 hours ago
I don't have evince and therefore I can't test. This compatibility is the one given by Paul Gaborit in his demo of theocgxpackage here: mirrors.rit.edu/CTAN/macros/latex/contrib/ocgx/demo-ocgx.pdf pagestyle{empty} would be good but it's his MWE
– AndréC
9 hours ago
add a comment |
Very nice!pagestyle{empty}would be good.
– Sigur
10 hours ago
With evince in Linux Mint, in full screen mode, the button does not work, since when clicked on it, it goes to next page, that is, end of file. Maybe a problem with my evince.
– Sigur
10 hours ago
I don't have evince and therefore I can't test. This compatibility is the one given by Paul Gaborit in his demo of theocgxpackage here: mirrors.rit.edu/CTAN/macros/latex/contrib/ocgx/demo-ocgx.pdf pagestyle{empty} would be good but it's his MWE
– AndréC
9 hours ago
Very nice!
pagestyle{empty} would be good.– Sigur
10 hours ago
Very nice!
pagestyle{empty} would be good.– Sigur
10 hours ago
With evince in Linux Mint, in full screen mode, the button does not work, since when clicked on it, it goes to next page, that is, end of file. Maybe a problem with my evince.
– Sigur
10 hours ago
With evince in Linux Mint, in full screen mode, the button does not work, since when clicked on it, it goes to next page, that is, end of file. Maybe a problem with my evince.
– Sigur
10 hours ago
I don't have evince and therefore I can't test. This compatibility is the one given by Paul Gaborit in his demo of the
ocgx package here: mirrors.rit.edu/CTAN/macros/latex/contrib/ocgx/demo-ocgx.pdf pagestyle{empty} would be good but it's his MWE– AndréC
9 hours ago
I don't have evince and therefore I can't test. This compatibility is the one given by Paul Gaborit in his demo of the
ocgx package here: mirrors.rit.edu/CTAN/macros/latex/contrib/ocgx/demo-ocgx.pdf pagestyle{empty} would be good but it's his MWE– AndréC
9 hours ago
add a comment |
For 2 functions we have 2^2=4 possibilities. for more functions, the code would be much complicated.
In full screen mode, click on the check mark to navigate to pdf page and see the functions.


M(W)E
documentclass[tikz,margin=2mm]{standalone}
usepackage{pgfplots,amssymb}
usepackage[hidelinks]{hyperref}
newcommand{colorOn}{green!80!black}
newcommand{colorOff}{black!30}
begin{document}
foreach i in {0,1}{
foreach j in {0,1}{
begin{tikzpicture}
begin{axis}[
width=22cm,height=12cm,
legend columns=1,grid=both, legend cell align={left},
ymin=-4,ymax=4,xmin=0,xmax=4,
xlabel = Lenght $L$ (m), ylabel = Wave amplitude $A$ (-),
]
ifnum i=1
addplot[domain=0:4,samples=200,red] {2*sin(2*pi/4*deg(x))};
addlegendentry{Wave1}
fi
ifnum j=1
addplot[domain=0:4,samples=200,blue] {2*sin(2*pi/5*deg((x))};
addlegendentry{Wave2}
fi
end{axis}
node[anchor=east,minimum width=4cm] (f) at (-2,6) {%
$f(x)=2sin(frac{2pi}{4}deg(x))$
ifnum i=0
ifnum j=0
hypertarget{fOffgOff}{}%
hyperlink{fOngOff}{textcolor{colorOff}{checkmark}}
else
hypertarget{fOffgOn}{}%
hyperlink{fOngOn} {textcolor{colorOff}{checkmark}}
fi
else
ifnum j=0
hypertarget{fOngOff}{}%
hyperlink{fOffgOff}{textcolor{colorOn}{checkmark}}
else
hypertarget{fOngOn}{}%
hyperlink{fOffgOn} {textcolor{colorOn}{checkmark}}
fi
fi
};
node[below of=f] (g) {%
$g(x)=2sin(frac{2pi}{5}deg(x))$
ifnum i=0
ifnum j=0
hyperlink{fOffgOn}{textcolor{colorOff}{checkmark}}
else
hyperlink{fOffgOff} {textcolor{colorOn}{checkmark}}
fi
else
ifnum j=0
hyperlink{fOngOn}{textcolor{colorOff}{checkmark}}
else
hyperlink{fOngOff} {textcolor{colorOn}{checkmark}}
fi
fi
};
end{tikzpicture}
}}
end{document}
add a comment |
For 2 functions we have 2^2=4 possibilities. for more functions, the code would be much complicated.
In full screen mode, click on the check mark to navigate to pdf page and see the functions.


M(W)E
documentclass[tikz,margin=2mm]{standalone}
usepackage{pgfplots,amssymb}
usepackage[hidelinks]{hyperref}
newcommand{colorOn}{green!80!black}
newcommand{colorOff}{black!30}
begin{document}
foreach i in {0,1}{
foreach j in {0,1}{
begin{tikzpicture}
begin{axis}[
width=22cm,height=12cm,
legend columns=1,grid=both, legend cell align={left},
ymin=-4,ymax=4,xmin=0,xmax=4,
xlabel = Lenght $L$ (m), ylabel = Wave amplitude $A$ (-),
]
ifnum i=1
addplot[domain=0:4,samples=200,red] {2*sin(2*pi/4*deg(x))};
addlegendentry{Wave1}
fi
ifnum j=1
addplot[domain=0:4,samples=200,blue] {2*sin(2*pi/5*deg((x))};
addlegendentry{Wave2}
fi
end{axis}
node[anchor=east,minimum width=4cm] (f) at (-2,6) {%
$f(x)=2sin(frac{2pi}{4}deg(x))$
ifnum i=0
ifnum j=0
hypertarget{fOffgOff}{}%
hyperlink{fOngOff}{textcolor{colorOff}{checkmark}}
else
hypertarget{fOffgOn}{}%
hyperlink{fOngOn} {textcolor{colorOff}{checkmark}}
fi
else
ifnum j=0
hypertarget{fOngOff}{}%
hyperlink{fOffgOff}{textcolor{colorOn}{checkmark}}
else
hypertarget{fOngOn}{}%
hyperlink{fOffgOn} {textcolor{colorOn}{checkmark}}
fi
fi
};
node[below of=f] (g) {%
$g(x)=2sin(frac{2pi}{5}deg(x))$
ifnum i=0
ifnum j=0
hyperlink{fOffgOn}{textcolor{colorOff}{checkmark}}
else
hyperlink{fOffgOff} {textcolor{colorOn}{checkmark}}
fi
else
ifnum j=0
hyperlink{fOngOn}{textcolor{colorOff}{checkmark}}
else
hyperlink{fOngOff} {textcolor{colorOn}{checkmark}}
fi
fi
};
end{tikzpicture}
}}
end{document}
add a comment |
For 2 functions we have 2^2=4 possibilities. for more functions, the code would be much complicated.
In full screen mode, click on the check mark to navigate to pdf page and see the functions.


M(W)E
documentclass[tikz,margin=2mm]{standalone}
usepackage{pgfplots,amssymb}
usepackage[hidelinks]{hyperref}
newcommand{colorOn}{green!80!black}
newcommand{colorOff}{black!30}
begin{document}
foreach i in {0,1}{
foreach j in {0,1}{
begin{tikzpicture}
begin{axis}[
width=22cm,height=12cm,
legend columns=1,grid=both, legend cell align={left},
ymin=-4,ymax=4,xmin=0,xmax=4,
xlabel = Lenght $L$ (m), ylabel = Wave amplitude $A$ (-),
]
ifnum i=1
addplot[domain=0:4,samples=200,red] {2*sin(2*pi/4*deg(x))};
addlegendentry{Wave1}
fi
ifnum j=1
addplot[domain=0:4,samples=200,blue] {2*sin(2*pi/5*deg((x))};
addlegendentry{Wave2}
fi
end{axis}
node[anchor=east,minimum width=4cm] (f) at (-2,6) {%
$f(x)=2sin(frac{2pi}{4}deg(x))$
ifnum i=0
ifnum j=0
hypertarget{fOffgOff}{}%
hyperlink{fOngOff}{textcolor{colorOff}{checkmark}}
else
hypertarget{fOffgOn}{}%
hyperlink{fOngOn} {textcolor{colorOff}{checkmark}}
fi
else
ifnum j=0
hypertarget{fOngOff}{}%
hyperlink{fOffgOff}{textcolor{colorOn}{checkmark}}
else
hypertarget{fOngOn}{}%
hyperlink{fOffgOn} {textcolor{colorOn}{checkmark}}
fi
fi
};
node[below of=f] (g) {%
$g(x)=2sin(frac{2pi}{5}deg(x))$
ifnum i=0
ifnum j=0
hyperlink{fOffgOn}{textcolor{colorOff}{checkmark}}
else
hyperlink{fOffgOff} {textcolor{colorOn}{checkmark}}
fi
else
ifnum j=0
hyperlink{fOngOn}{textcolor{colorOff}{checkmark}}
else
hyperlink{fOngOff} {textcolor{colorOn}{checkmark}}
fi
fi
};
end{tikzpicture}
}}
end{document}
For 2 functions we have 2^2=4 possibilities. for more functions, the code would be much complicated.
In full screen mode, click on the check mark to navigate to pdf page and see the functions.


M(W)E
documentclass[tikz,margin=2mm]{standalone}
usepackage{pgfplots,amssymb}
usepackage[hidelinks]{hyperref}
newcommand{colorOn}{green!80!black}
newcommand{colorOff}{black!30}
begin{document}
foreach i in {0,1}{
foreach j in {0,1}{
begin{tikzpicture}
begin{axis}[
width=22cm,height=12cm,
legend columns=1,grid=both, legend cell align={left},
ymin=-4,ymax=4,xmin=0,xmax=4,
xlabel = Lenght $L$ (m), ylabel = Wave amplitude $A$ (-),
]
ifnum i=1
addplot[domain=0:4,samples=200,red] {2*sin(2*pi/4*deg(x))};
addlegendentry{Wave1}
fi
ifnum j=1
addplot[domain=0:4,samples=200,blue] {2*sin(2*pi/5*deg((x))};
addlegendentry{Wave2}
fi
end{axis}
node[anchor=east,minimum width=4cm] (f) at (-2,6) {%
$f(x)=2sin(frac{2pi}{4}deg(x))$
ifnum i=0
ifnum j=0
hypertarget{fOffgOff}{}%
hyperlink{fOngOff}{textcolor{colorOff}{checkmark}}
else
hypertarget{fOffgOn}{}%
hyperlink{fOngOn} {textcolor{colorOff}{checkmark}}
fi
else
ifnum j=0
hypertarget{fOngOff}{}%
hyperlink{fOffgOff}{textcolor{colorOn}{checkmark}}
else
hypertarget{fOngOn}{}%
hyperlink{fOffgOn} {textcolor{colorOn}{checkmark}}
fi
fi
};
node[below of=f] (g) {%
$g(x)=2sin(frac{2pi}{5}deg(x))$
ifnum i=0
ifnum j=0
hyperlink{fOffgOn}{textcolor{colorOff}{checkmark}}
else
hyperlink{fOffgOff} {textcolor{colorOn}{checkmark}}
fi
else
ifnum j=0
hyperlink{fOngOn}{textcolor{colorOff}{checkmark}}
else
hyperlink{fOngOff} {textcolor{colorOn}{checkmark}}
fi
fi
};
end{tikzpicture}
}}
end{document}
edited 8 hours ago
answered 10 hours ago
SigurSigur
24.8k356139
24.8k356139
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%2f474860%2fdynamically-hide-and-show-plots%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
@JouleV Sadly nothing, I would like some help to start working on this (maybe a specific package or something else).
– joseldsm
12 hours ago
1
As you can see: I misunderstood your question. Please explain your question furthuer, and maybe a sketch of what you want to achieve.
– JouleV
12 hours ago
3
I am not sure that's possible without having a multipage pdf with all possible combinations of on and off. With a multipage pdf it is certainly possible, this is how the beamer buttons work. And sorry, your example is not particular useful. Apart from missing the preamble and
end{document}you are loading data that no one has (in order to plot seemingly straight lines...).– marmot
11 hours ago
1
@marmot, exactly what I am doing, but with
i,j,k... :-)– Sigur
11 hours ago
1
@marmot, oh, just now I saw that OP didn't provide the csv data.
– Sigur
11 hours ago