Hello, I am using the sankey command to create a graph showing sources of funds and their destinations (called "departments" in my data). Command works as promised and I get a nice graph. Command allows user to specify colorpalette ("tableau", "economist", "s2", etc.), and that, too works as promised.
Question: is there another way to specify a set of colors to use for this graph (e.g., "175 39 47" "116 168 159" etc.)? I know the colors I want but have struggled with my limited understanding of Stata's use/storage of palettes, schemes, and so on. The command seems to accept only "saved" colorpalettes. I've spent time chasing rabbits (ideas) like writing and saving my own colorpalette files, schemes, and so on, but I have not been able to make it happen.
I am using StataNow/SE 19.5 for Windows.
Here is what the data look like, with "amount" (which is $) going from "sourcetype" to "department":
Here is my code, specifying use of the "tableau" colorpalette:
sankey amount ,
from(source) to(department) labangle(0) labposition(3) format(%8.1fc) labgap(10) offset(30) novalues
palette(tableau)
sort1(name,reverse)
title("FY 2026 Capital Budget (millions of $): All Appropriations")
subtitle("Sources of Funds vs. Departments")
note("Source: FY2026 Final Enacted Capital Budget Data.xlsx, derived from GOMB.")
saving(sankey2all.gph, replace);
Thank-you for any suggestions you may have.
Question: is there another way to specify a set of colors to use for this graph (e.g., "175 39 47" "116 168 159" etc.)? I know the colors I want but have struggled with my limited understanding of Stata's use/storage of palettes, schemes, and so on. The command seems to accept only "saved" colorpalettes. I've spent time chasing rabbits (ideas) like writing and saving my own colorpalette files, schemes, and so on, but I have not been able to make it happen.
I am using StataNow/SE 19.5 for Windows.
Here is what the data look like, with "amount" (which is $) going from "sourcetype" to "department":
Code:
|
|
| * Example generated by -dataex-. For more info, type help | dataex |
| clear | |
| input str25 department str7 sourcetype double amount | |
| "All Other" "Bonds" 967.541617 | |
| "All Other" "Federal" 0 | |
| "All Other" "Paygo" 168.1999 | |
| "Capital Development Board" "Bonds" 9501.310781 | |
| "Capital Development Board" "Federal" 0 | |
| "Capital Development Board" "Paygo" 156.51910700000002 | |
| "Comm. & Econ. Opportunity" "Bonds" 5388.889077 | |
| "Comm. & Econ. Opportunity" "Federal" 836.159011 | |
| "Comm. & Econ. Opportunity" "Paygo" 459.8257 | |
| "Environmental Protection" "Bonds" 216.715961 | |
| "Environmental Protection" "Federal" 785.96 | |
| "Environmental Protection" "Paygo" 4223.505911 | |
| "Natural Resources" "Bonds" 380.851248 | |
| "Natural Resources" "Federal" 195.15 | |
| "Natural Resources" "Paygo" 465.646413 | |
| "Transportation" "Bonds" 8209.178414 | |
| "Transportation" "Federal" 782.744254 | |
| "Transportation" "Paygo" 19814.331315 | |
| end | |
sankey amount ,
from(source) to(department) labangle(0) labposition(3) format(%8.1fc) labgap(10) offset(30) novalues
palette(tableau)
sort1(name,reverse)
title("FY 2026 Capital Budget (millions of $): All Appropriations")
subtitle("Sources of Funds vs. Departments")
note("Source: FY2026 Final Enacted Capital Budget Data.xlsx, derived from GOMB.")
saving(sankey2all.gph, replace);
Thank-you for any suggestions you may have.

Comment