Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - lineplot functions #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mcmcgrath13
Copy link

@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
Copy link
Author

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)

@davidanthoff davidanthoff mentioned this pull request Aug 4, 2020
Copy link
Member

@davidanthoff davidanthoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

deps = ["DataStructures", "DataValues", "Dates", "FileIO", "FilePaths", "IteratorInterfaceExtensions", "JSON", "JSONSchema", "MacroTools", "NodeJS", "Pkg", "REPL", "Random", "Setfield", "TableTraits", "TableTraitsUtils", "URIParser", "Vega"]
git-tree-sha1 = "96bbaa70e8f60b836c2dee451ca936a9b15f8e86"
uuid = "112f6efa-9a02-5b7d-90c0-432ed331239a"
version = "2.2.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this file entirely? We don't checkin Manifest.toml files into the repo here :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll delete it and add it to the gitignore

@@ -3,5 +3,9 @@ uuid = "8cbdc466-600a-49fa-b107-91fd9d936351"
authors = ["David Anthoff <[email protected]>"]
version = "0.1.0"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to find a way that works without a dep on DataFrames.jl, I don't want to tie the package to a particular table implementation (plus, DataFrames.jl is having too many breaking changes lately for my taste to take a dependency on it).

end

function lineplot(data::AbstractVector)
lineplot(DataFrame(x=collect(1:length(data)), y=data))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vlplot(:line, 1:length(data), data) would be a version without a DataFrame dependency, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup! I had missed that was directly supported now...

@mcmcgrath13
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants