Skip to content


breaks on original or transformed data #373

kohske opened this Issue · 5 comments

3 participants


Please see also hadley/scales#9

Automatic pretty break is convenient in most cases, but as I mentioned above, at the moment it is somewhat confusion in scales with transformation w.r.t the data space.

Users may want a pretty breaks on the original data space or on the transformed data space.
This choice should be done explicitly.

I would propose one extra option, i.e., users can choose the pretty breaks on the original or transformed data.
Then, the continuous_scale will be:

continuous_scale(..., breaking = c("original", "transformed"))

name should be considered.

If original, then it has pretty breaks on the original data range.
If transformed, then it has pretty breaks on the transformed data range.

OR, maybe, breaks can accept a character specifying the data space.
I like the former style though.

Also, major and minor breaks may as well have their own basis.
There are many examples of such plot even in the wikipedia:

But the example in the wikipedia is more special...


Isn't this what trans_breaks does? The default in ggplot2 is to space major breaks evenly in the transformed space, and the minor breaks evenly in the data space.


OK, I see.
Here is the example:

p <- qplot(seq(1, 1e4, len = 10), seq(1, 1e5, len = 10)) + geom_line()
# on original data space
p + scale_x_log10()
# on transformed data space
p + scale_x_log10(breaks = trans_breaks(log10_trans()$trans, log10_trans()$inv))

is this what you mean?

Maybe this is somewhat complicated.
As the scale_x_log10 already knows the trans/inv, so it should be written like this:

p + scale_x_log10(breaks = trans_breaks())
@kohske kohske added a commit to kohske/ggplot2 that referenced this issue
@kohske kohske scale breaks: automatic transformed scale (#373) 2848e39

Here is an experimental implementation above.

p <- qplot(seq(1, 1e4, len = 10), seq(1, 1e5, len = 10)) + geom_line()
p + scale_x_log10()
p + scale_x_log10(breaks = auto_break_trans())
# identical to
# p + scale_x_log10(breaks = trans_breaks(log10_trans()$trans, log10_trans()$inv))

funny, I had completely missed this discussion but ended up asking about the same issue and similar suggestions:


This sounds like a great feature, but unfortunately we don't currently have the development bandwidth to support it. If you'd like to submit a pull request that implements this feature, please follow the instructions in the development vignette.

@hadley hadley closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.