map.event.coords.to.plot | R Documentation |
Maps the (x,y) coordinates in the event space to the plotting space.
map.event.coords.to.plot( x = NA, y = NA, x.is.Date = FALSE, x.date.format = "%m/%d/%Y", adjust.for.earliest.date = TRUE, plot.type = c("baseR", "SVG")[1], suppress.warnings = FALSE )
x |
The x coordinate in the event space, either a |
y |
The y coordinate in the event space, thus a |
x.is.Date |
A |
x.date.format |
A |
adjust.for.earliest.date |
A |
plot.type |
Can be either "baseR" or "SVG" and specifies to which type of plotting the mapping applies. |
suppress.warnings |
Logical, if |
This is intended for advanced users only.
In the event space, the x coordinate can be either given as the number of
days since the first plotted event, or as an actual calendar date (either as a
Date
object or a string with a given format; a date may or may not be corrected
relative to the first displayed date). On the y coordinate, the plotting is
divided in equally spaced rows, each row corresponding to a single event or an element
of a partial CMA plot (one can specify in between rows using fractions). Any or both of
x and y can be missing.
A numeric vector with x and y components giving the plotting
coordinates, or NULL
in case of error.
cma7 <- CMA7(data=med.events[med.events$PATIENT_ID %in% c(1,2),], ID.colname="PATIENT_ID", event.date.colname="DATE", event.duration.colname="DURATION", event.daily.dose.colname="PERDAY", medication.class.colname="CATEGORY", followup.window.start=0, followup.window.start.unit="days", followup.window.duration=2*365, followup.window.duration.unit="days", observation.window.start=30, observation.window.start.unit="days", observation.window.duration=365, observation.window.duration.unit="days", date.format="%m/%d/%Y", summary="Base CMA"); plot(cma7); # Add a transparent blue rect: rect(map.event.coords.to.plot(x=270), get.event.plotting.area()["y.min"]-1, map.event.coords.to.plot(x="03/15/2037", x.is.Date=TRUE, x.date.format="%m/%d/%Y"), get.event.plotting.area()["y.max"]+1, col=adjustcolor("blue",alpha.f=0.5), border="blue");
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.