diff --git a/R/ValuationTables.R b/R/ValuationTables.R index 3615bb98a720bd3ef8a970ead671fb0b4339d357..fec78749592d004b45b4ccfa57957a93b78c222e 100644 --- a/R/ValuationTables.R +++ b/R/ValuationTables.R @@ -250,8 +250,10 @@ makeQxDataFrame = function(..., YOB=1972, Period=NA) { data } -plotValuationTables = function(..., title = "", legend.position=c(0.9,0.1), legend.key.width = unit(25, "mm")) { - data = makeQxDataFrame(...); +plotValuationTables = function(data, ..., title = "", legend.position=c(0.9,0.1), legend.key.width = unit(25, "mm")) { + if (!is.data.frame(data)) { + data = makeQxDataFrame(data, ...); + } pl = ggplot(data, aes(x = x, y = y, colour = data$group)) + theme_bw() + @@ -287,7 +289,7 @@ plotValuationTables = function(..., title = "", legend.position=c(0.9,0.1), lege } pl# + coord_flip() } -plotValuationTables(mort.AT.census.1869.male, mort.AT.census.1869.female, mort.AT.census.2011.male, mort.AT.census.2011.female, AVOe2005R.male, AVOe2005R.female, YOB=1972,title="Vergleich österreichische Sterbetafeln") +plotValuationTables(mort.AT.census.1869.male, mort.AT.census.1869.female, mort.AT.census.2011.male, mort.AT.census.2011.female, AVOe2005R.male, AVOe2005R.female, YOB=1972,title="Vergleich österreichische Sterbetafeln, YOB=1972 (bei Generationentafeln)") plotValuationTables(mort.AT.census.2001.male, AVOe2005R.male, YOB=1972, title="Vergleich österreichische Sterbetafeln") plotValuationTables(getCohortTable(AVOe2005R.male, YOB=1972), getCohortTable(AVOe2005R.male, YOB=2016), title="Vergleich österreichische Sterbetafeln") diff --git a/R/ValuationTables_Austria_Census.R b/R/ValuationTables_Austria_Census.R index 31e2a655fe7045ee1eac046a13e0a3f62699ecb8..1ab333dfc3cde1e18c0e270afb47b12719aedab0 100644 --- a/R/ValuationTables_Austria_Census.R +++ b/R/ValuationTables_Austria_Census.R @@ -94,46 +94,5 @@ rm(a.vz.dataM, a.vz.dataF, censtable) ############################################################################### -ggplot(mort.AT.census.ALL.maleA, aes(x = x, y = y, colour = mort.AT.census.ALL.maleA$group)) + - theme_bw() + - theme( - plot.title = element_text(size=18, face="bold"), - legend.title = element_text(size=14, face="bold.italic") - ) + - geom_line() + - scale_y_log10(#breaks = trans_breaks('log10', function(x) 10^x), - #labels = trans_format('log10', math_format(10^.x)), - #minor_breaks = log(c(sapply(x, function(x) seq(0, x, x/10))), 10) - ) + - ggtitle("Österreichische Volkssterbetafeln Männer seit 1870") + xlab("Alter") + ylab("q_x") + labs(colour="Sterbetafel") - - -plotValuationTables(mort.AT.census.1869.male, mort.AT.census.1869.female, mort.AT.census.2011.male, mort.AT.census.2011.female, title="Vergleich österreichische Sterbetafeln") - -plotValuationTables( - #mort.AT.census.1869.male, - ##mort.AT.census.1880.male, - #mort.AT.census.1890.male, - #mort.AT.census.1900.male, - #mort.AT.census.1910.male, - #mort.AT.census.1931.male, - #mort.AT.census.1951.male, - #mort.AT.census.1961.male, - #mort.AT.census.1971.male, - #mort.AT.census.1981.male, - #mort.AT.census.1991.male, - #mort.AT.census.2001.male, - #mort.AT.census.2011.male, - mort.AT.census.1869.female, - mort.AT.census.1880.female, - mort.AT.census.1890.female, - mort.AT.census.1900.female, - mort.AT.census.1910.female, - mort.AT.census.1931.female, - mort.AT.census.1951.female, - mort.AT.census.1961.female, - mort.AT.census.1971.female, - mort.AT.census.1981.female, - mort.AT.census.1991.female, - mort.AT.census.2001.female, - mort.AT.census.2011.female, title="Vergleich österreichische Sterbetafeln", legend.position=c(1,0)) \ No newline at end of file +plotValuationTables(mort.AT.census.ALL.male, title="Vergleich österreichische Sterbetafeln, Männer", legend.position=c(1,0)) +plotValuationTables(mort.AT.census.ALL.female, title="Vergleich österreichische Sterbetafeln, Frauen", legend.position=c(1,0))