Advanced Graphics I

polygon Polygon is a such handy function in R for drawing beautiful charts where we can select regions (polygons) of the surface. It's quite useful for indicating confidence regions of parameters, predictions for time-series, or areas under distributions:

4 Comments

  1. The following lines are not polite!

    # rm(list = ls()) # clear objects
    # graphics.off() # close graphics windows

    If I want to try out your code and I already have an R session open then the last thing I want is first destroying the results of my previous work. Although every sensible person would first open a new empty session for trying out a code found from a random blog, you can't count on it. And in that case, rm(list=ls()) would be useless anyway. This shows your attitude towards your readers: you seem to think that everything they do is worthless when compared to your precious code.

    And what if I send you the code starting with:

    # unlink("C:/", recursive = TRUE, force=TRUE)
    # to have a clear starting point

    Would that be nice? Uh?

    1. Dear Kenn, thanks for your remarks. I'll be more careful next time.

  2. Just add box() at the end of the script as the polygon overlaps with the x-axis 😉

    1. Thanks for pointing it out,YR.

Comments are closed.