mbauman / Signals.jl

An abandoned work-in-progress for a high level Signal type with a common timebase (in seconds) and groups of channels. Deprecated in favor of AxisArrays.jl.
github.com/JuliaArrays/AxisArrays.jl
Other
6 stars 0 forks source link

Plotting #5

Open mbauman opened 10 years ago

mbauman commented 10 years ago

It'd be great to smartly plot Signals. Some thoughts:

mbauman commented 9 years ago

Hrm. It looks like the only real way to hook into Gadfly would be if a Signal <: AbstractDataFrame since a Layer's data source has to be an AbstractDataFrame or nothing at all. That may have some other advantages, allowing Signals.jl to piggyback on all the other wonderful work in JuliaStats.

mbauman commented 9 years ago

It's not that bad making Signals <: AbstractDataFrame. See the AbstractDataFrame branch. And with it, you can use Gadfly to plot (but rendering the 2 million datapoints from the example on the README takes nearly forever):

screen shot 2014-11-22 at 10 29 16 pm

tshort commented 9 years ago

An option is to have a thin wrapper that you use to convert Signals to an AbstractDataFrame. That way, if the AbstractDataFrame isn't quite what you want, you're not stuck with it. For these types of plots, Gadfly works best with a melted DataFrame (long rather than wide).

I'm interested in Signals mainly for manipulation and plotting of results from Sims.jl. Right now, I use a simple type with column names and a matrix of results with the first column being time.

I've implemented several helpers for plotting multiple "signals" here using PyPlot, Gadfly, Winston, and Gaston. Overall, I like PyPlot the best and have implemented the most features for that (e.g. column selection). Its subplot feature looks nice with many channels. I also made all of the plotting methods optional with the Requires module. That works well--it cuts down on dependencies and reduces load times.

tshort commented 9 years ago

Another thought is to try to coordinate with TimeSeries.jl. There are natural overlaps for plotting (and also for indexing and filtering). Maybe both could even share a common abstract type.

Cc'ing @milktrader.

mbauman commented 9 years ago

Thanks so much for the feedback and pointers on plotting! I'm definitely steering away from the AbstractDataFrame direction. This project is still very much in flux… see #12 for my latest thoughts on yet another refactor. With a more general labeled-axes sort of arrangement (maybe split out and called AxisArrays?), it'd be trivial to use a Date Vector.

tshort commented 9 years ago

With the Axis Array idea, you could still provide a view that is an AbstractDataFrame. For a long-format view (stacked or melted in DataFrames terminology), you can create a DataFrame with columns for each of the Axes, and a column with the data. The Axes columns could be generalizations of DataFrames.RepeatedVectors, so that no data copying is needed. You could feed this right into Gadfly for plotting various axes and subsets.

It should also be possible to get one or more wide DataFrame views into the Axis-Array style Signal, but it'd be more difficult.