Stripchart with Stacked Points

157 views
Skip to first unread message

Dario Strbenac

unread,
May 22, 2014, 2:00:11 AM5/22/14
to ggp...@googlegroups.com
I have not been able to create a stripchart with stacked points, when they overlap. Can someone show a minimal example for points that are from two categories ?

My current code is :

ggplot(data.frame(expr = expression[geneRow, ], groups), aes(x = expr, y = groups)) + geom_point(aes(colour = groups)) + scale_colour_manual(values = c("red", "blue"))

Roman Luštrik

unread,
May 22, 2014, 6:05:50 AM5/22/14
to Dario Strbenac, ggplot2
Have you tried dotplot?


Cheers,
Roman




--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
In God we trust, all others bring data.

Dario Strbenac

unread,
May 22, 2014, 9:00:15 PM5/22/14
to Roman Luštrik, ggplot2
Thanks for the suggestion. I am creating a horizontal stripchart. It looks wrong, as you can see. None of the data is aligned to either category. If I simply switch the arguments to x and y in aes and set binaxis to "y", I get an appropriate vertical stripchart that is correctly aligned. Is it a bug ?
stacked.png

Roman Luštrik

unread,
May 23, 2014, 2:50:15 AM5/23/14
to Dario Strbenac, ggplot2
Can you distill your problem into a small, reproducible example?

Cheers,
Roman


On Fri, May 23, 2014 at 3:00 AM, Dario Strbenac <dario....@gmail.com> wrote:
Thanks for the suggestion. I am creating a horizontal stripchart. It looks wrong, as you can see. None of the data is aligned to either category. If I simply switch the arguments to x and y in aes and set binaxis to "y", I get an appropriate vertical stripchart that is correctly aligned. Is it a bug ?



Dario Strbenac

unread,
May 23, 2014, 3:00:23 AM5/23/14
to Roman Luštrik, ggplot2
Yes.

library(ggplot2)

ggplot(mtcars, aes(x = factor(cyl), y = mpg)) +
  geom_dotplot(binaxis = "y", stackdir = "centerwhole")

ggplot(mtcars, aes(y = factor(cyl), x = mpg)) +
  geom_dotplot(binaxis = "x", stackdir = "centerwhole")


I want the second version to be like the first, just horizontal.

I am using version 0.9.3.1.99 in R 3.1.0.

Roman Luštrik

unread,
May 23, 2014, 3:12:12 AM5/23/14
to Dario Strbenac, ggplot2
What if you add a `coord_flip()`?

ggplot(mtcars, aes(x = factor(cyl), y = mpg)) +
  geom_dotplot(binaxis = "y", stackdir = "centerwhole") +
  coord_flip()

Cheers,
Roman


Dario Strbenac

unread,
May 23, 2014, 4:00:15 AM5/23/14
to Roman Luštrik, ggplot2
Thank you. That resolves my problem. I need to learn more of the basics.
Reply all
Reply to author
Forward
0 new messages