I want to plot minimum wage data by state and year in a bar chart similar to this plot in wikipedia
The data I used can be found here. The following code block should render the desired output but the scale on the x-axis which has the minimum wage is incorrect (the highest min wage value should be $16.1 in DC).
library(readxl)
library(tidyverse)
bzipmw <- read_excel("mw_state_monthly.xlsx")
bzipmw %>%
transmute(year = year(lubridate::fast_strptime(gsub('m', '',`Monthly Date`), '%Y%m')), state = `State Abbreviation`, mw = pmax(`Monthly Federal Minimum`, `Monthly State Minimum`)) %>%
distinct() %>%
filter(year > 2008) %>%
ggplot(data = ., aes(mw, state, fill = year)) + geom_col()
I can’t tell why geom_col()
has this issue as other plots like geom_point()
don’t have this problem. Using scale_y_continuous(limits = c(0,20))
causes most observations to get thrown out. Dividing mw
by 10 doesn’t help as the max should still be $16.1
ADDING MRE DATA:
bzip <- structure(list(year = c(2009, 2009, 2010, 2011, 2012, 2013, 2014,
2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2009, 2009, 2010,
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
2022, 2009, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
2018, 2019, 2020, 2021, 2022, 2009, 2010, 2011, 2012, 2013, 2014,
2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2009, 2010, 2011,
2012, 2013, 2014, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
2022, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018,
2019, 2020, 2021, 2022, 2009, 2010, 2011, 2012, 2013, 2014, 2015,
2016, 2017, 2018, 2019, 2019, 2020, 2020, 2021, 2021, 2022, 2022,
2009, 2009, 2010, 2011, 2012, 2013, 2014, 2014, 2015, 2015, 2016,
2016, 2017, 2017, 2018, 2018, 2019, 2019, 2020, 2020, 2021, 2021,
2022, 2022, 2009, 2009, 2010, 2011, 2012, 2013, 2014, 2014, 2015,
2015, 2016, 2017, 2018, 2019, 2019, 2020, 2021, 2022, 2009, 2009,
2010, 2011, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
2020, 2021, 2021, 2022, 2022, 2009, 2009, 2010, 2011, 2012, 2013,
2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2009, 2010,
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
2022, 2022, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
2018, 2019, 2020, 2021, 2022, 2009, 2009, 2010, 2011, 2012, 2013,
2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2009, 2009,
2010, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
2020, 2020, 2021, 2022, 2009, 2009, 2010, 2011, 2012, 2013, 2014,
2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2009, 2009, 2010,
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
2022, 2009, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
2018, 2019, 2020, 2021, 2022, 2009, 2009, 2010, 2011, 2012, 2013,
2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2009, 2010,
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
2022, 2009, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2015, 2016,
2016, 2017, 2017, 2018, 2018, 2019, 2020, 2021, 2022, 2009, 2009,
2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020,
2021, 2022, 2009, 2010, 2011, 2012, 2013, 2014, 2014, 2015, 2016,
2017, 2018, 2019, 2019, 2020, 2021, 2022, 2009, 2009, 2010, 2011,
2012, 2013, 2014, 2014, 2015, 2015, 2016, 2016, 2017, 2018, 2019,
2020, 2021, 2022, 2009, 2009, 2010, 2011, 2012, 2013, 2014, 2015,
2016, 2017, 2018, 2019, 2020, 2021, 2022, 2009, 2009, 2010, 2011,
2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022,
2009, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018,
2019, 2020, 2021, 2022, 2009, 2009, 2010, 2011, 2012, 2013, 2014,
2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2009, 2009, 2010,
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
2022, 2009, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
2018, 2019, 2020, 2021, 2022, 2009, 2010, 2011, 2012, 2013, 2014,
2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2009, 2009, 2010,
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2019, 2020,
2021, 2022, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
2018, 2019, 2020, 2021, 2022, 2009, 2009, 2010, 2010, 2011, 2012,
2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2020, 2021, 2021,
2022, 2022, 2009, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
2017, 2018, 2019, 2020, 2021, 2022, 2009, 2010, 2011, 2012, 2013,
2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2009, 2009,
2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020,
2021, 2022, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2016,
2017, 2017, 2018, 2018, 2019, 2019, 2020, 2020, 2021, 2021, 2022,
2022, 2009, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
2018, 2019, 2020, 2021, 2022, 2009, 2010, 2011, 2012, 2013, 2014,
2015, 2016, 2017, 2018, 2019, 2020, 2020, 2021, 2022, 2009, 2009,
2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020,
2021, 2022, 2009, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
2017, 2018, 2019, 2020, 2021, 2022, 2009, 2009, 2010, 2011, 2012,
2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2009,
2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
2020, 2021, 2022, 2009, 2009, 2010, 2011, 2012, 2013, 2014, 2015,
2016, 2017, 2018, 2019, 2020, 2021, 2022, 2009, 2009, 2010, 2011,
2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2021,
2022, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018,
2019, 2020, 2021, 2022, 2009, 2010, 2011, 2012, 2013, 2014, 2015,
2016, 2017, 2018, 2019, 2020, 2021, 2022, 2009, 2009, 2010, 2011,
2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022,
2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
2020, 2021, 2022, 2009, 2009, 2010, 2011, 2012, 2013, 2014, 2015,
2016, 2017, 2018, 2019, 2020, 2021, 2022), state = c("AK", "AK",
"AK", "AK", "AK", "AK", "AK", "AK", "AK", "AK", "AK", "AK", "AK",
"AK", "AK", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL",
"AL", "AL", "AL", "AL", "AL", "AL", "AR", "AR", "AR", "AR", "AR",
"AR", "AR", "AR", "AR", "AR", "AR", "AR", "AR", "AR", "AR", "AZ",
"AZ", "AZ", "AZ", "AZ", "AZ", "AZ", "AZ", "AZ", "AZ", "AZ", "AZ",
"AZ", "AZ", "CA", "CA", "CA", "CA", "CA", "CA", "CA", "CA", "CA",
"CA", "CA", "CA", "CA", "CA", "CA", "CO", "CO", "CO", "CO", "CO",
"CO", "CO", "CO", "CO", "CO", "CO", "CO", "CO", "CO", "CT", "CT",
"CT", "CT", "CT", "CT", "CT", "CT", "CT", "CT", "CT", "CT", "CT",
"CT", "CT", "CT", "CT", "CT", "DC", "DC", "DC", "DC", "DC", "DC",
"DC", "DC", "DC", "DC", "DC", "DC", "DC", "DC", "DC", "DC", "DC",
"DC", "DC", "DC", "DC", "DC", "DC", "DC", "DE", "DE", "DE", "DE",
"DE", "DE", "DE", "DE", "DE", "DE", "DE", "DE", "DE", "DE", "DE",
"DE", "DE", "DE", "FL", "FL", "FL", "FL", "FL", "FL", "FL", "FL",
"FL", "FL", "FL", "FL", "FL", "FL", "FL", "FL", "FL", "FL", "GA",
"GA", "GA", "GA", "GA", "GA", "GA", "GA", "GA", "GA", "GA", "GA",
"GA", "GA", "GA", "HI", "HI", "HI", "HI", "HI", "HI", "HI", "HI",
"HI", "HI", "HI", "HI", "HI", "HI", "HI", "IA", "IA", "IA", "IA",
"IA", "IA", "IA", "IA", "IA", "IA", "IA", "IA", "IA", "IA", "ID",
"ID", "ID", "ID", "ID", "ID", "ID", "ID", "ID", "ID", "ID", "ID",
"ID", "ID", "ID", "IL", "IL", "IL", "IL", "IL", "IL", "IL", "IL",
"IL", "IL", "IL", "IL", "IL", "IL", "IL", "IL", "IL", "IN", "IN",
"IN", "IN", "IN", "IN", "IN", "IN", "IN", "IN", "IN", "IN", "IN",
"IN", "IN", "KS", "KS", "KS", "KS", "KS", "KS", "KS", "KS", "KS",
"KS", "KS", "KS", "KS", "KS", "KS", "KY", "KY", "KY", "KY", "KY",
"KY", "KY", "KY", "KY", "KY", "KY", "KY", "KY", "KY", "KY", "LA",
"LA", "LA", "LA", "LA", "LA", "LA", "LA", "LA", "LA", "LA", "LA",
"LA", "LA", "LA", "MA", "MA", "MA", "MA", "MA", "MA", "MA", "MA",
"MA", "MA", "MA", "MA", "MA", "MA", "MD", "MD", "MD", "MD", "MD",
"MD", "MD", "MD", "MD", "MD", "MD", "MD", "MD", "MD", "MD", "MD",
"MD", "MD", "MD", "ME", "ME", "ME", "ME", "ME", "ME", "ME", "ME",
"ME", "ME", "ME", "ME", "ME", "ME", "ME", "MI", "MI", "MI", "MI",
"MI", "MI", "MI", "MI", "MI", "MI", "MI", "MI", "MI", "MI", "MI",
"MI", "MN", "MN", "MN", "MN", "MN", "MN", "MN", "MN", "MN", "MN",
"MN", "MN", "MN", "MN", "MN", "MN", "MN", "MN", "MO", "MO", "MO",
"MO", "MO", "MO", "MO", "MO", "MO", "MO", "MO", "MO", "MO", "MO",
"MO", "MS", "MS", "MS", "MS", "MS", "MS", "MS", "MS", "MS", "MS",
"MS", "MS", "MS", "MS", "MS", "MT", "MT", "MT", "MT", "MT", "MT",
"MT", "MT", "MT", "MT", "MT", "MT", "MT", "MT", "MT", "NC", "NC",
"NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC", "NC",
"NC", "NC", "ND", "ND", "ND", "ND", "ND", "ND", "ND", "ND", "ND",
"ND", "ND", "ND", "ND", "ND", "ND", "NE", "NE", "NE", "NE", "NE",
"NE", "NE", "NE", "NE", "NE", "NE", "NE", "NE", "NE", "NE", "NH",
"NH", "NH", "NH", "NH", "NH", "NH", "NH", "NH", "NH", "NH", "NH",
"NH", "NH", "NJ", "NJ", "NJ", "NJ", "NJ", "NJ", "NJ", "NJ", "NJ",
"NJ", "NJ", "NJ", "NJ", "NJ", "NJ", "NJ", "NM", "NM", "NM", "NM",
"NM", "NM", "NM", "NM", "NM", "NM", "NM", "NM", "NM", "NM", "NV",
"NV", "NV", "NV", "NV", "NV", "NV", "NV", "NV", "NV", "NV", "NV",
"NV", "NV", "NV", "NV", "NV", "NV", "NV", "NY", "NY", "NY", "NY",
"NY", "NY", "NY", "NY", "NY", "NY", "NY", "NY", "NY", "NY", "NY",
"OH", "OH", "OH", "OH", "OH", "OH", "OH", "OH", "OH", "OH", "OH",
"OH", "OH", "OH", "OK", "OK", "OK", "OK", "OK", "OK", "OK", "OK",
"OK", "OK", "OK", "OK", "OK", "OK", "OK", "OR", "OR", "OR", "OR",
"OR", "OR", "OR", "OR", "OR", "OR", "OR", "OR", "OR", "OR", "OR",
"OR", "OR", "OR", "OR", "OR", "OR", "PA", "PA", "PA", "PA", "PA",
"PA", "PA", "PA", "PA", "PA", "PA", "PA", "PA", "PA", "PA", "RI",
"RI", "RI", "RI", "RI", "RI", "RI", "RI", "RI", "RI", "RI", "RI",
"RI", "RI", "RI", "SC", "SC", "SC", "SC", "SC", "SC", "SC", "SC",
"SC", "SC", "SC", "SC", "SC", "SC", "SC", "SD", "SD", "SD", "SD",
"SD", "SD", "SD", "SD", "SD", "SD", "SD", "SD", "SD", "SD", "SD",
"TN", "TN", "TN", "TN", "TN", "TN", "TN", "TN", "TN", "TN", "TN",
"TN", "TN", "TN", "TN", "TX", "TX", "TX", "TX", "TX", "TX", "TX",
"TX", "TX", "TX", "TX", "TX", "TX", "TX", "TX", "UT", "UT", "UT",
"UT", "UT", "UT", "UT", "UT", "UT", "UT", "UT", "UT", "UT", "UT",
"UT", "VA", "VA", "VA", "VA", "VA", "VA", "VA", "VA", "VA", "VA",
"VA", "VA", "VA", "VA", "VA", "VA", "VT", "VT", "VT", "VT", "VT",
"VT", "VT", "VT", "VT", "VT", "VT", "VT", "VT", "VT", "WA", "WA",
"WA", "WA", "WA", "WA", "WA", "WA", "WA", "WA", "WA", "WA", "WA",
"WA", "WI", "WI", "WI", "WI", "WI", "WI", "WI", "WI", "WI", "WI",
"WI", "WI", "WI", "WI", "WI", "WV", "WV", "WV", "WV", "WV", "WV",
"WV", "WV", "WV", "WV", "WV", "WV", "WV", "WV", "WY", "WY", "WY",
"WY", "WY", "WY", "WY", "WY", "WY", "WY", "WY", "WY", "WY", "WY",
"WY"), mw = c(7.15000009536743, 7.25, 7.75, 7.75, 7.75, 7.75,
7.75, 8.75, 9.75, 9.80000019073486, 9.84000015258789, 9.89000034332275,
10.1899995803833, 10.3400001525879, 10.3400001525879, 6.55000019073486,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 6.55000019073486, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.5, 8, 8.5, 8.5, 9.25, 10, 11, 11, 7.25, 7.25, 7.34999990463257,
7.65000009536743, 7.80000019073486, 7.90000009536743, 8.05000019073486,
8.05000019073486, 10, 10.5, 11, 12, 12.1499996185303, 12.8000001907349,
8, 8, 8, 8, 8, 8, 9, 9, 10, 10.5, 11, 12, 13, 14, 15, 7.28000020980835,
7.25, 7.3600001335144, 7.6399998664856, 7.78000020980835, 8,
8.22999954223633, 8.3100004196167, 9.30000019073486, 10.1999998092651,
11.1000003814697, 12, 12.3199996948242, 12.5600004196167, 8,
8.25, 8.25, 8.25, 8.25, 8.69999980926514, 9.14999961853027, 9.60000038146973,
10.1000003814697, 10.1000003814697, 10.1000003814697, 11, 11,
12, 12, 13, 13, 14, 7.55000019073486, 8.25, 8.25, 8.25, 8.25,
8.25, 8.25, 9.5, 9.5, 10.5, 10.5, 11.5, 11.5, 12.5, 12.5, 13.25,
13.25, 14, 14, 15, 15, 15.1999998092651, 15.1999998092651, 16.1000003814697,
7.15000009536743, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.75, 7.75,
8.25, 8.25, 8.25, 8.25, 8.75, 9.25, 9.25, 9.25, 10.5, 7.21000003814697,
7.25, 7.25, 7.25, 7.30999994277954, 7.67000007629395, 7.78999996185303,
7.92999982833862, 8.05000019073486, 8.05000019073486, 8.10000038146973,
8.25, 8.46000003814697, 8.5600004196167, 8.5600004196167, 10,
10, 11, 6.55000019073486, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 7.75, 8.5, 9.25, 10.1000003814697, 10.1000003814697,
10.1000003814697, 10.1000003814697, 10.1000003814697, 12, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 6.55000019073486, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.75, 8, 8, 8.25,
8.25, 8.25, 8.25, 8.25, 8.25, 8.25, 8.25, 8.25, 8.25, 9.25, 10,
11, 12, 6.55000019073486, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 6.55000019073486,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 6.55000019073486, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 6.55000019073486,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 8, 8, 8, 8, 8, 8, 9, 10, 11, 11, 12, 12.75,
13.5, 14.25, 6.55000019073486, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 8, 8.25, 8.25, 8.75, 8.75, 9.25, 9.25, 10.1000003814697,
10.1000003814697, 11, 11.75, 12.5, 7.25, 7.5, 7.5, 7.5, 7.5,
7.5, 7.5, 7.5, 7.5, 9, 10, 11, 12, 12.1499996185303, 12.75, 7.40000009536743,
7.40000009536743, 7.40000009536743, 7.40000009536743, 7.40000009536743,
7.40000009536743, 8.14999961853027, 8.14999961853027, 8.5, 8.89999961853027,
9.25, 9.25, 9.44999980926514, 9.64999961853027, 9.64999961853027,
9.86999988555908, 6.55000019073486, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 8, 8, 9, 9, 9.5, 9.5, 9.64999961853027, 9.85999965667725,
10, 10.0799999237061, 10.3299999237061, 7.05000019073486, 7.25,
7.25, 7.25, 7.25, 7.34999990463257, 7.5, 7.65000009536743, 7.65000009536743,
7.69999980926514, 7.84999990463257, 8.60000038146973, 9.44999980926514,
10.3000001907349, 11.1499996185303, 6.55000019073486, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 6.90000009536743, 7.25, 7.25, 7.34999990463257, 7.65000009536743,
7.80000019073486, 7.90000009536743, 8.05000019073486, 8.05000019073486,
8.14999961853027, 8.30000019073486, 8.5, 8.64999961853027, 8.75,
9.19999980926514, 6.55000019073486, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 6.55000019073486,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 6.55000019073486, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 8, 9, 9, 9, 9, 9, 9, 9, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.15000009536743,
7.25, 7.25, 7.25, 7.25, 7.25, 8.25, 8.38000011444092, 8.38000011444092,
8.4399995803833, 8.60000038146973, 8.85000038146973, 10, 11,
12, 13, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5,
9, 10.5, 11.5, 6.84999990463257, 7.55000019073486, 7.55000019073486,
8.25, 8.25, 8.25, 8.25, 8.25, 8.25, 8.25, 8.25, 8.25, 8.25, 8.25,
9, 9, 9.75, 9.75, 10.5, 7.15000009536743, 7.25, 7.25, 7.25, 7.25,
7.25, 8, 8.75, 9, 9.69999980926514, 10.3999996185303, 11.1000003814697,
11.8000001907349, 12.5, 13.1999998092651, 7.30000019073486, 7.30000019073486,
7.40000009536743, 7.69999980926514, 7.84999990463257, 7.94999980926514,
8.10000038146973, 8.10000038146973, 8.14999961853027, 8.30000019073486,
8.55000019073486, 8.69999980926514, 8.80000019073486, 9.30000019073486,
6.55000019073486, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 8.39999961853027, 8.39999961853027,
8.5, 8.80000019073486, 8.94999980926514, 9.10000038146973, 9.25,
9.25, 9.75, 9.75, 10.25, 10.25, 10.75, 10.75, 11.25, 11.25, 12,
12, 12.75, 12.75, 13.5, 7.15000009536743, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.40000009536743,
7.40000009536743, 7.40000009536743, 7.40000009536743, 7.75, 8,
9, 9.60000038146973, 9.60000038146973, 10.1000003814697, 10.5,
10.5, 11.5, 11.5, 12.25, 6.55000019073486, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
6.55000019073486, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 8.5, 8.55000019073486,
8.64999961853027, 8.85000038146973, 9.10000038146973, 9.30000019073486,
9.44999980926514, 9.94999980926514, 6.55000019073486, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 6.55000019073486, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 6.55000019073486, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 6.55000019073486, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 9.5, 11, 8.0600004196167,
8.0600004196167, 8.14999961853027, 8.46000003814697, 8.60000038146973,
8.72999954223633, 9.14999961853027, 9.60000038146973, 10, 10.5,
10.7799997329712, 10.960000038147, 11.75, 12.5500001907349, 8.55000019073486,
8.55000019073486, 8.67000007629395, 9.03999996185303, 9.1899995803833,
9.31999969482422, 9.47000026702881, 9.47000026702881, 11, 11.5,
12, 13.5, 13.960000038147, 14.4899997711182, 6.55000019073486,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 8, 8.75,
8.75, 8.75, 8.75, 8.75, 8.75, 8.75, 6.55000019073486, 7.25, 7.25,
7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25, 7.25,
7.25)), row.names = c(NA, -795L), class = c("tbl_df", "tbl",
"data.frame"))
geom_col
stacks the bars by default, I think you might wantgeom_col(position = 'identity')
. Basically, if you stack 10 years of a $10 on top of each other, you end up with a total of $100.Alternatively, you can calculate the yearly increases (instead of the total wage) and plot those stacked.
I tried that (
geom_col(position = "identity")
), it fixed the axis but wouldn’t show thefill
for different yearsThe last bar is probably plotted on top, since it is plotted last. Use e.g.
... %>% arrange(desc(year)) %>%
to reverse the order before plotting. If you had a minimal reproducible example in your question I would write answer, but alas.arrange(desc(year))
worked! Thank you. I just saw your explanation for whygeom_col
is changing the axis. Thank you for explaining that as well. If you post any of the comments as an answer I will mark it.