queryverse / QuickVega.jl

6 stars 4 forks source link

WIP - lineplot functions #5

Open mcmcgrath13 opened 4 years ago

mcmcgrath13 commented 4 years ago

@davidanthoff this is very WIP, but wanted to get feedback on general direction before going too far. I'm thinking that we want methods for each broad plot type for vectors, 2d arrays, and a fallthrough that assumes tabular data.

mcmcgrath13 commented 4 years ago

it might be nice to have a global kwargs/opts defaults that would could plop into any method (things like x_col=:x, color=blah, etc)

mcmcgrath13 commented 4 years ago

Excellent!

I guess a first big question is whether this API works off tabular data and allows one to specify columns by name, or whether we think that model is covered well enough by VegaLite.jl, and we make QuickVega.jl operate purely on vectors?

I think one argument against the purely vector story is that we definitely want to support things like pairplots, and I think those really only make sense on tables, right?

I think we want to support both vectors and tabular data for quick vega. I had missed that VegaLite now supports vectors of data directly (🎉 ), so definitely no need for the DataFrames.jl dependency (which I didn't love to begin with). I was thinking that the below would all just work:

lineplot(vector) # line plot with 1:length(vector) as x and passed vector as y values
lineplot(rowvector) # same as above
lineplot(xvector, yvector) # standard x vs y lineplot
lineplot(array) # columns 1 and 2 used as x and y
lineplot(table; x_col=xname, y_col=yname) # columns x and y OR kwargs overrides used as x and y 

Are there other data structures we want to support?

I was also thinking it might be nice to have a global default opts struct that's mostly reusable across different plots. So we could start with the basic plot, then merge that in (or maybe just use a literal VLSpec for that) (or both?). Line plots aren't the most interesting plot and probably doesn't save that much effort over just using VegaLite, but I wanted to start here to figure out some of the API and story before moving on to more complicated plot types.