similar to: dual y-axis for ggplot

Displaying 20 results from an estimated 2000 matches similar to: "dual y-axis for ggplot"

2017 Oct 12
0
dual y-axis for ggplot
Sorry let me clarify. If I modify the line p <- p + geom_line(aes(y = air_temp, colour = "Temperature")) by p <- p + geom_line(aes(y = air_temp, colour = "Temperature", linetype ="Temperature")) and p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity")) by p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity",
2017 Oct 12
1
dual y-axis for ggplot
Hi John, You can try the following: override.linetype=c("twodash","solid") p <- ggplot(obs, aes(x = Timestamp)) p <- p + geom_line(aes(y = air_temp, colour = "Temperature", linetype ="Temperature")) p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity", linetype="Humidity")) p <- p +
2018 May 22
3
legend order in ggplot2
Hi, I'd like to graph three lines on ggplot2 and I intend the lines to be "solid", "dashed", and "dotted". The legend names are "name_b", "name_a", "name_c". I'd like to legend to present in the order: the "name_b" at the top, and "name_c" at the bottom. As a consequence, the legend is indeed in the order:
2017 Oct 17
2
ggplot / second axis / just a notation problem
Hi, I have a question on ggplot2 with the second axis, but I don't think one needs to know ggplot2 package in order to answer this question. In this example, https://rpubs.com/MarkusLoew/226759 since the transformation of the second axis is given by y1=y2*5, ##### p <- p + scale_y_continuous(sec.axis = sec_axis(~.*5, name = "Relative humidity [%]")) ##### Note
2017 Oct 17
0
ggplot / second axis / just a notation problem
Hi John, Why not just try both and see which one makes sense? On Tue, Oct 17, 2017 at 12:24 PM, John <miaojpm at gmail.com> wrote: > Hi, > > I have a question on ggplot2 with the second axis, but I don't think one > needs to know ggplot2 package in order to answer this question. > > In this example, > https://rpubs.com/MarkusLoew/226759 > since the
2018 Jul 18
2
Legendas en una gráfica de ggplot2
Buenas tardes, estoy haciendo una gráfica de múltiples lineas pero no he podido generar las legendas. Alguno de ustedes me podría colaborar. library(ggplot2) #### Con b=-2 t=seq (-4, 4, by=0.01) l=exp(t+2)/(1+(exp(t+2))) ##con b igual a -1 t=seq (-4, 4, by=0.01) o=exp(t+1)/(1+(exp(t+1))) ### Con b igual a 0.7 t=seq (-4, 4, by=0.01) i=exp(t-0.7)/(1+(exp(t-0.7))) ### Con b igual a 2 t=seq
2013 Feb 01
2
Change default order of colors & line types
Dear R users, I'd like to change the default order of colors & line types. Especially I am using ggplot2 and using color Set1. In Set1, the default color order is red, blue, green, violet,.. ect. However, I want to put red in fourth (not first). Likewise, I want to change the order of default linetype. I want to put "solid" line in fourth. How can I do thses? R code to draw the
2018 May 23
3
Change the legend order by order function
Hi, I'd like to graph three lines on ggplot2 and I intend the lines to be "solid", "dashed", and "dotted". The legend names are "name_b", "name_c", "name_a". I'd like to legend to present in the order: the "name_b" at the top, and "name_a" at the bottom. Could it be done by order function or its inverse?
2018 Jul 18
2
Legendas en una gráfica de ggplot2
¡Gracias! Espectacular. Me ha servido mucho. El mié., 18 de jul. de 2018 1:15 PM, Víctor Granda García < victorgrandagarcia en gmail.com> escribió: > Hola Sebastián. > > Entiendo que tratas de que aparezca una leyenda con el tipo de curva > (l,o,u,i). Si quieres aprovechar las ventajas de ggplot (como las leyendas > automáticas) normalmente tienes que asignar linetype a una
2018 May 22
0
legend order in ggplot2
Hi Your approach seems to me rather complicated. I would reshape data before plotting and maybe also change order of levels in resulting variable factor library(reshape2) dfm<-melt(df) dfm$variable<-factor(dfm$variable, levels=levels(dfm$variable)[c(2,1,3,4)]) p2<-ggplot(dfm, aes(x=rep(1:2,4), y=value)) p2+geom_line(aes(linetype=variable))+
2018 May 23
1
legend order in ggplot2
Hi, I ran your code, but the results were not as expected. After I ran the code by "source", it return No id variables; using all as measure variables > p2 and no line or legend is on the graph (as attached) Am I doing anything wrong? John library(ggplot2) library(reshape2) dfm<-melt(df) dfm$variable<-factor(dfm$variable, levels=levels(dfm$variable)[c(2,1,3,4)])
2016 Apr 09
1
Run script R
hi all ,? i have an problem in script R . But when I execute the script R I face this error . can you help me please ???error:----------------------------------------- Error in FUN(X[[i]], ...) :?? Theme element 'text' has NULL property: margin, debugIn addition: Warning messages:1: Removed 361 rows containing non-finite values (stat_smooth).?2: Removed 361 rows containing missing values
2009 Feb 18
1
lineplot in ggplot2 with different colour and linetype
Hi list, I would like to use ggplot2 in creating a line plot with 4 lines (groups), 2 of which I want in colour and the remaining two as dotted lines. ### R code ### library(ggplot2) ### create data #### vals <- rnorm(400) div<- c(rep("A",100),rep("B",100),rep("C",100),rep("D",100)) n<- rep(1:100,4) df<- data.frame(div=
2018 May 23
0
Change the legend order by order function
There are two key concepts you seem to be unaware of regarding ggplot: 1) you really need to put your data in long format to work with multiple curves, and 2) the column containing the names of the curves should be a factor with levels in the order you wish them to be presented in the legend (bottom to top). I am not in a position at the moment to give you a full reprex, but Google can probably
2012 Oct 22
1
how to group smooth line by two groups?
Hello, I have the following sample dataset. sex <- as.factor(c(rep(0,12),rep(1,12))) char <-
2011 Nov 08
2
nesting scale_manual caracteristics in ggplot
Hi there, I am having a little problem with combining three scale_manual commands in a facet plot. I am not able to combine the three different characteristics, instead ending up with three different descriptions next to the graph for the same geom. I would like to see two separate labels (not three); one describing lines 1-7 and the other 8-14. For each of the treatments (A-B) I want a
2008 Mar 25
1
Combining several mappings in ggplot2
Hello, I want to be able to make a plot that has several series with different color and linetype. Online documentation suggest that this is possible, but I haven't found how: "We can also create redundant mappings, mapping the same variable to multiple aesthetics. This is most useful when producing a graphic for both colour and black and white display." Here's what I have to
2017 Nov 29
3
Removing a data subset
Say I have a dataset that looks like Location Year GW_Elv MW01 1999 546.63 MW02 1999 474.21 MW03 1999 471.94 MW04 1999 466.80 MW01 2000 545.90 MW02 2000 546.10 The whole dataset is at http://doylesdartden.com/ExampleData.csv and I use the code below to do the graph but I want to do it without MW01. How can I
2013 Mar 06
6
Ggplot2: Moving legend, change fill and removal of space between plots when using grid.arrange() possible use of facet_grid?
Hi, # For publications, I am not allowed to repeat the axes. I have tried to remove the axes using: # yaxt="n", but it did not work. I have not understood how to do this in ggplot2. Can you help me? # I also do not want loads of space between the graphs (see below script with Dummy Data). # If I could make it look like the examples on the (nice) examples page: #
2017 Sep 26
2
Adding non-data line to legend ggplot2 Maximum Contaminant Level
Hello everyone, I have a plot showing chloride concentrations for various point over time. I also have a dotted line that show the Secondary Maximum Contaminant Level (my screening limit) on the graphs at 250 mg/L. But I can not figure out how to include the dotted line / Secondary Maximum Contaminant Level in the legend. Any thoughts? My code is as following and is linked to my data on the