Re: [R] Reg: Help in assigning colors to factor variable in ggplot2

2022-12-26 Thread Upananda Pani
Thanks Eric. You have found the error. It has saved my time. Grateful to you for your help and suggestions. Regards, Upananda On Mon, Dec 26, 2022 at 7:59 PM Eric Berger wrote: > Your problem is that the color "#4DAF4A8" is not a valid color. It should > have only 6 hex digits. > e.g. "#4DAF4A

Re: [R] Reg: Help in assigning colors to factor variable in ggplot2

2022-12-26 Thread Upananda Pani
Hi John, Greetings! I am grateful to your suggestions. I have fixed the error as per your suggestions. Many thanks to you for saving my time. With sincere regards, Upananda Pani On Mon, Dec 26, 2022 at 9:09 PM John Kane wrote: > Here is a rough guess at what you may want with a bit of mock da

Re: [R] Reg: Help in assigning colors to factor variable in ggplot2

2022-12-26 Thread Upananda Pani
Hi John, Thanks for your reply. I have tried the following code. ```{r} ggplot(ICUData[-398,], aes(x=temperature, y=heart.rate, colour=outcome)) + ## shape = 19: somewhat larger point ## alpha = 0.4: strengs of blending geom_point(shape=19, alpha=0.4) + ## colors scale_colour_manual(val

Re: [R] Reg: Help in assigning colors to factor variable in ggplot2

2022-12-26 Thread John Kane
Here is a rough guess at what you may want with a bit of mock data and using ggplot2. ##=# library(ggplot2) library(RColorBrewer) dat1 <- data.frame(aa = sample(1:10, 20, replace = TRUE), bb = sample(21:30, 20, replace = TRUE), o

Re: [R] Reg: Help in assigning colors to factor variable in ggplot2

2022-12-26 Thread John Kane
I suspect you may be mixing *plot()* commands with *ggplot()* commands and they are likely incompatible. Could you supply some sample data and any error messages that you are getting? A handy way to supply some sample data is the dput() function. In the case of a large dataset something like dpu

Re: [R] Reg: Help in assigning colors to factor variable in ggplot2

2022-12-26 Thread Eric Berger
Your problem is that the color "#4DAF4A8" is not a valid color. It should have only 6 hex digits. e.g. "#4DAF4A" will work. Also you seem to be confused about ggplot. You are not using ggplot in your code at all. You are using base graphics. You can remove the 3 library calls. HTH, Eric On Mon,

[R] Reg: Help in assigning colors to factor variable in ggplot2

2022-12-26 Thread Upananda Pani
Dear All, I am trying to plot a scatter plot between temperature and heart rate and additionally marking the outcome of the patients by colors. I am using the standard package Use the standard function plot as well as the functions of package "ggplot2" (Wickham (2009)). Save the plots in pdf file