Hello All,
I am looking to visualize the change in vehicle fleets (body style and fuel type) over time using a Sankey diagram. Preferable, the order would go body style to fuel type in year 1 followed by year one fuel type to year 2 body style, so on and so forth. However, having a bookend of year 1 body style to fuel type to year n body style would work as well. I am new to displaying data in this way and am open to suggestions on how to display the data and also the organization of the dataset to achieve what I am looking for. Thank you all for your time and consideration. Below is an example of the data I am using as well as the code to produce a simple Sankey diagram.
Adam
I am looking to visualize the change in vehicle fleets (body style and fuel type) over time using a Sankey diagram. Preferable, the order would go body style to fuel type in year 1 followed by year one fuel type to year 2 body style, so on and so forth. However, having a bookend of year 1 body style to fuel type to year n body style would work as well. I am new to displaying data in this way and am open to suggestions on how to display the data and also the organization of the dataset to achieve what I am looking for. Thank you all for your time and consideration. Below is an example of the data I am using as well as the code to produce a simple Sankey diagram.
Adam
Code:
sankey vehicles, from(body_style) to(fuel_type) by(datayear)
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int datayear str16 fuel_type str13 body_style double vehicles 2013 "Alternative" "Convertible" 347 2013 "Fossil Fuels" "Convertible" 69565 2013 "Battery Electric" "Convertible" 22 2013 "Battery Electric" "Coupe" 20 2013 "Alternative" "Coupe" 324 2013 "Fossil Fuels" "Coupe" 136951 2013 "Plug-in Hybrid" "Hatchback" 474 2013 "Battery Electric" "Hatchback" 70 2013 "Fossil Fuels" "Hatchback" 106685 2013 "Hybrid" "Hatchback" 17057 2013 "Fossil Fuels" "Passenger Van" 145039 2013 "Battery Electric" "Passenger Van" 1 2013 "Alternative" "Passenger Van" 13124 2013 "Alternative" "Pickup Truck" 10741 2013 "Hybrid" "Pickup Truck" 21 2013 "Fossil Fuels" "Pickup Truck" 161133 2013 "Alternative" "SUV" 34979 2013 "Fossil Fuels" "SUV" 687977 2013 "Hybrid" "SUV" 5541 2013 "Alternative" "Sedan" 17459 2013 "Fossil Fuels" "Sedan" 1095256 2013 "Hybrid" "Sedan" 9433 2013 "Plug-in Hybrid" "Sedan" 15 2013 "Battery Electric" "Sedan" 1 2013 "Hybrid" "Wagon" 466 2013 "Fossil Fuels" "Wagon" 98190 2013 "Alternative" "Wagon" 440 2014 "Battery Electric" "Convertible" 22 2014 "Alternative" "Convertible" 556 2014 "Fossil Fuels" "Convertible" 68027 2014 "Alternative" "Coupe" 487 2014 "Fossil Fuels" "Coupe" 130620 2014 "Battery Electric" "Coupe" 29 2014 "Plug-in Hybrid" "Hatchback" 956 2014 "Battery Electric" "Hatchback" 447 2014 "Fossil Fuels" "Hatchback" 104726 2014 "Hybrid" "Hatchback" 18376 2014 "Alternative" "Passenger Van" 14313 2014 "Fossil Fuels" "Passenger Van" 133114 2014 "Alternative" "Pickup Truck" 12738 2014 "Hybrid" "Pickup Truck" 26 2014 "Fossil Fuels" "Pickup Truck" 155378 2014 "Hybrid" "SUV" 5688 2014 "Alternative" "SUV" 42154 2014 "Fossil Fuels" "SUV" 701595 2014 "Alternative" "Sedan" 19262 2014 "Plug-in Hybrid" "Sedan" 62 2014 "Fossil Fuels" "Sedan" 1066140 2014 "Hybrid" "Sedan" 11158 2014 "Battery Electric" "Sedan" 1 2014 "Hybrid" "Wagon" 747 2014 "Alternative" "Wagon" 398 2014 "Fossil Fuels" "Wagon" 92756 2015 "Alternative" "Convertible" 823 2015 "Battery Electric" "Convertible" 23 2015 "Fossil Fuels" "Convertible" 66982 2015 "Alternative" "Coupe" 622 2015 "Hybrid" "Coupe" 1 2015 "Fossil Fuels" "Coupe" 126737 2015 "Battery Electric" "Coupe" 45 2015 "Plug-in Hybrid" "Coupe" 25 2015 "Fossil Fuels" "Hatchback" 105010 2015 "Hybrid" "Hatchback" 20092 2015 "Plug-in Hybrid" "Hatchback" 1476 2015 "Battery Electric" "Hatchback" 761 2015 "Alternative" "Passenger Van" 15348 2015 "Fossil Fuels" "Passenger Van" 125273 2015 "Alternative" "Pickup Truck" 13883 2015 "Hybrid" "Pickup Truck" 24 2015 "Fossil Fuels" "Pickup Truck" 155350 2015 "Fossil Fuels" "SUV" 749140 2015 "Hybrid" "SUV" 6123 2015 "Plug-in Hybrid" "SUV" 1 2015 "Alternative" "SUV" 55112 2015 "Fossil Fuels" "Sedan" 1072856 2015 "Battery Electric" "Sedan" 1 2015 "Plug-in Hybrid" "Sedan" 151 2015 "Hybrid" "Sedan" 13165 2015 "Alternative" "Sedan" 21487 2015 "Hybrid" "Wagon" 1019 2015 "Alternative" "Wagon" 363 2015 "Fossil Fuels" "Wagon" 89218 2016 "Fossil Fuels" "Convertible" 66226 2016 "Battery Electric" "Convertible" 23 2016 "Alternative" "Convertible" 1086 2016 "Plug-in Hybrid" "Coupe" 59 2016 "Alternative" "Coupe" 804 2016 "Hybrid" "Coupe" 2 2016 "Fossil Fuels" "Coupe" 122579 2016 "Battery Electric" "Coupe" 40 2016 "Hybrid" "Hatchback" 20743 2016 "Battery Electric" "Hatchback" 1213 2016 "Plug-in Hybrid" "Hatchback" 1864 2016 "Fossil Fuels" "Hatchback" 105048 2016 "Alternative" "Passenger Van" 16352 2016 "Fossil Fuels" "Passenger Van" 118366 2016 "Hybrid" "Pickup Truck" 21 2016 "Battery Electric" "Pickup Truck" 1 2016 "Fossil Fuels" "Pickup Truck" 157729 2016 "Alternative" "Pickup Truck" 14974 end
Comment