You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
My apologies if this is not the right place to discuss this situation I am facing while using Geom.vline(). Also, not sure if this is a bug in the Gadfly package or in my code.
I want to make density plots of 2 different normal distributions and I want to use Geom.vline to represent the mean of these density plots. And I am using different colors to represent the densities. The density plots follow the same color as in the legend, but vline doesn't do that. Please advise
x1 = rand(Normal(0,1), 1000)
x2 = rand(Normal(1,1), 1000)
Gadfly.plot(
layer(x=x1, color = ["Population 1"], Geom.density),
layer(x=x2, color = ["Population 2"], Geom.density),
layer(xintercept = [mean(x1)], Geom.vline, color = ["Population 1"]),
layer(xintercept = [mean(x2)], Geom.vline, color = ["Population 2"])
)
The plot I get is below. Both of the vline's show the same "blue" color.
The issue still exists if I just make a single density plot and use vline for the mean
x1 = rand(Normal(0,1), 1000)
Gadfly.plot(
x=x1,
Geom.density, color = ["density"],
layer(xintercept = [mean(x1)], Geom.vline, color = ["mean"])
)
Thanks for the help!
The text was updated successfully, but these errors were encountered:
rkmalaiya
changed the title
Geom.vline not having the same color as the legends shows
Geom.vline not having the same color as shown in the legend
Apr 25, 2022
Yeah, indeed it does not capture the vline geometry color.
As a temporal solution, you may try defining a color for Geom.vline() and set manual scale color & legend:
Hello,
My apologies if this is not the right place to discuss this situation I am facing while using Geom.vline(). Also, not sure if this is a bug in the Gadfly package or in my code.
I want to make density plots of 2 different normal distributions and I want to use Geom.vline to represent the mean of these density plots. And I am using different colors to represent the densities. The density plots follow the same color as in the legend, but vline doesn't do that. Please advise
The plot I get is below. Both of the vline's show the same "blue" color.
The issue still exists if I just make a single density plot and use vline for the mean
Thanks for the help!
The text was updated successfully, but these errors were encountered: