histogram bin on orginal scale but plot with x axis scaled by log2?

12 views
Skip to first unread message

Peng Yu

unread,
Jul 5, 2010, 12:21:59 PM7/5/10
to ggplot2
Hi,

I thought that scale_x_log2 scales after the data has been binned. But
it seems that it scaled first and then binned (i.e., the binwidth is
at the scale after log2 transform of x).

qplot(x, data=data, geom='histogram', binwidth=1)+scale_x_log2()+scale_y_log2()

Is there a way to bin the data first and then log2 transform x?

--
Regards,
Peng

Hadley Wickham

unread,
Jul 5, 2010, 5:30:26 PM7/5/10
to Peng Yu, ggplot2
Hi Peng,

You probably want coord_trans(x = "log2"). But a log scale on the
y-axis doesn't make any sense for a histogram because the bars start
at y=0.

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/

Reply all
Reply to author
Forward
0 new messages