For an R ggplot chart, how would I have the legend label be the value of a variable?
the below code makes a chart. There are blue bars with a grey line on top. Currently the legend says “Current Month” for the bar, but instead I want to use the value of a variable called reportYM1. I tried putting in reportYM1 without the quotes, but it showed up as reportYM1, not the value of the variable. The color of the bars turned to grey instead of blue as well for some reason.
Place geom_point() in the middle of dodged bars
I’m trying to draw points right in the middle of the two bars created by geom_col()
.
These bars are dodged however and need to be to the right of the group label, that’s why I’m using
just = 0
in geom_col()
. Moreover, I want to use position_dodge2()
so there is no padding between the bars. I know this can be done with position_dodge()
(see here), but that approach does not enable the dodged bars to be to the right of the ticks.
How can I add accurate error bars and round the x-axis labels of a bar graph in R?
I have been struggling to figure this out for a while. I have been attempting to add error bars to my bar graph and i’ve hit a roadblock. First, the error bars are not showing on every bar. Second, I’m not sure whats going on with the x-axis, I wanted the values to be rounded to one decimal point.