-
Notifications
You must be signed in to change notification settings - Fork 633
Support date-time binning in histograms #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -11,7 +11,7 @@ test_that("default position is translated to barmode=stack", { | |||
expect_identical(L$kwargs$layout$xaxis$type, "category") | |||
expect_identical(L[[1]]$type, "histogram") | |||
expect_true(L[[1]]$x[1] %in% c("CDN", "MEX", "USA")) | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, actually: indentation. This is the convention / automatically added in RStudio.
Both conventions (A: preserving indentation within a block and B: no indentation on empty lines) make sense, I once found a great thread on the topic on StackOverflow... Let me see if I can find it again.
Aside from the 3 lines with added whitespace, looks great! |
@alexcjohnson This one, I think: http://stackoverflow.com/questions/2727988/python-indentation-in-empty-lines |
If that's a standard R convention I guess we can keep it in this repo. In the rest of our code though we have always deleted trailing whitespace. I see the argument about python interpreters, but I think this has too much weight behind it and it keeps diffs much cleaner to insist on no trailing whitespace. |
Yes, I know. You probably even have a Anyway, it's a cultural thing and I wasn't trying to contaminate the rest of our code base. ;) |
Support date-time binning in histograms
@mkcor Even farther back than git - I have my editor set to strip trailing whitespace on every save. So I personally would have to override my editor settings (or just use RStudio) in order to work in this repo, or use something like http://stackoverflow.com/questions/3515597/git-add-only-non-whitespace-changes (wow, people really get riled up about this issue!). Anyway, the only reason I care about this is having to look at diffs with whitespace-only changes. As long as all contributors here agree to the same convention (looks like the blank lines were added by @chriddyp ) it's fine. |
When date-time durations are expressed with a numerical value, plotly's unit is the millisecond (ms).
This is different in R, where the
POSIXt
class uses seconds, and theDate
class uses days.This PR offers the corresponding conversions for the width (size) of (
x
) bins in histograms.See these successful
ggplotly
conversions when dates are of classPOSIXt
:https://plot.ly/~marianne2/336/deaths-by-police-across-time-by-region/,
when dates are of class
Date
:https://plot.ly/~marianne2/358/deaths-by-police-across-time-by-region/
/cc @chriddyp @alexcjohnson @jackparmer