Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

Setting x axis limits for time series data #100

Closed
echoe95 opened this issue Jul 14, 2015 · 3 comments
Closed

Setting x axis limits for time series data #100

echoe95 opened this issue Jul 14, 2015 · 3 comments

Comments

@echoe95
Copy link

echoe95 commented Jul 14, 2015

Hi I want to set the xlim for a rbokeh chart where the x axis is date.

##data generation
james<-mtcars[c("mpg")]
james$date<-seq(from=as.Date("2013-05-16"),to=as.Date("2013-06-16"),by="days")
date_vec<-c(as.Date("2013-05-22"),as.Date("2013-06-01"))
##plot without xlim
g<-rbokeh::figure(title="Cars",
                  width=800,
                  heigh=400,
                  xlab="date",
                  ylab="mpg") %>%
  rbokeh::ly_points(date,
                    mpg,
                    data=james) %>%
  rbokeh::ly_lines(date,
                   mpg,
                   data=james,
                   alpha=0.3)
g

The above works, I've tried

g<-rbokeh::figure(title="Cars",
                  width=800,
                  heigh=400,
                  xlab="date",
                  ylab="mpg",
                  xlim=date_vec) %>%
  rbokeh::ly_points(date,
                    mpg,
                    data=james) %>%
  rbokeh::ly_lines(date,
                   mpg,
                   data=james,
                   alpha=0.3)
g

and

g<-rbokeh::figure(title="Cars",
                  width=800,
                  heigh=400,
                  xlab="date",
                  ylab="mpg") %>%
  rbokeh::ly_points(date,
                    mpg,
                    data=james) %>%
  rbokeh::ly_lines(date,
                   mpg,
                   data=james,
                   alpha=0.3) %>%
  rbokeh::x_range(date_vec)
g

Neither works, it seems to be perhaps a date formatting issue. I originally asked a question on SO regarding what I'm trying to do(http://stackoverflow.com/questions/31407177/setting-xlim-for-rbokeh-plot-inside-shiny-application) but I think now that my issue pertains to rbokeh.

Let me know if you need any more details from me.

@hafen
Copy link
Collaborator

hafen commented Jul 14, 2015

Thanks for this report. It is indeed an rbokeh issue. It's an easy fix, which I've made and will merge shortly.

hafen added a commit to hafen/rbokeh that referenced this issue Jul 14, 2015
hafen added a commit to hafen/rbokeh that referenced this issue Jul 14, 2015
hafen added a commit that referenced this issue Jul 14, 2015
@echoe95
Copy link
Author

echoe95 commented Jul 14, 2015

Thanks!

@echoe95 echoe95 closed this as completed Jul 14, 2015
hafen added a commit to hafen/rbokeh that referenced this issue Jul 14, 2015
@hafen
Copy link
Collaborator

hafen commented Jul 14, 2015

This should be fixed now. Congrats on filling issue #100!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants