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

Support for SubDataFrame and other DataFrame Types #105

Closed
rcnlee opened this issue Jan 2, 2016 · 5 comments
Closed

Support for SubDataFrame and other DataFrame Types #105

rcnlee opened this issue Jan 2, 2016 · 5 comments

Comments

@rcnlee
Copy link

rcnlee commented Jan 2, 2016

The DataFrames package may produce derivative types depending on the operations performed. For example, if you take a view into a DataFrame, you get a SubDataFrame. A groupby gives a GroupedDataFrame, etc.

Plots.jl can be easily modified to support all of these by changing the function signatures to accept the AbstractDataFrame type. In particular, the functions in plot.jl dataframes() can be modified like this:

@eval function createKWargsList(plt::PlottingObject, df::DataFrames.AbstractDataFrame, args...; kw...)
    createKWargsList(plt, args...; kw..., dataframe = df)
  end

  # expecting the column name of a dataframe that was passed in... anything else should error
  @eval function extractGroupArgs(s::Symbol, df::DataFrames.AbstractDataFrame, args...)
    if haskey(df, s)
      return extractGroupArgs(df[s])
    else
      error("Got a symbol, and expected that to be a key in d[:dataframe]. s=$s d=$d")
    end
  end
@ErwanPiR
Copy link

Hi,
I wonder if this question has been adressed, because when I try to plot SubDataFrame or GroupedDataFrame, I get the error :
ERROR: No user recipe defined for SubDataFrame{Array{Int64,1}}

Thanks.

@mkborregaard
Copy link
Member

You can't. See StatPlots for plotting of DataFrames

@ErwanPiR
Copy link

Ok, thank you. I already check StatPlots but it's the same error :)

@mkborregaard
Copy link
Member

Yes because there is no recipe for DataFrames. If you have a use case that isn't covered by the functionality in StatPlots you're welcome to open an issue with the example.

@ErwanPiR
Copy link

Thank you. I open an issue in StatPlots to explain the case.

Jonas-a-Zimmermann pushed a commit to Jonas-a-Zimmermann/Plots.jl that referenced this issue Oct 29, 2024
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

No branches or pull requests

4 participants