Changing x value's scale in ggplot2 - r

I am undergoing my university dissertation and need to create some dive shape profiles for Yellowfin tuna. i have created the graph but am having issues with the scale of my X axis, as it is a time value and i have a 6 panel plot. My time-frame is in 5 minute intervals, adding up to 15 mins per graph. The time frames for my graph are as follows: (a)15-minute timespan 11:45AM-12 PM 20/1/2019. (b) 15-minute timespan 16:47-17:02PM 26/1/2019. (c) 15-minute timespan 16:40-16:55 8/2/2019. (d) 15-minute timespan 17:10-17:25 14/2/2019. (e) 15-minute timespan 16:15-16:30 26/2/2019. (f) 15-minute timespan 16:40-16:55 9/3/2019. Note that the dates do not matter necessarily, but would be an extra bonus to attach to my graph. Fixing the scale to 500m in depth would be fantastic also. Each of these panels, are a separate excel spreadsheet.

I'm a little unclear of what you're trying to do without more of an example but if you're trying to change the axis but look into ggplot scale_x_discrete()

Related

pixelwise rescaling of a time series using cumulative distribution function matching

I'm using R and I have a raster stack of surface soil moisture measurements from a radiometer on fixed on an observation tower. These data are daily values going back 10 years.
I also have another raster stack of satellite microwave measurements of soil moisture over a larger area going back 25 years. Both sensors have similar frequencies.
On a per-pixel basis, I would like to use a linear cumulative distribution function matching that rescales the satellite data against the tower data so that it would result in a longer time series of rescale satellite data.
This point is to correct for systematic differences between the soil moisture values and extend the time series. This is similar to what was done in the figure below where they matched the AMSR-E (blue plot) and ASCAT (red plot) data to Noah data (black plot).
Does anyone know how to implement this in R? Or at the very least help me get started? I've scoured the Internet and this website without success.

Interpretation of a graph created by the R package seas

I am relatively new to R studio and R in general, I am not even sure if this is the right place to ask this question. I was instructed to draw a graph showing seasonality using daily rainfall over a number of years. I need help more in interpreting the graph than in plotting it.
There is an example already in R using mscdata that I was able to replicate using my own data, the code for the example is as below. Any help with what this graph means or explains will be greatly appreciated.Thank you
install.packages(seas)
library(seas)
data(mscdata)
dat <- mksub(mscdata, id=1108447)
dat.ss <- seas.sum(dat, width="mon")
x<-mscdata
# Structure in R
str(dat.ss)
tail(mscdata)
# Annual data
dat.ss$ann
# Demonstrate how to slice through a cubic array
dat.ss$seas["1990",,]
dat.ss$seas[,2,] # or "Feb", if using English locale
dat.ss$seas[,,"precip"]
# Simple calculation on an array
(monthly.mean <- apply(dat.ss$seas[,,"precip"], 2, mean,na.rm=TRUE))
barplot(monthly.mean, ylab="Mean monthly total (mm/month)",
main="Un-normalized mean precipitation in Vancouver, BC")
text(6.5, 150, paste("Un-normalized rates given 'per month' should be",
"avoided since ~3-9% error is introduced",
"to the analysis between months", sep="\n"))
# Normalized precip
norm.monthly <- dat.ss$seas[,,"precip"] / dat.ss$days
norm.monthly.mean <- apply(norm.monthly, 2, mean,na.rm=TRUE)
print(round(norm.monthly, 2))
print(round(norm.monthly.mean, 2))
barplot(norm.monthly.mean,
ylab="Normalized mean monthly total (mm/day)",
main="Normalized mean precipitation in Vancouver, BC")
# Better graphics of data
dat.ss <- seas.sum(dat, width=11)
image(dat.ss)
This code gives a graph showing sample quartiles, annual rainfall but I don't really know what it means. Any help whatsoever will be appreciated
The Graph using the package seas is as below
Plot
I'll start with the top left graph :
You've probably guessed that each row is a year (as shown by the Y-axis) while day groups/months of the year are X-axis. The color of each box of the heatmap is proportionally darker according to the mm's worth of rain in that day group, with the scale being displayed on the far right. I assume the red X's mean missing values.
Top right is like a barplot with the sum of rainfall each year (row), just continuously plotted. The red bar should be the average precipitation overall (not sure about the orange one).
Bottom left is a bit more tricky. Think of it like you reordered the rows in each column to have the heaviest rainfall of the day group at the top (forgetting about the year info here). The Y-axis shows the quantiles. The quantiles' respective values change for each day group, so the lines you see on top of the plot indicate key rainfall values in mm (4,6,8,10,12). Indeed, If you look at the 2mm line (lowest one), you'll see that in January, about 20% of rainfalls (across all years) are below this threshold, while in the end of July, over 80% are below 2mm (expect less rainfall in the summer).
Lastly, bottom right is similar to the one above it. It's the sum of all rows, referring to the quantiles rather than years this time, resulting in the staircase pattern.
You'll notice that since the scale of the plot is the same as the one showing the average per year, the top of the staircase is outside of the plot...
Hope I made that clear enough.

Interpretation of hydroplot in R (package: "hydroTSM")

I want to analyze mean daily runoff data by means of a hydroplot.
I was able to write the code for the hydroplot.
plot(MeteoZ,main="Runoff (m³/s) for Bad Aibling, Glonn station",xlab="Time")
However, I am not very sure how to interpret it. I have 3 main questions:
Since my data was daily, how are the monthly/yearly time series made? Is that averaged per month/year? What does the y-axis represent?
Same question for the boxplots.
What is the value of the y-axis in the hydroplot? Proportion?

Excel 2010 - Two data series on same graph - continuing on x-axis with different colors

I need some help with Excel plotting
I have two sets of data, similar to the following (sorry for the poor formatting, I'm new here)
Point,Date,MaxCPU,PercentCPU
1,1/1/2016,400,50
2,2/1/2016,400,65
3,3/1/2016,400,75
4,4/1/2016,400,63
5,5/1/2016,600,75
6,6/1/2016,600,80
7,7/1/2016,600,68
etc
I want to plot the PercentCPU as a column graph using 2 data series (A and B, differentiated when MaxCPU changes from 400 to 600)
The first data series (Series A) is the PercentCPU for points 1 to 4 inclusive (Colour Blue), then I want to plot a second series (series B) using PercentCPU for points 5 - 7 inclusive (Colour Red)
I've seen plenty of help video's and help documents on how to do this they are not what I want as I need the second series B to continue on, on the x-axis after series A finishes
The net result is to have 1 continuous looking chart that has both series A and B on it, both with different colours but series B following on from series A, so that visually one can easily see the PercentCPU changes when MaxCPU changed from 400 to 600 (MaxCPU is not being graphed)
Try as I might, all I can get is series B plonking itself right on top of series A on the x-axis (line graph) or intermingling (column graph), I'm at a loss at how to get these two series side by side
Even trying a two series Y axis doesn't help, the graph still resorted to merging the two data series
How to get two data series on the same graph, one following the other along the x-axis, side by side, instead of both data series starting at the 0 x-axis origin?
Please enlighten me oh Excel guru's :-)
If you want different colored lines, use a different series for each line. The easiest way to achieve that is to arrange the data into separate columns, one column for each series. This can be done in a helper table on a separate sheet, using formulas that reference the original data.
For correct X axis placement on a category x axis, ensure that all rows of data are included in the series, even empty cells.
To connect two series, you need two data points in exactly the same position, one in each series, so that they overlap.

3d surface plot in R, with z dimension changing over time

I have a dataset with a x-y-z structure.
X = age of arrival in the city
Y = year of arrival
Z = number of current survivors from X/Y combination
I have no problem plotting this for any given time using RGL in R. However I would like to introduce a time dimension.
I could of course make 23 plots and paste them together, but I would like to be able to manipulate the viewing on the fly, and treat the whole time series as one plot. I have Z values for 23 years. I also would like to colour my plot with an extra z2 variable, being z_year/z_(year-1). Is this possible within the RGl pakcage with some programming or is there a better package available?
Try creating a video like described on SO..
Alternative is a for-loop with a plot and delaying it -> look at ?Sys.sleep

Resources