5 ms·
What is your static+interactive workflow now, if I can ask? Also, is it fairly easy to build a workflow that generates static visualizations via D3 (i.e. making
by danso 10y ago
What is your static+interactive workflow now, if I can ask? Also, is it fairly easy to build a workflow that generates static visualizations via D3 (i.e. making savable SVGs)?
- minimaxir 10y agoI make charts with R/ggplot2. Standard workflow is to construct chart and save as static file. (PNG/SVG etc.) But with the plot.ly bridge, I can convert to an interactive chart w/ rich tooltips with very very little tweaking. (See this notebook: https://github.com/minimaxir/interactive-facebook-reactions/blob/master/facebook_reactions_classification.ipynb https://github.com/minimaxir/interactive-facebook-reactions/...) To convert D3 to SVG, I believe all you need is a helper function but that is not my area of expertise.
- monfera 10y agoThere's also Shiny, Jupyter, Bokeh...
- minimaxir 10y agoThose aren't updated clientside (have to ask the server for the new chart instead of just the data), which is a different architecture that does not scale.
- lmcinnes 10y agoBroken actually does a lot of stuff client side and you can simply update the data. It's much closer to d3 for interactivity,and really quite powerful. It does lack some features ATM, but it continues to grow space.
- monfera 10y agoIndeed, what I like about plotly is that you can start pretty much anywhere (R, Python, Jupyter, browser JavaScript, node.js, Julia, Matlab...) and get to an interactive, explorable chart (disclaimer, I'm working on WebGL plotly functions eg. https://twitter.com/plotlygraphs/status/747879741399568384 https://twitter.com/plotlygraphs/status/747879741399568384)
- jcheng 10y agoShiny supports either model, depending on the visualization. And also I think you have it backwards, if you have to scale to large amounts of data then you want to push a chart, not data, into the client.
- bigtunacan 10y agoHadn't heard of Bokeh before; so thanks for that! Also there is ggvis https://github.com/rstudio/ggvis https://github.com/rstudio/ggvis which is nice if you are already using ggplot2.
- thenipper 10y agoTo do this you can use SVG Crowbar: http://nytimes.github.io/svg-crowbar/ http://nytimes.github.io/svg-crowbar/ It's pretty easy to use. I don't do interactive so I just find it easier to export EPS files from R.
- ontouchstart 10y agoIt is very easy to "export" SVG generated by d3: output.append('div').text(svg.node().outerHTML); You can see it in action here: https://www.digital-message.com/develop/tools/yaml2svg https://www.digital-message.com/develop/tools/yaml2svg
- ontouchstart 10y agoYou can copy and paste the SVG code out: <svg xmlns="http://www.w3.org/2000/svg" http://www.w3.org/2000/svg" version="1.1" width="250" height="250"><rect x="25" y="25" width="200" height="200" fill="lime" stroke-width="4" stroke="pink"></rect><circle cx="125" cy="125" r="75" fill="orange"></circle><polyline points="50,125 50,200 200,200 200,125" stroke="red" stroke-width="4" fill="none"></polyline><path d="M50 125 c 25 -60 50 -60 75 0 c 25 60 50 60 75 0" fill="none" stroke-width="4" stroke="white"></path><text x="125" y="125" font-family="monospace" font-size="20" text-anchor="middle" fill="black">Hello world</text></svg>
- thadk 10y agoOr, in Chrome, use the Console.download() snippet: https://bgrins.github.io/devtools-snippets/#console-save https://bgrins.github.io/devtools-snippets/#console-save / https://github.com/bgrins/devtools-snippets/tree/master/snippets/console-save https://github.com/bgrins/devtools-snippets/tree/master/snip...
- ontouchstart 10y agoI don't think your solution works for this use case since what he wants is to save the "XML serialized" SVG element instead of a "JSON serialized" JavaScript object. A simple d3.select('svg').node().outerHTML would do the trick. (You can use the same trick as in console-save to generate a download URL though.)