-
Notifications
You must be signed in to change notification settings - Fork 251
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
histogram(density = true)
and x_discrete(labels = ...)
incompatible ?
#1163
Comments
#1157 won't touch this behavior. I don't fully understand this use case. @AsileBcd could you describe why you're trying to do this and not using |
Another example that illustrates the issue. I think there is a case that discrete variables can be proportioned, what do people think? x_cont = [1,1,1,1,2,2,2,2,2]
x_disc = string.([1,1,1,1,2,2,2,2,2])
pa = plot(x=x_cont, Geom.histogram(density=true))
pb = plot(x=x_disc, Geom.histogram(density=true))
hstack(pa, pb) |
Sorry for the late answer. @tlnagy : My little example is a little bit silly obviously. The general idea is inline with @Mattriks idea: instead of computing the proportion before with a @bjarthur It also works for me, but if I am picky, the alignment of the labels is not right. x = [1,1,1,1, 2,2,2,2,2]
lab = Dict(1 =>"one", 2 => "two")
pa = plot(x = x,
Scale.x_continuous(labels = x -> lab[x]),
Geom.histogram(density = true),
Guide.xticks(ticks = collect(keys(lab))))
pb = Gadfly.plot(x = x,
Scale.x_discrete(labels = x -> lab[x]),
Geom.histogram(density = true))
hstack(pa, pb) |
you can hack around it with
|
I am trying to plot a histogram while giving labels to each histogram bar. There seem to be an incompatibility between
density = true
andx_discrete(label = ...)
On my computer, the
density = true
is ignored when I havex_discrete
, but works perfectly without latter. It looks like a bug to me, or is it a normal behavior? Thanks!The text was updated successfully, but these errors were encountered: