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

How to color bars in histogram? #8

Open
EarlGlynn opened this issue Mar 22, 2018 · 4 comments
Open

How to color bars in histogram? #8

EarlGlynn opened this issue Mar 22, 2018 · 4 comments

Comments

@EarlGlynn
Copy link

In the "Calculation functions" section you show a histogram with a scale on the left and a color legend on the right. This color legend is not needed and is not conventional with histograms (IMHO). The color legend doesn't add any information that's not in the scale at the left.

But how can I change the bars in the histogram to some constant color? Why doesn't something like fill="red" work?

@edgararuiz-zz
Copy link
Owner

edgararuiz-zz commented Mar 23, 2018

Hi, thanks for your feedback! Not sure why is not working for you. The only thing I can think off is that the fill argument needs to be "outside" the aes() function, for example: geom_col(aes(arr_delay, count), fill = "red"). Here is a full example that worked on my machine:

flights %>%
  filter(arr_delay < 100 , arr_delay > -50) %>%
  db_compute_bins(arr_delay) %>%
  ggplot() +
  geom_col(aes(arr_delay, count), fill = "red")

@EarlGlynn
Copy link
Author

You were right. I had tried "fill" in the wrong place. BTW, is there any parameter to, or some sort of modification, that allows changing the default color of a histogram using dbplot_histogram directly?

dbplot functions have worked well for me on tables of ~400 million records so far. Hope to see if it works on several billion records in the near future. Thanks for writing dbplot!

@edgararuiz-zz
Copy link
Owner

That's great to hear! Thank you.

Let me see what I can do regarding additional parameters for dbplot_histogram(). It may be that we could just pass additional arguments passed to dbplot_histogram() directly to the geom, the only challenge would be to decide if we're to have a way to know if the parameter should go inside or outside aes()

@filipwastberg
Copy link

Maybe just a fill_manual or color_manual argument inside dbplot_? To emphasize that the parameter is outside aes()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants