[R] Question about ggplot2 symbol and legend change

Thierry Onkelinx thierry.onkelinx at inbo.be
Tue Oct 11 09:47:13 CEST 2016


Dear Luis,

Please don't post in HTML, it mangles the code.

You want something like

p + scale_shape_manual(values = c(16, 2))

Untested as you failed to provide a reproducible example.

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2016-10-11 4:25 GMT+02:00 Luis Fernando García <luysgarcia op gmail.com>:

> Dear R experts,
>
> Maybe my question is too basic and I apologize for that. I am having an
> issue currently by trying to change manually the symbols of the series. I
> need to put them manually, instead of using the symbols that R gives by
> default and produce a plot with the classic style. For example I need to
> put the symbols 16 and 2, but I have been unable to do it so far. Also, I
> need to remove the grey background from the seiries but I have been unable
> to do it too.
>
> Any help you can provide will be really helpful.
>
> Below, I am providing the script as well as the picture I gio with it If
> necessary I added the dataset.
>
> Many thanks
>
>
> ############################################################
> #####################
>
>
> it<-read.table("immotime.txt",header=TRUE)
> it
> str(it)
> names(it)
> fit3<-lm(Time ~ Sp*Ratio, data=it)
> anova(fit3)
> plot(fit3)
> summary(fit3)
> a$lPeso <- log(Peso)
> library(ggplot2)
> p <- ggplot(it,aes(x=Ratio,y=Time)) + geom_point(aes(shape=factor(Sp)))
> p=p + geom_smooth(aes(linetype=factor(Sp), ),colour="black", method='lm',
> se=F)+theme(panel.grid.major = element_blank(), panel.grid.minor =
> element_blank(),
>               panel.background = element_blank(), axis.line =
> element_line(colour = "black"))
> p
>
>
>
> ############################################################
> #####################
>
> Plot: https://postimg.org/image/3vm2uleip/
> dataset "it" http://textuploader.com/d593h
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help op r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list