Hello All,
New to this group. Don't make a lot of graphs in my day-to-day work. Need some help making graphs that appear to be a little beyond my current abilities.
Attached is a code file that should help illustrate what I'm trying to accomplish.
I want to create a series of side-by-side graphs for oral chemotherapy among a set of cancer patients. The left side of each graph would show the unprocessed data for a given patient and drug. The right side would show what the data look like after processing. The processing combines overlapping intervals within each drug into a single interval. It then combines non-overlapping intervals that are separated by a sufficiently small amount of time into a single interval. For testing purposes, sufficiently small has been set to <= 63 days (three 21-day cycles).
The first plot generated by the attached code should do a pretty good job of showing what a left-side ought to look like. One of the purposes of this exercise is to depict graphically a specific principle. Specifically, the idea that, if you sequence the start dates and end dates for a set of overlapping intervals, the end of a combined interval will always occur where the number of start dates equals the number of end dates. Hence the counts at the bottom of the graph. Hopefully the graph will help make clear why this should be the case.
The second plot does a less of a good job showing what a right side ought to look like. Hopefully it will be sufficient for practical purposes though. The main deficiency I think is that the scaling for the y-axis is a bit off. If the best way to depict the before and after picture is to have side-by-side graphs, then I imagine the y-axis scaling for the right side will be set to match the y-axis scaling for the left side. Based on what I think I know about ggplot2, it occurred to me that a solution might automatically set the scaling for the y-axis on the right hand side to match that on the left. I could very well be wrong about that though.
One thing I'm struggling with is the scaling of the x-axis on both graphs. In neither case, does it reflect the time/date data. In the first graph, this obscures the fact that only 2 days elapse between 2014-08-04 and 2014-08-06 (which is <= 63). So it might not be immediately intuitive why there is only one interval on the right-hand side and not two.
The x-axis on the right side graph is also showing years and not start dates and end dates.
Given that I don't make all that many graphs, I'm also open to the possibility that my idea of having a left and right side isn't the best way to depict the before and after picture. So I'd be quite interested in seeing other ideas from people who have a better sense of how to go about designing a good graph.
Thanks,
Paul