9

It seems that embedding 3D plots in PDFs has been around for a few years now (misc3d, for example, and Asymptote), as well as interactive features such as fancy-preview and optional content groups (which could probably be hacked to do what I'm about to ask) but it doesn't seem to be the case for more simplistic 2D plots. I would love to embed interactive 2D plots similar to those seen around the interwebs these days where you hover over a point and the actual value is displayed or trend line is highlighted, etc.

Is it possible to do this with LaTeX / Sweave / or whatever?

A few examples in case I'm still not clear:

8

Pgfplots is a plotting package for 2d/3d visualization which can display

  • values of point coordinates on click
  • trend lines via drag-and-drop (including the slopes)
  • arbitrary meta data when clicking onto a data point (both 2d/3d)

To activate it for all pgfplots figures in your document, simply write

\usepgfplotslibrary{clickable}

in your preamble.

Details, examples, and screenshots can be seen in the pgfplots manual http://pgfplots.sourceforge.net/pgfplots.pdf , here is an excerpt:

5.1 Clickable Plots

\usepgfplotslibrary{clickable} % LATEX and plain TEX
\usepgfplotslibrary[clickable] % ConTEXt
\usetikzlibrary{pgfplots.clickable} % LATEX and plain TEX
\usetikzlibrary[pgfplots.clickable] % ConTEXt

A library which generates small popups whenever one clicks into a plot. The popup displays the coordinate under the mouse pointer, supporting the optional snap-to-nearest clickable coords feature with customizable displayed information. Furthermore, the library allows to display slopes if one holds the mouse pressed and drags it to another point in the plot. The library has two purposes: to compute slopes in a simple way and to provide related, optional information to single data points which are not important enough to be listed in the main text (like prototype parameters or other technical things).

  • Thanks for pointing that out! I didn't look into pgfplots deeply enough to see that clickable plots are possible. While I will go with that if there are no other alternatives, what I would really prefer is hoverable plots… – post-hoc May 30 '14 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.