'How do I fix the units in the legend of this stat_density_2d plot?
I've managed to create my first stat_density_2d plot:
ggplot(qual_colleges_all_data_clean, aes(x = UGDS, y = MD_EARN_WNE_P10), alpha = 0.4, size = 0.5) +
geom_point() +
stat_density_2d(aes(fill = ..level..), geom="polygon") +
scale_fill_gradient(low="lightblue", high="firebrick3") +
geom_smooth(method="loess", se=TRUE, formula = y~x, color="chartreuse1", fill="darkolivegreen2") +
labs(title = "Median Earnings By UGDS") +
scale_colour_hue(h = c(0, 280)) +
xlab(label = "UGDS") +
ylab(label = "Median Earnings 10 years After Entry")
In my data UGDS is a (numeric class) column of integers.
The plot looks fine, but I don't understand why the legend units are given as, e.g., "8e-09". How do I change the legend units to something more readily comprehensible (perhaps "more dense" and "less dense")?
Here's the str():
## tibble [1,121 × 25] (S3: tbl_df/tbl/data.frame)
## $ UNITID : num [1:1121] 159009 217721 198862 176406 158802 ...
## $ INSTNM : chr [1:1121] "Grambling State University" "Benedict College" "Livingstone College" "Tougaloo College" ...
## $ SCH_DEG : num [1:1121] 3 3 3 3 3 3 3 3 3 3 ...
## $ CCBASIC : num [1:1121] 18 22 22 21 21 22 18 19 19 18 ...
## $ ADM_RATE : num [1:1121] 0.972 0.768 0.501 0.707 0.388 ...
## $ ACTCM25 : num [1:1121] 16 15 14 15 19 14 16 16 15 15 ...
## $ ACTCM75 : num [1:1121] 20 19 16 22 23 17 19 18 19 19 ...
## $ SAT_AVG : num [1:1121] 981 933 854 969 1075 ...
## $ UGDS : num [1:1121] 4153 2034 1114 703 1215 ...
## $ COSTT4_A : num [1:1121] 25754 27927 28319 22594 31625 ...
## $ TUITIONFEE_IN : num [1:1121] 7683 16600 18296 10861 19281 ...
## $ TUITIONFEE_OUT : num [1:1121] 16706 16600 18296 10861 19281 ...
## $ AVGFACSAL : num [1:1121] 6352 5808 5408 4755 6472 ...
## $ PFTFAC : num [1:1121] 0.994 0.719 0.825 0.741 0.593 ...
## $ RET_FT4 : num [1:1121] 0.744 0.556 0.562 0.73 0.669 ...
## $ MD_EARN_WNE_P10 : num [1:1121] 33961 30951 30521 33291 37014 ...
## $ PCT25_EARN_WNE_P10: num [1:1121] 19299 19230 17973 20243 23757 ...
## $ PCT75_EARN_WNE_P10: num [1:1121] 50236 43045 45132 46866 52462 ...
## $ MD_EARN_WNE_P6 : num [1:1121] 27399 23174 24630 25088 29132 ...
## $ GRADS : num [1:1121] 1079 6 NA 8 NA ...
## $ RET_FT4_POOLED : num [1:1121] 0.734 0.56 0.53 0.738 0.678 ...
## $ C100_4_POOLED : num [1:1121] 0.105 0.18 0.152 0.22 0.269 ...
## $ INEXPFTE : num [1:1121] 3905 4224 5598 4884 7815 ...
## $ C150_4_POOLED : num [1:1121] 0.34 0.271 0.239 0.412 0.454 ...
## $ GRAD_DEBT_MDN : num [1:1121] 36750 34500 32875 32100 31250 ...
Thank you, most sincerely, for any help!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

