Skip to content
bmaranville edited this page Jun 24, 2011 · 5 revisions

Plotting

We are currently using the jqplot package as our plotting engine. At this point, with several additions from Ophir, the package can manage:

  • Scatter Plots
  • Errorbars
  • log plots
  • legends
  • 2D plots (with colorbar coming)
  • Cursor on 2D plots with (x,y,z)
  • Zooming
  • Panning coming soon

So, we now have all of the basic features required for generating plots (outside of interactors). So, we need to develop an API for dealing with these and deciding where it will live (client or server). While jqplot is imperative, the plotting API should be declarative. Something along the lines of Matplotlib's "plot(x,y,'s')" which would generate a 1D scatter plot, but not something where we deal with any of the internals of jqplot, or how this is actually accomplished.

Currently, each wire/terminal that we define have data and a DataType associated with it. Given this I have the following suggestions:

  1. This belongs on the server. When defining a DataType, then the author will need to associate a "plotter" to go with it. While we want to separate model and view code, we also want to make modules which are fairly self contained so that an author does not need to learn too many of the internals of the entire system in order to contribute. So, let's take SANS as an example. Suppose I have a module called "Transmission" with an outgoing terminal called "output" and a datatype called "sans.2D.qspace" then presumably, I know how I want that to be plotted, so I can associate a "plotter" with it.
  2. Here is where we have to decide how forward thinking we are. The responsibility of the plotter is to generate the declarative language of what we want plotted. Since most of us speak matplotlib, then I suggest that we just adopt a dialect of it. This will then be stored as json and spit over the wire.

    On the other side of the wire, then there will be a jqplot "adapter" to use the language of wire-it, which will translate the declarative language into jqplot commands.

    The reason for this abstraction is so that we are not tied so strongly to jqplot. I think that the dataflow concept is powerful and if we wanted to use it for another plotting package, then we can do so in the future, or we can adapt to jqplot as it evolves.

Plotting requirements

Before writing the API, I think it would be useful to list the requirements for our different groups (for now, ignore complex interactors)

Triple Axis

One plotter that the triple axis group would like is an nd plotter. Arguments would be a list of columns (for which order to show them to the user) and then simply:

  • 'column name':values
  • 'column name_errs':values
  • 'column name_flags':values

So, we could give for example, qx,qx_err, qx_flags. Qx_err might be a list of NA values, which would let the plotter know that it should not plot errorbars for that column. Flags might be "log=True", which would denote whether it should default to log.

SANS

Off Specular Reflectivity

I suspect the needs of SANS and offspecular will be similar. Some of the features may already be part of the 2d plotting capability (it's unclear from the documentation so far)

  • 2d matrices turned into colormaps
    • ability to select a range of intensities to be mapped
    • log or linear color map
    • label on color map (corresponds to label for intensity)
  • Axes with units and numeric limits
  • Title for plot
  • Slaved 1d plot(s) that show collapsed data along x and/or y

Specular Reflectivity

Clone this wiki locally