ملف:US2009FederalExpenditures.png
حجم هذه المعاينة: 600 × 599 بكسل. البعد الآخر: 2٬099 × 2٬096 بكسل.
الملف الأصلي (2٬099 × 2٬096 بكسل حجم الملف: 107 كيلوبايت، نوع MIME: image/png)
وصف قصير
⧼wm-license-information-description⧽ |
English: Dot plot of the total U.S. government budget in 2009, including both mandatory and discretionary. Taken from data at wikipedia:2009 United States federal budget.
|
⧼wm-license-information-date⧽ | 2010 |
⧼wm-license-information-source⧽ | ⧼Wm-license-own-work⧽ |
⧼wm-license-information-author⧽ | Thopper |
⧼wm-license-information-other-versions⧽ |
Creation Technique
General steps
- Compile data from list of budget items at wikipedia:2009 United States federal budget and save to a file (e.g. "2009expenditures.csv");
- Load data in R (programming language);
- Load the ggplot2 library;
- Assign the categorical variable (outlay) as a factor;
- Plot using the ggplot.
Compiling the data
- Compile the data into columns: one column for the budget expenditure (e.g. "Social Security," "Medicare," etc.) and the other for the amount ("644," "408," etc.).
- Name the columns "Expenditure" and "Billions" for the expenditure category and the amount (in billions of U.S. dollars), respectively.
- Save the data as comma-separated value file (csv).
R code to produce chart
# Load the ggplot2 library library("ggplot2") # Data saved using European separators ("." for thousands and "," for decimals), so use read.csv2(). # If data is saved using U.S. separators ("," for thousands and "." for decimals), use read.csv(). my.data <- read.csv2("2009expenditures.csv") # Ensure that the categories are treated as factors my.data <- data.frame(Billions = my.data$Billions, Expenditure = factor(my.data$Expenditure)) # Plot using ggplot2 ggplot(data = my.data, aes(Billions)) + geom_point(aes(y=reorder(Expenditure, Billions))) + xlab("Billions of U.S. Dollars") + ylab("")
ترخيص
|
تاريخ الملف
اضغط على زمن/تاريخ لرؤية الملف كما بدا في هذا الزمن.
زمن/تاريخ | صورة مصغرة | الأبعاد | مستخدم | تعليق | |
---|---|---|---|---|---|
حالي | ★ مراجعة معتمدة 00:13، 11 نوفمبر 2023 | 2٬099 × 2٬096 (107 كيلوبايت) | Pastakhov (نقاش | مساهمات) | Upload https://upload.wikimedia.org/wikipedia/commons/f/f0/US2009FederalExpenditures.png |
لا يمكنك استبدال هذا الملف.
وصلات
لا يوجد صفحات تصل لهذه الصورة.