I have two time series (ts-variables) with different time length. It’s yearly data and they are stored as separate ts.objects. The first series starts in 1936 and the other starts in 1943 and both ends in 2012. Problem: I cannot find the R-script (commands) for plotting these series in one, single, nice figure which includes all observations. Great if someone can help.

Regards

If the data are on a comparable scale then you just need to set the x-axis limits to the range of the entire data, e.g.

```
set.seed(2) ## reproducible
dat1 <- data.frame(Year = seq(1936, 2012, by = 1), Y = runif(77))
dat2 <- data.frame(Year = seq(1943, 2012, by = 1), Y = runif(70))
ylim <- range(dat1$Y, dat2$Y)
xlim <- range(dat1$Year, dat2$Year)
plot(Y ~ Year, data = dat1, type = "l", col = "red", xlim = xlim,
ylim = ylim)
lines(Y ~ Year, data = dat2, type = "l", col = "blue")
```

I'll leave you to prettify the plot.

Just noticed you said `ts`

variables, so the following will work too

```
ts1 <- ts(runif(77), start = 1936, freq = 1)
ts2 <- ts(runif(70), start = 1943, freq = 1)
xlim <- c(1936, 2012)
ylim <- range(ts1, ts2)
plot(ts1, ylim = ylim, xlim = xlim, col = "red")
lines(ts2, col = "blue")
```

With **your** data, replace `runif(n)`

with the real data for the two time series.

Similar Questions

Assuming i have a series of column-vectors with different length, what would be the best way, in terms of computation time, to join all of them into one matrix where the size of it is determined by th

I am attempting to analyse a time series with spectral analysis. I am trying to detect any periodicities in my data, which is composed of hourly measurements recorded for one week (24 * 7 = 168 measur

I regularly build a data frame with time values (originating from xts or zoo objects) for analysis and plotting. Here's an example: library(xts) x1 <- xts(rnorm(10), as.Date(2012-01-01) + 0:9) x2

I have a similar question to the one posted here: Multiple data set plotting with matplotlib.pyplot.plot_date and this worked for me, but I want to plot more than 2 plots on the same figure. In my cas

My data is in the format of d [ Object, Object,.... ] where each object is of the form {count:5 time:1352961975 },where time is Unix Timestamp. I want to plot this on the basis of time as against the

I have a time-series dataset consisting of 10 variables. I would like to create a time-series plot, where each 10 variable is plotted in different colors, over time, on the same graph. The values shou

I'm reading a csv file of precipitation time series, the problem is when the time is 00:00. head(C1) fecha precip 1 09/04/2012 0 2 09/04/2012 0:05 0 3 09/04/2012 0:10 0 4 09/04/2012 0:20 0 5 09/04/201

I need some suggestions how to better design my problem’s resolution. I starting from many Csv file of result of parametric study (time series data). I want to analyze the influence of some parameters

Is it possible to create a time-series histogram like the one described in this presentation (slides 36-39) using either R or D3.js? Or is there a better way to show bucketed data as a time series? Ed

I have a time series object that goes from october to februrary. Below I show you some of the values of it. 1995-10-13 04:00:00 460.5 1995-10-13 05:00:00 549.9 1995-10-13 06:00:00 648.8 1995-10-13 07:

I this time series data( I am not able to dput. Because dput give a very long result, copying and pasting it here will make a mess) These are few lines from my text file: Time Depths ifc if lat lon

I see that Pandas does not allow duplicate time series indexes yet (https://github.com/pydata/pandas/issues/643), but will be added soon. I am wondering if there is a good way to apply rolling window

I just need the reverse of my Query raised at below link SAS Dehoc Query...Breaking Range Data I am having time series data and want to HOC it or want to convert it into range Please advise Thanks Hit

I am learning time series from the book by Cowpertwait and Metcalfe,Introductory Time series with R. Here is the ebook link: http://unalmed.edu.co/~ndgirald/Archivos%20Lectura/Archivos%20curso%20Ser

JSON data is not being plotted? Javascript: var datasets = JSON.parse(xmlhttp.responseText); alert(JSON.stringify(datasets[0])); var plotarea = $(#placeholder); $.plot(plotarea, [[datasets[0].points

I have the following data that is a time series collection of rain gauge readings. The Time Stamp is each time the rain gauge makes an increased count, and the Volume is the amount of rain added to th

I am having some trouble subsetting a time series object in r. 1.I imported a csv file into R as follows (after removing the date column in excel) sz.bm.df <- read.csv('size_book_25.csv',header=T)

I am trying to make a software that will, in real time, find the top N correlated time series windows (to a query series). There are approximately 5000 windows, each 34 rows in length. With respect to

As indicated in the title, I am wondering if the DTW (Dynamic Time Warping) could be used to calculate the DTW distance between two time series with missing values. Let's say the two time series are

I am trying to plot some data from a camera in real time using OpenCV. However the real-time plotting (using matplotlib) doesn't seem to be working. I've isolated the problem into this simple example:

[Edited to more clearly state root problem, which behaves differently if you use numpy 1.8 as dmvianna points out] I have a DataFrame that has time stamps add other data. In the end I would like to no

I am trying to use stl to get a breakdown of the seasonal and trend in my timeseries data. I have tick data, and I have created a ts object. I ran a SQL query to get the data in the below form >

I wanna combine three graphics on one graph. The data from inside of R which is nottem . Can someone help me to write code to put a seasonal mean and harmonic (cosine model) and its time series plo

I have sample code for question here: http://jsfiddle.net/pzamora/ztxPr/1/ I have different colors in my series, however I need them to appear in the legend series: [{ name: 'V Genes', data: [ { count

I am using different time series in order to plot a graph with recession bars. For the single graph it works fine. However, I would like to overlap the different time series in one single graph. I use

I would like to stretch time series to different length using SQL efficiently. Suppose I have the following data: SQLFiddle (PostgreSQL) -- drop table if exists time_series; create table time_series (

I'm working on a binary classification problem, and if each data instance has several time series of different metrics and there're also some other attributes. How to deal with the time series, treat

My problem is that I generate a time series from normal distribution and I plot my time series but I want to color in red the positive area between the time series and the axe X, the same for the nega

Let's say I have multiple time series for which I want forecasts. If I have the appropriate time-series object for each, I could fit (for the sake of example) an ARIMA model and so on. But, I know the

I have a 'master' panda dataframe that has a time series of 'polarity' values for several terms. I want to work with 4 of them, so I extracted 4 separate dataframes, containing the time series(same ti

I have a jQPlot line graph with three different series on it and am using the Highlighter plug in to show hover overs on the data points in each series. I'd like to use different options for highlight

I have a data frame with one column as date/time(stored internally as numeric) and other columns as numeric/integer and I want to plot data against date/time. Date/time in the data frame was populate

I'm trying to create a time series graph using Flot to compare two series of data. After including jQuery, jquery.flot.js, and jquery.flot.time.js, my code looks like: $(function () { var d1 = { label

I have a .csv file with four columns (NAME, ID, YEAR, VALUE, see example below) and want to do some time series plots using plot('YEAR', 'VALUE', type = 'b'). As some data between the YEARS in the tim

my question is simple. I would like to name the rows of a time series (two time series) data so that each rowname is repeated twice but with a -1 and -2 separating them so that it looks like this:

I'm trying to use the pandas library for time series analysis in python. My data is now stored as a list of dictionaries: mydata = [ { 'date': datetime.date(2013, 1, 1), 'snow_depth': 1.0, }, { 'date'

I have a data frame containing multiple time series of returns, stored in columns. The first column contains dates, and subsequent columns are independent time series each with a name. The column head

I am recently new to r programming and would like some help with plotting some data as a function of time. Here is my data: Total Dive Location Seal Dive Onset Time Pause Duration Descent Bottom Asce

I'm trying to use plot a line chart with multiple (3 to 5) series. Each of them covers a period that may or not cross (overlap) another line. http://jsfiddle.net/MicheleC/E4SnM/ I tried to define each

I've tried to use machine learning to make prediction based on time-series data. In one of the stackoverflow question (createTimeSlices function in CARET package in R) is an example of using createTim

I have a zoo time series in R: d <- structure(c(50912, 50912, 50912, 50912, 50913, 50913, 50914, 50914, 50914, 50915, 50915, 50915, 50916, 50916, 50916, 50917, 50917, 50917, 50918, 50918, 2293.8, 2

Lets say that for the past few months we have been selling 1000 different products. We log the performance of each product (i.e. how much money it generates) every 5 minutes. A day has 288 segments

I'm new to Python and I just came cross a tricky question when using pandas to resample some data. When I want to resample my time series data, it is very straightforward to apply the arithmetic mean

This question already has an answer here: How to plot a list of vectors with different lengths? 2 answers I am trying to plot four different series of vectors: 1) adm 7 9 46 11 52 29 25 62 2) p

can I somehow add a different style to a legend series? or make it display a gradient square instead of white space? For example look at fiddle below: chart: { }, xAxis: { categories: ['Jan', 'Feb', '

the question is how to plot two different plots simultaneously in matlab or octave. I have loop, during execution in that loop there are data which should be plotted in two different plots. After exec

I am plotting two graphs using gnuplot. First plot is actual data and the second one is the fitting of the data. The script I used for plotting this is shown here below: #!/usr/bin/gnuplot reset set t

I'm trying to capture some points within a bar. The points represent 36 values on a monthly basis for 3 years. The bars represent 3 values on a yearly basis for the same 3 years. If you run the code

I'm a beginner of Python related environment and I have problem with using time series data. The below is my OHLC 1 minute data. 2011-11-01,9:00:00,248.50,248.95,248.20,248.70 2011-11-01,9:01:00,248.7

I run into this problem again and again; Situation there is a (large) dataset with records tied to a date (or even time) and I have the need to plot this data over time. Problem The dataset only cont