• Are there ways to incorporate interactive plotly graphics, or similar, into stats.stackexchange answers and questions?
  • If not, are there alternatives?
  • What questions/answers here show some good examples?
  • $\begingroup$ For an alternative, you could always just host and link to a graphic off-site, and maybe provide a still frame so readers in the future will know what they're linking to. $\endgroup$ Commented Dec 10, 2017 at 18:22

2 Answers 2


No; it is not possible. The only way this could be possible is via iframe HTML tag, but stackexchange allows only a limited number of HTML tags and does not enable users to use any embedded content besides images.

I also do not think that we would need plotly for anything on CrossValidated. If you need an interactive plot for your answer, then it is probably not self-explanatory and you should improve the answer, rather than the graphics. Notice that most of the answers on CV do not use graphics, or use very limited and simple graphics. Interactive (i.e. more than 2D) graphics are needed to visualize pretty complicated data structures, and CV is not the place to discuss such data (it would need a detailed analysis, rather than a short answer).

CV is a place to ask and receive answers on general problems, possibly illustrated with simple data examples. Moreover, you can always post code that users can run on their own machines to interactively check something about your answer.

  • 8
    $\begingroup$ The spirit of this is right, but I wouldn't want to warn off anyone with "pretty complicated data structures" which, depending on personal definitions, make up a high fraction of questions here. $\endgroup$
    – Nick Cox
    Commented Dec 4, 2017 at 15:38
  • $\begingroup$ Notice that most of the answers on CV do not use graphics, or use very limited and simple graphics. This is only because it's relatively difficult to produce high-quality graphics, interactive graphics moreso. Do you really mean to assert that "CV is not the place to discuss" histograms? $\endgroup$ Commented Dec 10, 2017 at 18:20
  • $\begingroup$ @ssdecontrol I never said it is not a place to "discuss" graphics. I said that most questions and answers do not use graphics. Moreover, this is not a journal, so there is no need for high-quality graphics, it is enough if they are readable and show your point (so base R graphics or Excel plots are just enough in the vast majority of cases). $\endgroup$
    – Tim
    Commented Dec 10, 2017 at 19:46
  • 1
    $\begingroup$ Moreover, this is not a journal, so there is no need for high-quality graphics, it is enough if they are readable and show your point -- This doesn't make sense to me: sometimes (indeed, often) the best way to show your point, once you've explained it in words, is with an interactive graphic. High-quality, rich graphical displays are highly effective teaching tools. If we followed your line of reasoning in the classroom, we'd still be using overhead projectors. $\endgroup$ Commented Dec 10, 2017 at 19:52
  • $\begingroup$ Sorry to belabor the point, but look at Martijn Weterings' answer. Now imagine if he had been able to post an interactive graphic that readers could drag, rotate, and pan. It's a small improvement, but the pedagogical benefits of interactivity are tremendous. The "a-ha" moment is that much more delicious, and therefore that much more memorable. Discounting the importance of interactive data viz is a big mistake IMO. $\endgroup$ Commented Dec 10, 2017 at 19:57
  • $\begingroup$ @ssdecontrol but isn't the 3D rotating plot in his answer enough? Also, imagine that we had plotly and similar engines as a backend for graphics on CV, I'd bet that the answers would soon look like Christmas trees but this wouldn't immediately lead to improvement of the quality of the answers. Sorry but my opinion on interactive plots is that in vast majority of the cases they lead users to mindlessly rotate, zoom, shift things until they notice how much time did they wasted... $\endgroup$
    – Tim
    Commented Dec 10, 2017 at 20:39
  • $\begingroup$ @ssdeccontrol Overhead projectors! What's wrong with chalk? Sketching a diagram with chalk (1960s-1980s in my case) ensured that you showed information at about the speed an audience could absorb and many colleagues still prefer a whiteboard for talks for more or less the same reason. Just joking; I am very positive about graphics and don't see any case for disparaging or downplaying their role on CV. I tend to agree with Tim on interactive graphics, however: how much time is anyone expected to spend writing/reading an answer? (As much as they like, clearly, but apart from that?) $\endgroup$
    – Nick Cox
    Commented Dec 11, 2017 at 18:35

As @Tim says, the answer is no. But I'm not so against interactive graphics. I can see their utility for some questions, e.g., illustrating things like paradoxes caused by endogeneity. Anytime there are issues pertaining to data in more than two dimensions, there is the possibility that interactive graphics could be helpful.

Let me suggest a possible alternative: It is possible to create and post animations (gifs) to the site as images. (You can view some examples in @amoeba's answer to Making sense of principal component analysis, eigenvectors & eigenvalues thread.) Thus, what I would suggest is that you produce a simple animation of interacting with a graphic in a particular way to illustrate some point. Be sure to walk through that you're doing and what it shows in the text. You won't have the ability to allow the user to interact freely on their own and truly explore the ideas for themself, but you should be able to cover most of what you need to show; you could always post a couple of different ones, if necessary.

  • 3
    $\begingroup$ I agree that gif images can be a solution in some cases and I have used them before: stats.stackexchange.com/questions/310517/… However, such type of images can sometimes go too fast and for that reason I have also used arrays of images stats.stackexchange.com/a/306743/164061 in order to show the different ways two surfaces can touch each other (which may work in 3D). $\endgroup$ Commented Dec 4, 2017 at 14:36
  • 2
    $\begingroup$ In was also thinking of other applications in which a slider allows the change of some parameter and gives the reader of an answer some ability to 'explore' the data and the problem. $\endgroup$ Commented Dec 4, 2017 at 14:38
  • 1
    $\begingroup$ I believe it's possible to slow them down somehow, although I'm not very savvy w/ it, @MartijnWeterings. Using multiple types of plots is sometimes the best way to go (cf, Why is polynomial regression considered a special case of multiple linear regression?). The only thing I think you can do here is create an animation with you moving the slider. $\endgroup$ Commented Dec 4, 2017 at 14:47
  • 5
    $\begingroup$ Animations are not interactive! There is nothing that irritates me more on any site than an endlessly repeating animation, period. If the viewer had more control over them, such as being able to slow them down, speed them up, and easily halt them, then they would be less obnoxious. Consequently I make every effort not to use animated images here if there is any possible alternative way to explain a concept--and almost always there is. $\endgroup$
    – whuber Mod
    Commented Dec 4, 2017 at 15:35
  • 3
    $\begingroup$ @whuber, and if there is no other option, then make it worth it: mathematica.stackexchange.com/questions/1900/…. $\endgroup$ Commented Dec 4, 2017 at 20:47
  • $\begingroup$ @MartijnWeterings that's the use case I have in mind as well -- letting the user control the parameters of a demo. $\endgroup$ Commented Dec 10, 2017 at 23:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .