Hello,
Three issues actually I'm just summing them up down here: !
#1 :
I have a dataset where I'm incrementing colour by a variable in the aes. I then annotate an expression on the graph which i want to force to plain old simple black ( If I don't force it my geom_text inherits the coloring of the aes. I'm forced to inherit the aes as when I tried to define a custom aes for that layer I have an error saying that the color variabile is not recognized)
Here's an example
reprex.data= data.frame(x= c(4.5, 3,3,3.5,3.5,4,4,0), y= c(4.5, 3,3,3.5,3.5,4,4,0), color= c("A","A","A","A","B","B","A","A"))
{windows(width = 8, height = 5)
ggplot(reprex.data, aes(x=x,y=y, colour= color, shape = color )) +
geom_point() +
geom_text(aes(label="Alpha[qq]%~~%10^10", x=1.5, y=-3), parse=T, colour= "black", size = 7)+
scale_color_viridis(option="B", discrete = TRUE, begin = 0.0, end = 0.85, direction = 1)+
geom_text(aes(label="(d)", x=0, y=5) , parse=T, colour= "black", size = 7)
}
If you look closely to the annotation text you'll notice that there seem to be 2 colours overlapping or 2 layers overlapping ? Is this a double print ?
At least it's the case in my R 3.4.3
#2 :
geom_text:
This works:
geom_text(aes(label="Alpha[qq]%~~%10^10", x=1.5, y=-3), parse=T, colour= "black", size = 7)
but as soon as I write an expression like
`"Alpha[qq]%~~%10^10 A"`
It fails. I need to be able to write the unit after my number. Any ideas ?
#3 :
Since I'm in the field of applied physics and engineering we often tend to have numerous sub plots
which you want to numerotate likr (a) (b) (c) etc.
And that's not at all straightforward in ggplot2
I'm forced to used annotate or geom_text as above, but anyone knows of a way that I can have it outside of my graph space ?
Ideally I want the annotation to be created always in the bottom left of my graph, aligned to the x and y axis titles.
I tried using caption pushing the hjust and vjust handles but you need to use negative values and it's not very reproducible from graph to graph.....
I'd like to try and make a template if possible.
Thanks in advance for your help !
M.