-
Notifications
You must be signed in to change notification settings - Fork 25
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
add Plots.jl recipes #94
base: main
Are you sure you want to change the base?
Conversation
Out of curiosity… should this be done for the Tables.jl interface in general? |
Might be useful, if that is feasible, but I don't know the interface very well to judge that |
Indexing = "1" | ||
SplitApplyCombine = "1" | ||
Tables = "1" | ||
Dictionaries = "0.3" | ||
julia = "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need to add a compat entry here for RecipesBase or the General registry will reject a new release
@recipe function f(tt::Table; indices = [1,2]) | ||
if length(indices) == 2 | ||
x_name, y_name = propertynames(tt)[indices] | ||
xguide --> string(x_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the -->
operator do here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's "use this value if the user didn't provide a different value"
@@ -0,0 +1,33 @@ | |||
@recipe function f(tt::Table; indices = [1,2]) | |||
if length(indices) == 2 | |||
x_name, y_name = propertynames(tt)[indices] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For generic Tables.jl, this would be: x_name, y_name = Tables.columnnames(tt)[indices]
x_name, y_name = propertynames(tt)[indices] | ||
xguide --> string(x_name) | ||
yguide --> string(y_name) | ||
return getproperty(tt, x_name), getproperty(tt, y_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For generic Tables.jl, these would be Tables.getcolumn(tt, x_name), Tables.getcolumn(tt, y_name)
Seems to me like it could work on generic Tables.jl given what is defined here; I don't know RecipesBase.jl well enough to know what kind of dependency it is, but we could look into adding this to Tables.jl directly. |
It seems to be a single ~500-line file. Like Tables.jl it's mostly there to provide the interface to be imported and extended, so I suspect there's some synergy. Does DataFrames already have the equivalent of this PR? |
I didn't make any other PRs. StatsPlots.jl has a I'll also note that DimensionalData.jl provides a set of more elaborate recipes, but I tried to keep things minimalistic here. |
This adds two recipes to automatically set the labels.
gives takes first column as
x
and second column asy
.Then you can use either of
to get other combinations.
Currently this only works for
Table
s, but with a common supertype this could potentially be extended to moreTypedTables
.