1

I want to have my label each of my bars (horizontally) from my legend.

I also want to move my value labels to the top of the graph instead of the bottom.

below is my code and a picture of the plot.

ggplot(data= AZD.melt,
        aes(x = variable, y = value,
        stratum = id, 
        alluvium = risk_factors_for_stroke_in_blacks
        fill = risk_factors_for_stroke_in_blacks,
        colour = id,
        label = value)) +

geom_flow(stat = "alluvium", lode.guidance = "frontback",
         color= "white")+
geom_stratum(color = "white", width 0.7) +
geom_text(position = position_stack(vjust= 0.5), colour = "white")

Image from code

zephryl
  • 14,633
  • 3
  • 11
  • 30
ElHombre
  • 23
  • 4
  • 1
    To left-align labels in your bars, add `hjust = 0` inside `geom_text()`. To move the x axis to the top, add `+ scale_x_disctete(position = "top")` to your plot specification. – zephryl Jan 02 '23 at 04:21
  • @zephryl Well I want to add those labels on the legend to the left of my bars instead of having the legend. does hjust=0 do that? and I tried scale_x_discrete but I dont think I am putting it in the correct place. – ElHombre Jan 02 '23 at 04:43
  • @zephryl oh nvm I was able to figure out the scale_x_discrete part. is it possible to use scale_y_discrete for the horizontal labels? – ElHombre Jan 02 '23 at 04:50

0 Answers0