ggplot generic without fortify

99 Views Asked by At

I have a data structure that I want to provide easy ggplot-ability for.

Usually you simply convert it into a data.frame by providing a fortify generic method, but in this case that would be huge, since my data is four-dimensional (n×n×v×v). A good fit for ggplot’s x and y aesthetics would be the 2nd and 3rd dimensions of that matrix, let’s call them, v1 and v2.

If v1 and v2 are known, a n×n matrix of points remains that can efficiently be converted into a 3×n×n matrix of coordinates and values, i.e. the final x, y and colour aesthetics.

So what I’d like to achieve is to call

mm <- MyClass(...)
ggplot(mm, aes(x = 'foo', y = 'bar'))

And ggplot internally doing (using the aes information)

xyc <- make.tidy(mm@data[, , 'foo', 'bar'])
0

There are 0 best solutions below