Comments (8)
I like the interpolation, I don't think we need consistency with DataFramesMeta on this.
from statsplots.jl.
What is missing is that macro are called before the code is executed, so the macro cannot know that x
will be a symbol. @df
is inspired by DataFramesMeta's @with
(see here) and distinguishes symbols syntactically and cannot know that x
will be a symbol at parse time. If you think this application is common enough, I can maybe implement the _I_(expr)
notation (as they do in @with
). like:
x = :A
@df smallDf histogram(_I_(x))
But honestly I'm not a huge fan of this syntax. Maybe:
x = :A
@df smallDf histogram($x)
would make more sense? It seems more intuitive to me, not sure why DataFramesMeta went with _I_(expr)
which is a bit awkward to type.
from statsplots.jl.
Thanks ! Of course that makes sense. I encountered it while changing some old code that was using the deprecated syntax plot(smallDf,x)
. I think that might be a nice feature to add if more people agree -- as for the syntax, I guess being coherent with DataFrameMeta
is a good thing.
from statsplots.jl.
@mkborregaard what's your take for a syntax that allows "interpolating" symbols in a @df
call? _I_(expr)
like DataFramesMeta, $expr
(which is what I would try as a user) or yet another thing?
from statsplots.jl.
I actually started wondering whether we should just always use cols
instead. Now we have cols(v::AbstractArray{Int64})
mean the hcat
of those columns, but maybe we could also have cols(v::AbstractArray{Symbol})
to select the columns by name, as well as a cols(v::Int64)
or cols(v::Symbol)
if it's just one column but we want to choose it by index rather than name, or we want to chose it by name but the name is a variable. Maybe the 1 column version could be renamed col
, though I probably prefer to just have one function with different methods for ints/symbols and arrays of ints/symbols.
The rule would be:
- If it's a symol that you type, use the symbol
- otherwise, use
cols
to signal to the macro that the content represent one or more columns
from statsplots.jl.
I think that suggestion has the advantage that the interpolation after a macro feels a little magical, and enough slightly differing uses of $
after a macro (i.e. the suggested use is different from that used in BenchmarkTools) could create slightly fuzzy interface. Though cols is clearly ours, and at the cost of being slightly clumsy and wordy should be quite clear to understand.
from statsplots.jl.
@romainFr If you want you can try #120 and see if it addresses your use case.
from statsplots.jl.
@piever It does, thanks !
from statsplots.jl.
Related Issues (20)
- "reducing over an empty collection" error in `dotplot`
- invalid image url for "Dendrogram on the right side"
- ytick doesn't show all ticks
- Documentation of StatsPlots.jl is in Plots.jl repo? HOT 1
- Raincloud Plots HOT 3
- Removing dependency on DataValues.jl
- `groupedhist` and `groupedbar` `ylims` not working when x and y axis switched.
- Bugs in `cornerplot` and `corrplot` HOT 2
- How to specify fillcolor for violin plots? HOT 1
- The broadcast pipe operator doesn't get recognized by the @df macro
- kwagrs splatting does not work for errorline
- Feature request: support for percentograms HOT 1
- Plot of ecdf with groups gives incorrect plot HOT 3
- errorline! does not work with Dates x-axis
- julia 1.9.4 crashes with corrplot >11 columns HOT 2
- Line breaks when using @df macro with missing data
- New release HOT 1
- Feature Request: Automatically set default xlabel and ylabel given the column names
- Example "ordination" in readme.md doesn't works
- `xformatter` has no effect in `groupedbar()` when `x`, `y`, and `group` are provided
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from statsplots.jl.