StatsPlots.jl
StatsPlots.jl copied to clipboard
Heatmap for "long" DataFrames
The available heatmap
plot from Plots.jl
is built with a particular "shape" of data in mind: the user will define:
- x - the set of m unique x axis labels
- y - the set of n unique y axis labels
- z - an m-by-n shape of data values (usually a Matrix)
But this isn't the shape of the data in the most common scenarios in which I want a heatmap. The shape I usually find myself in is having a DataFrame with
- an X column with n copies of m x-axis labels
- a Y column with m copies of n y-axis labels
- a Z column of m-by-n data values, one for each distinct X and Y pair
In other words, the DataFrame is "long" rather than "wide".
What I think would be nice is some "recipe" in which the user can provide:
- x - a column to use for x-axis labels
- y - a column to use for y axis labels
- z - a column to use for colouring
Right now, my workaround is to use unstack
on the DataFrame before plotting, but this is a bit ungainly.
That makes sense, should be pretty easy to implement
That could/should be done for contour, surface and wireframe as well.
Any update on this issue?