You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plotting (with lines/points) a second set of data that is at different time points (i.e. xts2 below is 60 days between data points) to the first dataset (xts1 has 90 days between observations) results in the error:
Error in xy.coords(x, y) : 'x' and 'y' lengths differ
Expected behavior
Both curves/points plotted on the same chart. This was the previous behaviour of XTS.
Minimal, reproducible example
library(xts)
###### Create some data# 3 monthly datax1<- seq(from= as.Date('2000-01-01'), to= as.Date('2010-12-31'), by=90)
n<- length(x1)
y1<- (c(1:n) -n/2)^3xts1<- xts(y1, order.by=x1)
# 2 monthly datax2<- seq(from= as.Date('2000-01-01'), to= as.Date('2010-12-31'), by=60)
y2<- (c(1:length(x2)) -n/2)^3xts2<- xts(y2, order.by=x2)
###### Plots# Both datasets plot properly BY THEMSELVES# Example 1 & 2
plot(xts1)
plot(xts2)
# Example 3# This fails - 'xts1' first causes problems for 'xts1'
plot(xts1, main="XTS plot")
points(xts2)
# Example 4# This fails - 'xts2' plots, but then 'xts1' fails
plot(xts2, main="XTS plot")
points(xts1)
# Example 5# This works
plot.default(xts1, main="Default plot")
lines.default(xts2)
## Order seems important# Example 6
plot(xts1)
points(xts1) # This plot works
points(xts2, col="red")
# Example 7
plot(xts1)
points(xts2, col="red")
points(xts1) # Plotting after xts2 results in the same error
Allow users to add a series to an existing plot when the new series
has x-values that do not exist in the original series. The only
restriction is that the new series cannot extend the x-axis beyond its
original start/end range.
The new behavior is consistent with chart_Series(). It looks like its
removal was a regression created when the 'observation.based = TRUE'
feature was implemented.
Fixes#360, see #216.
Description
Plotting (with lines/points) a second set of data that is at different time points (i.e.
xts2
below is 60 days between data points) to the first dataset (xts1
has 90 days between observations) results in the error:Expected behavior
Both curves/points plotted on the same chart. This was the previous behaviour of XTS.
Minimal, reproducible example
Session Info
The text was updated successfully, but these errors were encountered: