I’m not aware of any DataFrames recipes other than the ones in StatsBase. I think a recipe as simple as yours might not exist because it assumes a very specific structure of your data (all columns except the first numeric, first column holding x labels) which is probably not present in most situations.
In this case it expects the first column to be a time type; first it checks its format and if the first column is not a time type it adds a column to the DataFrame with a default time type. Then it proceeds to plot it.
If instead a time type we want labels in the first column, we could just do the same and add a default label column and then plot it, or just restrict the plot to those DataFrame values with the proper format and ignore the others.
Thanks Nils.
For the 2nd question, wanted to know if that is all one need to do to create a method to plot dataframes. It needs further bells and whistles, for sure.
NB: There are no labels on the first column, the simple dataframe example provided looks like this:
@viraltux, thanks for the comprehensive example.
It seems to call an external function tots(df)?
More importantly, once the @recipe function f() has been defined, how do you use it, as simply as plot(df)?
One thing to note is that I believe recipes should generally use --> to set plot kwargs, not :=: as stated in the docs, := forces a certain attribute, which means the user can’t overwrite this, while --> sets a default which can be changed if the user passes that kwarg. Imho := should therefore only be used where a plot doesn’t make sense if a certain attribute is changed, or if you absolutely want to enforce a specific look (e.g. writing a recipe for an organisation with a corporate color scheme or something)