added tinyplot.data.frame method#613
Conversation
grantmcdermott
left a comment
There was a problem hiding this comment.
Some specific (and high-level) thoughts in my review below. Happy to discuss!
| ## 2d: y ~ x | ||
| ## 3d: pairs? (not supported, yet) | ||
| if (is.null(formula)) { | ||
| if (ncol(x) > 2L) stop("'formula' is missing with no default for more than 2 columns") |
There was a problem hiding this comment.
Hmmm, I think we could do better than erroring out here. My own preference is that we either:
-
Subset to the first 2 columns and display the resulting simple two-way plot (maybe with a message), or
-
Subset to the first N (<=5?) columns and then internally implement the "manual" pairs-esque plot that you demonstrate in the Examples above (maybe with a message if any columns are dropped), or
-
Don't subset at all and just try to implement the "manual" pairs-esque plot you demonstrate above (but risk poor viewability/zooming.)
P.S. I don't think we should try to mimic base plot(df)/pairs(df) exactly. Apart from the top + right axes variation being a pain, I think your example shows several improvements, especially w.r.t. to the histogram and way that factor/character variables are handled consistently (barplots + spineplots).
P.P.S. If we go with option 2 or 3, one other thing to consider is whether we support an (atomic) by argument without a formula. E.g., tinyplot(iris, by = "species").
There was a problem hiding this comment.
You are right. I think we should just go for 3 and explain the limitations in the manual page.
There was a problem hiding this comment.
I have attempted to implement 3 now including some very simple setting of xlab, ylab, and main. It's not great but probably better than nothing. Further improvements would be welcome.
| #' or without a formula. The case with the formula mainly facilitates | ||
| #' using `tinyplot()` in combination with pipes. The case without | ||
| #' formula provides a quick way of plotting the variables in data frames, | ||
| #' either only one variable or a pair of variables. In the future, the |
There was a problem hiding this comment.
See my comment about the n>2 case below.
There was a problem hiding this comment.
I have updated it a little bit now. But depending on where we go with the pairs-esque display, further updates will probably be necessary.
|
Hi @zeileis, I made a few tweaks for the n > 3 case, which are more suggestions that than definitive choices. But want to push so you could test on your side. Let me know what you think (and feel free to push back if you feel strongly about anything):
MWE: plt(iris, theme = 'clean2')
|
|
An important (and deliberate) difference between our plot and The Personally, I'm not fond of the frames. But maybe an argument would also be useful here. Finally, you might want to have a stab at the additional |
|
Done. I added I need to get to bed but please kick the tyres and let me know if this looks good to you now. P.S. On the axis labels/titles. I initially tried to support an "outer" subplot labeling only; what you were referring to "margin" labels above. The trouble is that there's no way to do this consistently, In the |
|
Just had a very quick look, very nice!! Two short comments:
|
Done! I think that this is ready to be merged now. |
|
Thanks, this is fantastic. One more thought/question: Should we separate the functionality into a |
Sure, that sounds reasonable. |

Replaces #347
The new
data.framemethod fortinyplot()draws some inspiration from the corresponding method for baseplot(). It mainly facilitates usingtinyplot()with data frames and pipes.Currently, this only works for data frames with 1 or 2 variables. In the future we might add a pairs-style display as follows but this would require better handling of axes and their labels.
So far the PR only contains code and documentation. NEWS and tests can be added when we agree on the code.