×
you are viewing a single comment's thread.

view the rest of the comments →

[–]iGotMyPhdInThis 5 points6 points  (4 children)

As always a great post gwern, well written, data and calculations posted, and the use of ggplot is a nice touch. I look forward to your next article.

[–]gwerngwern.net[S] 2 points3 points  (3 children)

and the use of ggplot is a nice touch.

You wouldn't happen to know how I could collapse the two plots into a single plot showing data points both by type and LLLT-status, would you?

[–]iGotMyPhdInThis 6 points7 points  (2 children)

I haven't played with R in about 6 months but I took a crack at it.

Originally I misread what you said, and combined the plots instead of collapsing them.

Then after some experimentation I think I got what you wanted, I had to add another dimension but I think this is the general idea of what you are looking for.

The first plot uses gridExtra.

require(gridExtra)

gg1 <- ggplot(df.melt, aes(x=time, y=value, colour=variable)) + geom_point()

gg2 <- ggplot(df.melt, aes(x=time, y=value, colour=LLLT)) + geom_point()

grid.arrange(gg1, gg2)

The second plot I assume you don't want to generate ;)

The third I passed df.melt as a parameter to geom_point with the data being highlighted by LLLT-status, this considering I made the background layer colored by data point type, then I added a third function to highlight the data point types, you can use any depending on what you're attempting to visualize but I used geom_smooth().

(forgwern <- ggplot(df.melt, aes(x=time, y=value, colour=variable)) + geom_point(data = df.melt, aes(x=time, y=value, colour=LLLT)) + geom_smooth())

Which yields this. I am guessing this is similar to what you're looking for, you may have to play with it for taste. You may be able to manipulate the size of the type points so the outer color is the type, and the inner color is LLLT-status but I have to resume working now and don't know how to do that off the top of my head.

Hope this helps gwern.

[–]gwerngwern.net[S] 2 points3 points  (1 child)

Which yields this. I am guessing this is similar to what you're looking for, you may have to play with it for taste. You may be able to manipulate the size of the type points so the outer color is the type, and the inner color is LLLT-status but I have to resume working now and don't know how to do that off the top of my head.

That third one is in fact pretty similar to what I was hoping for! I'm going to add it.

[–]iGotMyPhdInThis 1 point2 points  (0 children)

Glad to have helped.