bokeh / rbokeh

R interface to Bokeh http://hafen.github.io/rbokeh/
Other
313 stars 66 forks source link

Allow changing timeseries data label format #95

Closed MySchizoBuddy closed 8 years ago

MySchizoBuddy commented 9 years ago

In the example provided

p <- figure(width = 800, height = 400) %>%
     ly_lines(date, Freq, data = flightfreq, alpha = 0.3) %>%
     ly_points(date, Freq, data = flightfreq,
            hover = list(date, Freq, dow), size = 5

The format of the x-axis timedate isn't changeable. At-least I didn't find anything in the ly_lines() or figure() function.

hafen commented 9 years ago

For finer control over axis labels, use x_axis() or y_axis(). Control over axis formats was added by @jrowen - see the documentation for the axis functions for details. We need to document this on the main page. Here's an example:

  p <- figure() %>%
    ly_lines(seq(as.Date("2012-01-01"),as.Date("2012-12-31"), by="days"), rnorm(366)) %>%
    x_axis(label = "Date", formats = list(months="%b-%Y", days="%d"))
jrowen commented 9 years ago

I should probably take a look at the main page. Which repo would be best to work with?

On Mon, Jul 13, 2015 at 9:17 AM hafen notifications@github.com wrote:

For finer control over axis labels, use x_axis() or y_axis(). Control over axis formats was added by @jrowen https://github.com/jrowen - see the documentation for the axis functions for details. We need to document this on the main page. Here's an example:

p <- figure() %>% ly_lines(seq(as.Date("2012-01-01"),as.Date("2012-12-31"), by="days"), rnorm(366)) %>% x_axis(label = "Date", formats = list(months="%b-%Y", days="%d"))

— Reply to this email directly or view it on GitHub https://github.com/bokeh/rbokeh/issues/95#issuecomment-120942332.

hafen commented 9 years ago

@jrowen that would be great if you are up for it.

The need is in this section: http://hafen.github.io/rbokeh/#axes

The docs are served here and are built with build.R:

https://github.com/hafen/hafen.github.io

jrowen commented 9 years ago

I'm having trouble building index.Rmd, and I think it is because of

load("_ignore/doubles.rda")

Should this chunk be removed/commented out? If not, an you check in this data file?

hafen commented 9 years ago

Oh yeah - I just added it, but put it in data/doubles.rda, so you can change the path. Thanks.

jrowen commented 9 years ago

Thanks.

I'm noticing that the Additional Parameters section of rd.Rmd is not formatting the subsections clearly. Any idea how this can be improved? One option would be to change dots-axis.R to use @section instead of \subsection for these subsections.

hafen commented 9 years ago

I've been meaning to do something about that. Yes, we could do @section for each and then remove "Additional Parameters" as it would be an empty section. Since we say things like "see additional parameters", we would need to change, for example, \subsection{Basic Tick Format} to \subsection{Additional Parameters: Basic Tick Format}.

hafen commented 9 years ago

Do you want to branch off of rbokeh master and make this change? Or I'm happy to do it.

jrowen commented 9 years ago

Since I'm in the midst of a PR for the website doc, it might make sense for me to also take a look at the rbokeh master (assuming this is a quick update). I can switch gears and pull together a PR for an rbokeh doc change, and then roll those updates into my website PR.

hafen commented 9 years ago

Sounds great. Should be a quick thing.

jrowen commented 9 years ago

I'm running into another error

Error in pkg_sd_path(pkg, site_path = site_path) : 
  Folder inst/staticdocs doesn't exist. Specify site_path or create a package folder inst/staticdocs.

Is there a folder missing from the core rbokeh project?

hafen commented 9 years ago

Oh this is a strange one from the staticdocs package. Just create an empty folder called 'staticdocs' in inst. I didn't check it in because it's not necessary for the package. But I suppose it should be checked in so that it's easier for others to build the docs.

jrowen commented 9 years ago

I'll just add

dir.create(file.path(code_path, "inst/staticdocs"))
hafen commented 9 years ago

Sounds good.