PGFPlots.jl icon indicating copy to clipboard operation
PGFPlots.jl copied to clipboard

Support for beamer overlays

Open zsunberg opened this issue 9 years ago • 7 comments

It would be cool to support beamer overlays, i.e. with code like the following (note the use of \only!), you can display a single line on a plot on one slide, and then display both on the second slide. Maybe a keyword argument like only="<2->" on the Plot object constructor would be good.

\begin{frame}{}
    \center
    \begin{tikzpicture}

\begin{axis}[title = {Behaviors Uniformly Distributed}, ymax = {1.5}, grid=both, ymin = {0}, xmax = {30}, xmin = {0}]\addplot+ coordinates {
(6.972, 1.33)
(7.089, 1.12)
(7.647, 0.896)
(9.6165, 0.566)
(15.369, 0.366)
(22.5885, 0.304)
};
\addlegendentry{Omnicience bound}
\only<2->{
\addplot+ coordinates {
(6.957, 1.388)
(7.194, 1.266)
(7.7895, 1.024)
(10.905, 0.72)
(17.5905, 0.468)
(26.76, 0.412)
};
\addlegendentry{Assume all normal}
}
\end{axis}

\end{tikzpicture}
\end{frame}

zsunberg avatar Sep 03 '16 04:09 zsunberg

I think you can do this with something like:

Plots.Command("\\only<2->{")

and

Plots.Command("}")

Right? Then export the file without the preamble and input it into your document:

save("myfile.tex", p, include_preamble=false)

mykelk avatar Sep 03 '16 04:09 mykelk

ah, yeah, that seems like it should work - didn't know about Command. Plots.Command("}") seems a little clumsy. Should we have a more robust mechanism for things like this eventually? or just leave it as-is?

zsunberg avatar Sep 03 '16 04:09 zsunberg

Commands adds a ; in the wrong place

zsunberg avatar Sep 03 '16 04:09 zsunberg

Hmm... How would you want this kind of thing to appear in a notebook? Maybe as an interact kind of thing with a slider bar? Do you think it's in the scope of this package?

mykelk avatar Sep 03 '16 05:09 mykelk

My first thought is that it would be a feature that's only useful for beamer presentations, and in a notebook the option would have no effect. Given that this package's primary use is in preparing publications (and hence presentations) it might be useful to people. I guess don't really know what the scope of this project is, haha.

zsunberg avatar Sep 03 '16 05:09 zsunberg

If one were to include this functionality, how would you like the interface to look?

mykelk avatar Sep 03 '16 05:09 mykelk

I think I need to use the package more before I propose any solutions

zsunberg avatar Sep 06 '16 20:09 zsunberg