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

gt_plt_bar truncates small numbers #124

Open
lighthouseenergy opened this issue Apr 11, 2024 · 1 comment
Open

gt_plt_bar truncates small numbers #124

lighthouseenergy opened this issue Apr 11, 2024 · 1 comment
Assignees

Comments

@lighthouseenergy
Copy link

In creating a table with bar plots, gtExtras seems to truncate small values since it puts the values inside the bars.

For example,
my_tbl |> gt_plt_bar( column = bcr, color = "#EED31D", scale_type = "number", accuracy = 0.01, text_color = "black" ) |> gt_plt_bar( column = mw_2043, color = "#27AAE1", scale_type = "number", accuracy = 0.01, text_color = "black" )

Generated this:
Rplot

While expanding the width of the plot can help to a limited extent, I think it will ultimately be a problem with numbers of greatly varying scales.

Is it possible to specify right justification via passing hjust = 0 to the geom_text() in ggplot?

This would also provide an added benefit of aligning all numbers for easier readability across rows, resulting in something like this (from Excel):
image

Thanks!

@bhogan-mitre
Copy link

I ran into this today as well. If it's an easier fix, I think it would be very helpful to add the label_width parameter that gt_plt_bar_pct has to the gt_plt_bar function. I'm not sure if that meet's the original need here, but I wanted to mention it here first instead of adding it a separate issue.

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