-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
docs/build | ||
docs/site | ||
docs/Manifest.toml | ||
Manifest.toml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
authors = ["Andy Ferris <[email protected]>"] | ||
name = "TypedTables" | ||
uuid = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9" | ||
authors = ["Andy Ferris <[email protected]>"] | ||
version = "1.4.0" | ||
|
||
[deps] | ||
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" | ||
Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4" | ||
Indexing = "313cdc1a-70c2-5d6a-ae34-0150d3930a38" | ||
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" | ||
SplitApplyCombine = "03a91e81-4c3e-53e1-a0a4-9c0c8f19dd66" | ||
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" | ||
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" | ||
|
||
[compat] | ||
julia = "1" | ||
Adapt = "1, 2, 3" | ||
Dictionaries = "0.3" | ||
Indexing = "1" | ||
SplitApplyCombine = "1" | ||
Tables = "1" | ||
Dictionaries = "0.3" | ||
julia = "1" | ||
|
||
[extras] | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. For generic Tables.jl, this would be: |
||
xguide --> string(x_name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does the There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" |
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. For generic Tables.jl, these would be |
||
elseif length(indices) == 3 | ||
x_name, y_name, z_name = propertynames(tt)[indices] | ||
xguide --> string(x_name) | ||
yguide --> string(y_name) | ||
zguide --> string(z_name) | ||
return getproperty(tt, x_name), getproperty(tt, y_name), getproperty(tt, z_name) | ||
else | ||
throw(ArgumentError("Keyword argument `indices` needs to be an integer array of length 2 or 3.")) | ||
end | ||
end | ||
|
||
@recipe function f(tt::Table, column_names) | ||
if length(column_names) == 2 | ||
x_name, y_name = column_names | ||
xguide --> string(x_name) | ||
yguide --> string(y_name) | ||
return getproperty(tt, x_name), getproperty(tt, y_name) | ||
elseif length(column_names) == 3 | ||
x_name, y_name, z_name = column_names | ||
xguide --> string(x_name) | ||
yguide --> string(y_name) | ||
zguide --> string(z_name) | ||
return getproperty(tt, x_name), getproperty(tt, y_name), getproperty(tt, z_name) | ||
else | ||
throw(ArgumentError("The second argument `column_names` needs to be of length 2 or 3.")) | ||
end | ||
end |
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