File:Contribution size 2012 - pie.png
From Wikimedia Commons, the free media repository
Jump to navigation
Jump to search
Contribution_size_2012_-_pie.png (690 × 426 pixels, file size: 35 KB, MIME type: image/png)
File information
Structured data
Captions
DescriptionContribution size 2012 - pie.png |
English: Donation distribution spanning July 1st, 2012 - Dec 28, 2012.
pie.sql: -- mysql -BN civicrm < pie.sql
set @start = "20120701";
set @end = "20121228";
SELECT 10, SUM(total_amount), AVG(total_amount), COUNT(total_amount)
FROM civicrm_contribution
WHERE (receive_date BETWEEN @start AND @end) AND total_amount BETWEEN 0 AND 10;
SELECT 30, SUM(total_amount), AVG(total_amount), COUNT(total_amount)
FROM civicrm_contribution
WHERE (receive_date BETWEEN @start AND @end) AND total_amount BETWEEN 10 AND 30;
SELECT 50, SUM(total_amount), AVG(total_amount), COUNT(total_amount)
FROM civicrm_contribution
WHERE (receive_date BETWEEN @start AND @end) AND total_amount BETWEEN 30 AND 50;
SELECT 100, SUM(total_amount), AVG(total_amount), COUNT(total_amount)
FROM civicrm_contribution
WHERE (receive_date BETWEEN @start AND @end) AND total_amount BETWEEN 50 AND 100;
SELECT 200, SUM(total_amount), AVG(total_amount), COUNT(total_amount)
FROM civicrm_contribution
WHERE (receive_date BETWEEN @start AND @end) AND total_amount BETWEEN 100 AND 200;
SELECT 1000, SUM(total_amount), AVG(total_amount), COUNT(total_amount)
FROM civicrm_contribution
WHERE (receive_date BETWEEN @start AND @end) AND total_amount BETWEEN 200 AND 1000;
SELECT 250000, SUM(total_amount), AVG(total_amount), COUNT(total_amount)
FROM civicrm_contribution
WHERE (receive_date BETWEEN @start AND @end) AND total_amount BETWEEN 1000 AND 250000;
SELECT 1000000, SUM(total_amount), AVG(total_amount), COUNT(total_amount)
FROM civicrm_contribution
WHERE (receive_date BETWEEN @start AND @end) AND total_amount BETWEEN 250000 AND 1000000;
SELECT -1, SUM(total_amount), AVG(total_amount), COUNT(total_amount)
FROM civicrm_contribution
WHERE (receive_date BETWEEN @start AND @end) AND total_amount > 1000000;
pie.R: # R --no-save < pie.R && ps2pdf "contribution size - pie.ps" && convert "contribution size - pie.pdf" "contribution size 2012 - pie.png"
# tsv, actually, but this suffix helps *office not have a cow
input_file = "splitamounts.csv"
subtitle = "(2012 fund season)"
output_format = "ps"
# TODO make from column 1
interval_labels = c("less than $10", "$10 to $30", "$30 to $50", "$50 to $100", "$100 to $200", "$200 to $1,000", "$1,000 to $250,000", "$250,000 to $1M", "$1M and up")
#lab = paste(levels(dollar_range_endpoints), "\n", signif(avgs, 2)),
# t("less than %C") t("%C to %C") t("%C and up")
start_output_capture = function(label)
{
output_path = paste("./", label, ".", output_format, sep="")
postscript(file = output_path)
}
data = scan(
file = input_file,
skip = 0,
what = list( top=0, sum=0, avgs=0, counts=0 )
)
start_output_capture("contribution size - pie")
data$areas = data$counts * data$avgs
data$portions = data$areas / sum(data$areas)
str_means = formatC(
signif(data$avgs, 4),
format = "f",
digits = 2,
big.mark = ","
)
labels = gettextf(
"%s\n (%d%% of total, mean $%s)",
interval_labels,
round(data$portions * 100),
str_means
)
pie(
data$areas,
lab = labels,
main = paste("Relative contributions to total, by donation size", subtitle),
col = heat.colors(length(data$avgs)),
init.angle = 45,
radius = 0.7
)
dev.off()
|
Source | mw:File:Contribution size 2012 - pie.png |
Author | Adam Roses Wight |
Permission (Reusing this file) |
This file is licensed under the Creative Commons Attribution 3.0 Unported license. Attribution: Adam Roses Wight
|
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 22:07, 17 September 2013 | 690 × 426 (35 KB) | Pcoombe (WMF) (talk | contribs) | move title down and crop a bit more | |
22:05, 17 September 2013 | 690 × 462 (35 KB) | Pcoombe (WMF) (talk | contribs) | {{Information |Description ={{en|1=Donation distribution spanning July 1st, 2012 - Dec 28, 2012. pie.sql: <source lang="sql"> -- mysql -BN civicrm < pie.sql set @start = "20120701"; set @end = "20121228"; SELECT 10, SUM(total_amount), AVG(total_a... |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Software used |
---|