Re: [R] Adding a legend to a (multi-facet) plot produced by ggplot().

2019-12-01 Thread Rui Barradas
Hello, Here are two ways of drawing the lines black and at the same time removing the lines in the legend. The second way is more idiomatic. 1. Override the colour setting in the ggplot call when drawing the lines: geom_line(aes(y = y1), colour = "black") + 2. Don't set the colour aestheti

Re: [R] Adding a legend to a (multi-facet) plot produced by ggplot().

2019-12-01 Thread Rolf Turner
On 2/12/19 5:08 pm, Rui Barradas wrote: Hello, Here are two ways of drawing the lines black and at the same time removing the lines in the legend. The second way is more idiomatic. 1. Override the colour setting in the ggplot call when drawing the lines: geom_line(aes(y = y1), colour = "bla

Re: [R] Still struggling with facet_grid_paginate() from package ggforce.

2019-12-01 Thread Rolf Turner
On 2/12/19 10:45 am, Rui Barradas wrote: Hello, Here are two ways. The first is an adaptation from your code. It uses facet_wrap_paginate, not *_grid_*. plotObj2 <- vector("list",2) for(pg in 1:2) {   plotObj2[[pg]] <- ggplot(egDat) +     geom_point(aes(y = obsd, x = x),  

Re: [R] Adding a legend to a (multi-facet) plot produced by ggplot().

2019-12-01 Thread Rolf Turner
On 2/12/19 3:03 am, Rui Barradas wrote: Hello, See if this is it. The standard trick is to reshape the data from wide to long, see the SO post [1]. Then add a scale_shape_* layer to the plot. yyy <- cbind(xxx, y3 = y3) long <- reshape2::melt(yyy, id.vars = c("x", "y1", "grp")) ggplot(lon

Re: [R] Still struggling with facet_grid_paginate() from package ggforce.

2019-12-01 Thread Rui Barradas
Hello, Here are two ways. The first is an adaptation from your code. It uses facet_wrap_paginate, not *_grid_*. plotObj2 <- vector("list",2) for(pg in 1:2) { plotObj2[[pg]] <- ggplot(egDat) + geom_point(aes(y = obsd, x = x), na.rm = TRUE, shape = 20, colour = "blue") +

[R] How to use preProcess in Caret?

2019-12-01 Thread Burak Kaymakci
Hello there, I am using caret and neuralnet to train a neural network to predict times table. I am using 'backprop' algorithm for neuralnet to experiment and learn. Before using caret, I've trained a neuralnet without using caret, I've normalized my input & outputs using preProcess with 'range' m

Re: [R] Adding a legend to a (multi-facet) plot produced by ggplot().

2019-12-01 Thread Antony Unwin
How about defining your dataset differently, making the colouring property a variable? xxx <- data.frame(x=rep(x, 4), y=c(y2, y3), grp=factor(rep(c("a","b"),each=20, times=2)), type=factor(rep(c("clyde", "irving"), each=40))) ggplot(xxx, aes(x,y, colour=type, shape=type)) + geom_point() + geom_

Re: [R] Adding a legend to a (multi-facet) plot produced by ggplot().

2019-12-01 Thread Jeffrey Pullin
Hi Rolf, Some code to produce the plot you want is here: https://gist.github.com/jeffreypullin/be752f11a136601ffecddc73ba0519b9 Hope you find it helpful. Personally I have found that the key to effective ggplot2 use is getting your data into the right format (one data.frame, tidy style) before

Re: [R] Adding a legend to a (multi-facet) plot produced by ggplot().

2019-12-01 Thread Rui Barradas
Hello, See if this is it. The standard trick is to reshape the data from wide to long, see the SO post [1]. Then add a scale_shape_* layer to the plot. yyy <- cbind(xxx, y3 = y3) long <- reshape2::melt(yyy, id.vars = c("x", "y1", "grp")) ggplot(long, aes(x, y = value, colour = variable, shap