dewittpe / cpr

Control Polygon Reduction: Methods for quick and efficient placement of internal knots for B-splines and tensor products of B-splines.
http://www.peteredewitt.com/cpr/
2 stars 0 forks source link

Update plot.cpr_bs to use ggplot2 2.2.0 #18

Closed dewittpe closed 7 years ago

dewittpe commented 7 years ago

In the ggplot2_2.2.0 there is a new feature for plotting secondary axises. See if you can use this to plot the numeric value and the symbols for the knot locations.

You can display a secondary axis that is a one-to-one transformation of the primary axis with sec.axis.

gplot(mpg, aes(displ, hwy)) + 
  geom_point() + 
  scale_y_continuous(
    "mpg (US)", 
    sec.axis = sec_axis(~ . * 1.20, name = "mpg (UK)")
  )