Dear R experts,
First than all I want to thank your expertise and for sharing your
knowledge with the people who are starting.
Recently I have been working on a new plot style (Jitterplot) but have
still some issues when making two basic functions.
First than all I want to change the symbol according to the prey type
(presa) and not the color, I tried making, geom_dotplot(aes(fill = PRESA)
but it did not work
On a second hand I want to sort the plots from the highest to the lowest
value, I tried by using reorder, but it did not work.
Please find attached the dataset and the script.
Thanks in advance!
####script######
the dataset is attached
library(ggplot2)
p=read.table("paratropis.txt",header=T)
attach(p)
ggplot( data = p, aes(y = Tiempo, x = PRESA, reorder(PRESA, Tiempo,
mean))) + # Move y and x here so than they can be used in stat_*
geom_dotplot(aes(shape = PRESA),
binaxis = "y", # which axis to bin along
binwidth = 0.1, # Minimal difference considered
diffeerent
stackdir = "center" # Centered
) +
stat_summary(fun.y = mean, fun.ymin = mean, fun.ymax = mean,
geom = "crossbar", width = 0.5)