Closed catriggwalk closed 5 years ago
I would still suggest the addition of labels to this chart as an enhancement for future consideration. Meanwhile, one of my local authority contacts worked out how to do this without making a mess of the key, by adding:
+geom_text(label=df$Value_rounded, nudge_y=-1)
Hi @DavidNphe - apologies, I don't think I've been getting notifications from this repo. Yes, this should be possible. I'll look to do this in the next release of the package.
I've added a display.values
argument to compare_areas()
. This is available in the dev version of the package if you want to start trying it out. (4daad99ca340fc45dc4aa7ed174e265014d465aa)
Many thanks @sebastian-fox . I've checked this in the development version and it works.
Anyone who wants the values at the inside right end of the bars can still achieve this via the workaround that my GM colleague devised ie adding the following after compare_areas()
+geom_text(label=df$Value_rounded, nudge_y=-1)
By the way, it took me about 25 minutes to install the development version using devtools. I kept getting error messages about being unable to remove existing versions of dependent packages. This was the case when I chose the option to update only CRAN packages or the option to update all. I kept restarting R to resolve this. I had to install some dependent packages manually ie by entering install.packages(...) This may be because I am not very good at keeping packages up to date. I tend to work on the "if it ain't bust don't fix/update it" approach. I doubt this will be a problem with the next production version but I thought it might be worth mentioning.
Thanks again, David
Would it be possible to add value labels to the "compare areas" chart? This would make the chart more like the "compare areas" view on the Fingertips site.
I have been able to add value labels by adding a rounded version of the "Value" to the df dataframe, named "Value_rounded" and then adding the the following at the end of the compare_areas() but this seems to make a mess of the key:
+geom_text(mapping = aes(label=df$Value_rounded, size=4, lineheight=1, hjust=2)