How to change dotplot shape?

I have a data file with this basic structure:

Type Tm A 1 A 2 A 3 B 3 B 3 C 1 C 1 C 2 

I infer from it using:

 ggplot(data=df,aes(x = Tm,fill=Type)) + geom_dotplot(binwidth=1,method="histodot",stackgroups=TRUE) 

It works great. However, I wondered if it is possible to change the shape of the points from the default circles. For example, to make triangles A, B-squares and leave C circles by default. I tried various combinations of scale_shape but did not succeed. Sometimes I get various error messages, and sometimes nothing happens. This leads me to the conclusion that either I am doing something wrong, or that this is not even possible. Which of them?

change

A February 2013 comment by joran says it is not yet implemented. Have there been any events in this area over the past year and a half?

+8
source share
2 answers

Unfortunately, there is NO option for this, and it does not seem that there are any plans to make this option.

I am frankly shocked.

https://github.com/tidyverse/ggplot2/issues/1111

Perhaps Plotly has the opportunity.

0
source

I think you just need to play with the pch option at your points.

 #create A x <- sample(1:10, 3, replace=TRUE) y <- sample(1:10, 3, replace=TRUE) A <- cbind(x,y) #create B x <- sample(1:10, 4, replace=TRUE) y <- sample(1:10, 4, replace=TRUE) B <- cbind(x,y) plot(A, pch=11) # this will plot the points in A as stars of David points(B, pch=14) # this will add the points in B as triangles inside squares 

The best guide I've seen when changing the shape / graphic parameters of points is here: http://www.statmethods.net/advgraphs/parameters.html

Hope this helps.

-5
source

All Articles