Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Interactive, 3D plots #9

Open
mohawkjohn opened this Issue · 10 comments

6 participants

@mohawkjohn
Owner

Rubyvis is based on Protovis, which allows for a certain level of user interaction. Unfortunately, it's not clear how Rubyvis can be interactive in a way that is portable.

Let's say you render an SVG in SciRuby::Plotter. You could build a custom SVG rendering library which might allow elements to be re-sized or moved. But what if you wanted to display that SVG in a web browser? The interactive portion would be lost.

Alternatively, assume you render an SVG and send it to a browser, and then write Javascript to enable interactivity. Same problem as before, but in reverse: now you can't get the interactivity in SciRuby::Plotter, which doesn't understand Javascript. Plus, the user now has to write in Ruby and Javascript, which is annoying.

There is likely no easy solution to this sort of problem, short of finding a way to interpret Ruby in a web browser. But I include it in the issue tracker for either (a) that day when someone really wants a challenge, or (b) a future redesign of plotting.

Relatedly, Protovis has limited 3D capabilities. Perhaps someone can come up with a solution that enables rendering of 3D plots, written in pure Ruby, in a web browser.

@KillaPL

There is a ruby wrapper for opengl for 2d games creating. Its called Chingu and i think its perfect. It can create a window with full interaction. Its a good solution for pure ruby.

@Blahah

Why is SciRuby::Plotter not just a webview of some sort? Seems the most rational ground-up way to design a visualisation suite for ruby would be to use D3.js as the basis for rubyvis (as opposed to the now outdated ancestor, protovis), and plotter would basically be a chromium window.

@mohawkjohn
Owner

Mostly because @clbustos wrote Rubyvis before there was a D3. If you'd like to contribute a new plotting tool, we'd be thrilled.

@Blahah

Makes sense. Our lab have just agreed to all switch to ruby for some intensive bioinformatics stuff. We'll want to generate interactive visualisations, so I'm going to at the least create a ruby wrapper around D3. I'll offer anything we do for inclusion in SciRuby.

@mohawkjohn
Owner
@tallakt
@agarie
Owner

Awesome, @Blahah. When you have a repo with something for us to experiment on or if you want some feedback, please post about it on our mailing list. Thanks!

@audy
Collaborator

I've been thinking about this recently as well:

On one hand, you want to be able to do interactive plotting in Ruby. On the other hand, you want to be able to have interactive, portable plots in the browser/PDF (thinking down the road about something like iPython notebook).

My idea was to build a collection of common plot types that can be created in Ruby but are translated to d3.js (it could be as simple as sending JSON to a d3.js template [like @Blahah and @tallakt mentioned]). These could be rendered in a browser live during a session in the REPL or saved for later viewing in a static HTML file.

I dream of nice DSLs:

plot :box_plot, data_frame do
    y :cancer_cells
    x :treatment
    color :label
    title "Look, ma! I cured cancer!"
end

This becomes JSON sent to a d3.js template for a box_plot. A message is sent to a web server instructing the browser to refresh when the plot is updated allowing for interactivity.

If you want to add custom interactivity or change things about the plot type, you would still have to learn JavaScript. However, as Ruby programmers, we should all be good at that already right?

@tallakt
@audy
Collaborator

You do have a server running on your machine in order to do plotting (it's called X). The browser window could refresh each time the plot changes. Anyway, let's just see who implements what first :)

@audy audy closed this
@audy audy reopened this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.