Re: ggplot2 with both stat_binhex and scale_x_log10

90 views
Skip to first unread message

Dennis Murphy

unread,
May 17, 2013, 11:45:08 PM5/17/13
to afko...@gmail.com, ggplot2
I don't think anyone is in a position to help you without a
reproducible example. The obvious question is: what is the range of
matchlist and mismatchlist? One way to check, I guess, would be to do
the following:

g <- ggplot(unfilttable, aes(x=matchlist, y=mismatchlist)) +
stat_binhex(bins = 20)

# does any hexbin have an edge that drops below zero
# in either direction?
g

If so, you're going to get an error when trying to use a log scale in
that direction. If that's not the problem, we'll probably need a
reproducible example to uncover the problem.

Dennis

On Fri, May 17, 2013 at 9:35 AM, <afko...@gmail.com> wrote:
> Hello everyone.
>
> I'm trying to make a scatter plot with ggplot2, but I'm running into an
> issue.
>
> I want to use scale_x_log10 and scale_y_log10 to make both the axes
> logarithmic. I also want to use stat_binhex to show the density of points.
> My code works when I use either one without the other, but when I use both
> together, I get the following error:
>
> Error in if (!missing(xbnds) && any(sign(xbnds - range(x)) == c(1, -1)))
> stop("'xbnds' must encompass range(x)") :
> missing value where TRUE/FALSE needed
>
> My code is below. I'm running R version 2.15.2.
>
> library(ggplot2)
> g <- ggplot(unfilttable, aes(x=matchlist, y=mismatchlist))
> #g <- g + geom_point(shape=1)
> g <- g + stat_binhex(bins=20)
> g <- g + scale_x_log10()
> g <- g + scale_y_log10()
> g
>
> Is it possible (or reasonable?) to do the binhex thing on a log scale?
>
> Thanks,
>
> Alex
>
> --
> --
> You received this message because you are subscribed to the ggplot2 mailing
> list.
> Please provide a reproducible example:
> https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ggplot2" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ggplot2+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages