Closed grantmcdermott closed 9 months ago
The main combination that I'm missing from type
is "h"
with "p"
in oder to obtain "lollipop" style plots. I like these for discrete distributions or short time series of counts etc. For example:
x <- 0:7
p <- dpois(x, lambda = 1.4)
plot(x, p, type = "h")
points(x, p, pch = 19)
But maybe it is overkill to support a vector or list for type
. Also, this type
vector is only simple to process if other arguments (like col
, lwd
, lty
, pch
, etc.) are handled in the same way for both types. Otherwise the specification of arguments may become rather complex.
An alternative for the particular combination of "h"
and "p"
would be to support a new type = "i"
(where "i"
resembles the line with a point on top).
Oooh, I like the idea of a type = "i"
. The perfect symbol for it.
I take your wider point too about rolling our own combination types internally and this being potentially less complicated. Maybe type = "plm"
for points + lm() prediction line, for example?
Good idea. I would use either type = "%"
(to resemble points with a line through it) or type = "f"
for a model fit. Then we can potentially provide different kinds of fits, e.g., "lm"
, "loess"
, "gam"
, etc.
These are great ideas. Let me close this issue and instead open up a dedicated "Supported types" issue, where we can list all of the ideas in one place (and tick them off as we add them.)
Update: It's here https://github.com/grantmcdermott/plot2/issues/97
Please feel free to edit/add as you see fit @zeileis.
The type="i"
idea might be a nice and simple one to roll in before the plot2 v0.0.4 release if you have time. No rush, though.
(RE: v0.0.4. I'm taking a crack at formula support for facets, since that's the last thing I want to add before release. But I'm setting myself a deadline of only a few days, since this new version has been delayed long enough by #94.)
Would be cool if we could do something like:
Obviously, for this particular case we could just use
type = o
as a workaround. But I'm thinking more as convenience feature for combining, say, points with ribbon plots. (And, as opposed, to calling another plot withadd= TRUE
.)... OTOH are there many cases where this would be useful? Especially given that, for some of the canonical "combination" plots that I can think of (e.g., regression best-fit line with raw data points), the different types actually require different y values.