Skip to content
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

Default to colorbar for continuous colour scales #555

Closed
hadley opened this issue May 11, 2012 · 4 comments
Closed

Default to colorbar for continuous colour scales #555

hadley opened this issue May 11, 2012 · 4 comments
Milestone

Comments

@hadley
Copy link
Member

hadley commented May 11, 2012

No description provided.

@wch
Copy link
Member

wch commented May 11, 2012

My feeling is that it's harder to visually match up colors on a continuous color legend. Perhaps this is something that deserves empirical study, e.g., see how accurately and quickly people can interpret graphs with with continuous vs. discrete guides.

@BrianDiggs
Copy link
Contributor

That seems to be an issue with representing a continuous variable with color (a feature that has been available for long time). This is just an issue of how the legend/guide is displayed. Now, even a continuous mapping between color and data is represented by a few discrete labeled values. The colorbar guide draws the whole (or at least many more levels so that it looks continuous) range of colors and labels a select few with the corresponding data value. The colors that would be used on the graph would be unchanged from the current approach.

That said, it would be interesting to see empirical data on determining the data value given the color comparing the current blocked legend versus a colorbar legend.

@wch
Copy link
Member

wch commented May 11, 2012

When there's a continuous colorbar, I find my eyes going back and forth between the legend and the data a lot, and without any practical gain in interpreting the data... For example, compare these:

ggplot(mtcars, aes(wt,mpg, colour=disp)) + geom_point(size=4)

ggplot(mtcars, aes(wt,mpg, colour=disp)) + geom_point(size=4) +
    guides(colour="colourbar")

Here's what it feels like I'm doing:

  • With the discrete legend, I can look at a point, then at the legend, at the point, and then at the legend again. Then I can say, that point is around 300 or so, maybe in the direction of 400.
  • With the colorbar, I look back and forth between the points and legend many more times, trying to find the exact point on the bar that matches the color of a point. But in the end, my interpretation of the values feels no more accurate than before. I think the gradient makes it difficult to accurately perceive a horizontal "line" of color on the legend -- the neighboring colors interfere with the perception of each line.

Of course, it would be nice to have data on this stuff.

Semi-unrelated issue: I noticed that the discrete legend has the larger values on top, while the continuous legend has smaller values on top. Is this difference intended?

@kohske
Copy link
Collaborator

kohske commented May 11, 2012

I agree Hadley's proposal.

The benefit of color bar is twofold.
First, colorbar guide itself will tell viewers that the color is continuous scale. This is quite important.
Second, it enables viewers create a complicated map (i.e., function) between value and color.
For example, try this:

ggplot(mtcars, aes(wt,mpg, colour=disp)) + geom_point(size=4) +
    guides(colour="colourbar") + scale_color_continuous(trans = "log10")
ggplot(mtcars, aes(wt,mpg, colour=disp)) + geom_point(size=4) + 
    scale_color_continuous(trans = "log10")

I imagine that few people will intend to show accurate value by continuous scale, e.g., few people will be interested in whether the point is 400, 399, or 401. By continuous color scale, viewer will be required to grasp the relation between each data point. For this purpose, gradient in the colorbar would be useful. If you want to show the precise value for continuous scale, you'd better to use other way, e.g., direct label.

Semi-unrelated issue: I noticed that the discrete legend has the larger values on top, while the continuous legend has smaller values on top. Is this difference intended?

Yes and no. When I write the colorbar, I followed Matlab style, so larger on top.

@kohske kohske closed this as completed in e6594a1 Jun 5, 2012
@lock lock bot locked as resolved and limited conversation to collaborators Jun 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants