martin-borkovec / ggparty

147 stars 14 forks source link

default plot #10

Closed pfistfl closed 5 years ago

pfistfl commented 5 years ago

I think it would be really important to have a autoplot function, i.e. somewhat intelligently chosen defaults.

This could look like this for the lmtree:

data("TeachingRatings", package = "AER")
tr <- subset(TeachingRatings, credits == "more")

tr_tree <- lmtree(eval ~ beauty | minority + age + gender + division + native +
                    tenure, data = tr, weights = students, caseweights = FALSE)

autoplot(tr_tree,  col = tenure, shape = minority)

where col and shape default to the first elements in the formula, i.e. minority and age. (We could also leave col and shape out for now)

The resulting figure should be the same as the one in the README

pfistfl commented 5 years ago

Or also as an analogy to ggplot just call it qplot() ?

martin-borkovec commented 5 years ago

i think autoplot would be the better option. Will be implemented

pfistfl commented 5 years ago

This is actually a thing: https://www.rdocumentation.org/packages/ggplot2/versions/3.1.0/topics/autoplot