Closed MrichardsPSRC closed 1 year ago
@Ennazus @chelmann
I adjusted my code by creating a reference variable:
# setting up reference values for visualization - testing
reference_val <- dt_2021 %>%
filter(HRACE=="Region")
ref_val <- reference_val$share
But with the bar chart, the label looks like this:
Based on this code:
own_race_chart <- static_bar_chart(t=dt_2021,
x="share", y="HRACE",
fill="HRACE",
pos="dodge",
est="percent",
# moe="share_moe",
href=ref_val, hrefnm="Region",
hrefcl='#00716c',
title="Homeownership by Race and Hispanic/Latinx Origin",
subtitle=NULL,
source="2021 American Commmunity Survey 1-year PUMS Data",
alt=NULL,
xlabel=NULL, ylabel=NULL,
dec = 2, color="psrc_light") + theme(legend.position = "none")
Is there a way to rotate the text and adjust the color to match the line? Similar to the example I provided above when I manually added the reference line?
Handled/made obsolete via commit #4a562d5. Example now in the FAQ vignette.
I set up the dataset to include the reference values as an additional column:
Then using the
static_bar_chart()
I incorporated the reference line arguments:Which produces an error message:
Error in href + annot : non-numeric argument to binary operator
Apparently referencing this part of the code:Which is referencing a part earlier in the code:
When I use the same code but adjust it, it works: