For one of my plots I wish for the axis to be negative logarithmic;
i.e, from 10^-2, 10^-3, ..., 10^-10. Sadly the ggplot2 coordinate
transforms do not seem to be stackable so:
scale_x_continuous(trans = c("log10","reverse"))
does not help. Hence I need to define my own transformation to
accomplish this. How can I go about doing this in a way that will
still leave me with nice axis labels and the such?
My attempt:
TransNegLog10 <- Trans$new("NegLog10", f = function(x) -log10(x),
inverse = function(x) 10^(-x), labels = function(x) bquote(10^.(-
log10(x))))
has been unsuccessful in the sense that labels are no longer 10^-2 etc
but rather 10^-<floating point>.
Regards, Freddie.
You best bet is to use the development version of ggplot2, and then
read the help for creating new transformations in the scales package:
install.packages("devtools")
library(devtools)
dev_mode()
install_github("ggplot2")
library(ggplot2)
library(scales)
?trans
Hadley
> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/