similar to: combining bar and line plots with multiple axes

Displaying 20 results from an estimated 3000 matches similar to: "combining bar and line plots with multiple axes"

2013 Apr 18
1
Arranging two different types of ggplot2 plots with axes lined up
Hi all, I want to arrange two ggplot2 plots on the same page with their x-axes lined up - even though one is a boxplot and the other is a line plot. Is there a simple way to do this? I know I could do this using facetting if they were both the same type of plot (for example, if they were both boxplots), but I haven't been able to figure it out for two different types of plots. Below is my
2010 May 18
2
Function that is giving me a headache- any help appreciated (automatic read )
note: whole function is below- I am sure I am doing something silly. when I use it like USGS(input="precipitation") it is choking on the precip.1 <- subset(DF, precipitation!="NA") b <- ddply(precip.1$precipitation, .(precip.1$gauge_name), cumsum) DF.precip <- precip.1 DF.precip$precipitation <- b$.data part, but runs fine outside of the function: days=7
2006 May 18
2
matrix transformation into 3 columns II.
Dear R-users Sorry for posting the previous message too soon before I have finished it. I have matrix (mprecip) with headers: > dim(mprecip) [1] 6268 170 > mprecip date GilzeRijen Eindhoven Volkel ZuidLimburg Arcen Ubachsberg 1 01/01/1978 NA 0.0 NA 0.1 NA NA 2 01/02/1978 NA 0.0 NA 0.0 NA NA 3
2012 Oct 04
3
R combining vectors into a data frame but without a continuous common variable
Hello, I have two different files which I'd like to combine to make one data frame but I've no idea how to do it! The first file has two columns; one is the date, the following is a binary code for debris flow events. Then my other file has also two columns; the date and then precipitation data. The thing is, is that the two date columns don't all contain the same dates. The binary
2018 Apr 18
0
How to replace numeric value in the column contains Text (Factor)?
The simplest would be to convert precip to character and then back to a factor if you really want it to be a factor. This will also remove the levels that no longer exist. str(dat) # 'data.frame': 5 obs. of 3 variables: # $ Sites : Factor w/ 5 levels "Site1","Site2",..: 1 2 3 4 5 # $ temp : num 14 15 12 12.5 17 # $ precip: Factor w/ 5 levels
2005 Nov 15
1
combination xyplot and barchart?
Dear R community, I am having trouble determining how to create the graph I want utilizing my relatively limited knowledge of R. So far I have been using the lattice library to create most of what I need. The dataset (enviro) consists of 2 variables (Temp and Precip) for each Day of a 2-yr period (Year). I wish to display Temp and Precip along the y axis plotted by Day on the x axis to allow
2010 Apr 15
1
Alignment of x-axis labels
Dear all, I'm having trouble getting the correct spacing between x-axis labels on a barplot. This is the command I'm using to generate the plot: temp <- barplot(precip, beside=TRUE, xaxt="n", las=1, xpd=FALSE, col="grey28", ylim=c(0, max(precip))) Here is the structure of temp: > str(temp) ?num [1:96, 1] 0.7 1.9 3.1 4.3 5.5 6.7 7.9 9.1 10.3 11.5 ... And here
2006 Jan 16
1
label of second y-axis in xyplot (lattice)
Dear group, First I provide you with an example, I found in the newsgroup. Then I'd like to explain my problem to you by means of the output. enviro <- data.frame(Year = rep(2001:2002, each = 365), Day = rep(1:365, 2), Precip = pmax(0, rnorm(365 * 2)), Temp = 2 + 0.2 * rnorm(365 * 2)) xyplot(Precip + Temp ~ Day | Year,
2011 Feb 17
3
summing 15 minute precip data to daily
Hi all, i'm sure there is an easy way to do this, but i'm stumped, so any help would be appreciated. i have a single column of data for precipitation every 15 minutes over a year. i want to sum the precip to daily data. so the first 96 records = the first day, the second 96 records = the second day, and so on.... is there a way to write a for loop that would sum the data to daily, and
2010 Oct 19
1
Problems with a specific calculate.
Hello friends of R, My name is Toni, i'm 25 and I'm working on the Meteorological Investigation team from Balearic Islands. I had contact to you because I have a problem: I done a file for every day since 1912 about precipitation. That file has the following structure: > str(Ast) Loading required package: sp Formal class 'SpatialPixelsDataFrame' [package "sp"]
2018 Apr 18
3
How to replace numeric value in the column contains Text (Factor)?
Hi R user, Would you mind to help me on how I can change a value in a specific column and row in a big table? but the column of the table is a factor (not numeric). Here is an example. I want to change dat[4:5,3]<-"20" but it generated NA> do you have any suggestions for me? dat<-structure(list(Sites = structure(1:5, .Label = c("Site1", "Site2",
2009 Jul 12
1
variance explained by each predictor in GAM
Hi, I am using mgcv:gam and have developed a model with 5 smoothed predictors and one factor. gam1 <- gam(log.sp~ s(Spr.precip,bs="ts") + s(Win.precip,bs="ts") + s( Spr.Tmin,bs="ts") + s(P.sum.Tmin,bs="ts") + s( Win.Tmax,bs="ts") +factor(site),data=dat3) The total deviance explained = 70.4%. I would like to extract the variance explained
2010 Sep 15
1
Difficulty creating Julian day in data frame
Hi, I'm attempting to add a "Julian Day" column to a data frame. Here is my code and the resulting data frame: vic.data <- read.table("C:/VIC/data/vic.data.csv", header=F) names(vic.data) <- c("year", "month", "day", "precip", "evap", "runoff", "baseflow", "Tsup",
2011 Dec 09
3
ggplot with geom_tile
Dear R-users, I am trying to make a plot with ggplot-geom_tile(), but cannot remove some unwanted (white) lines through my plot. Below a reproducible example: ##### library(ggplot2) tot=as.data.frame(rep(seq(-50,50,5),each=21)) names(tot)="precip" temp=rep(seq(-5,5,0.5),21) tot$temp=temp disc=array(dim=c(21,21)) for(i in 1:21){ for(y in 1:21){ temp<-
2009 Jul 27
1
Creating new data frame using loop
Hi all, I sent a request round last week asking for help with using a "for" loop to read and separate a large dataset. The response I got worked great, but now I have another problem with using my loop. Basically I have a number of different files containing columned data. There are 132 datasets, named such that I have something in the form... precip_colxxx.txt ...where xxx is a
2004 Jun 30
1
funny plotting
Hi, I just wanted to plot a boxplot with a nice curve going through it, I thought this would be a simple task but for some reason I can't get the two graphs on the same page accurately. Enclosed is the code showing the two plots seperately and together. I would have thought it should work if I could use boxplot() then plot() overlayed but it won't allow the command add=TRUE (which
2007 Sep 10
1
overlay lattice histograms with goodness-of-fit pdfs
Hello, I am new to R exploratory data analysis and plotting. Is anyone aware of a way to overlay a set of conditional histograms with conditional PDFs? Below, I generate a lattice plot of precipitation histograms based on different months and stations, given a subset of the dataset: histogram(~ data | month * station, data = sta.stack[sta.stack[,"type"]=="precip" &
2009 Jan 08
1
Alignment of image plot overlay
I'm having trouble with alignment of a trend line overlayed onto an image plot. The two should be plotted on the same x-axis (time-series). However, the trend line begins about an inch into the image plot x-axis and ends about an inch off of end of the image plot. Once I have the alignment sorted, I need to put a secondary y-axis on the image plot which is scaled for the trend line. An
2008 Sep 04
2
using complete.cases() with nested factors
Hello, This maybe a newbie question. I have a dataframe that looks like the sample at the bottom of the email. I have monthly precipitation data from several sites over several years. For each site, I need to extract years that have a complete series of 12 monthly precipitation values, while excluding that year for sites with incomplete data. I can't figure out how to do this gracefully
2010 Nov 16
1
Force evaluation of variable when calling partialPlot
Greg, Two thoughts: 1. It might be possible that 'vars' is a reserved word of sorts and if you change the name of your vector RF might be happier 2. A way that works for me is to call importance as follows: sel.imp <- importance(sel.rf, class=NULL, scale=TRUE, type=NULL) and then use the 'names' of the imp data frame to be absolutely clear to RF you are talking about the