Skip to content

Commit

Permalink
change plot function
Browse files Browse the repository at this point in the history
  • Loading branch information
akreutzmann committed Oct 21, 2023
1 parent 7cce4a9 commit c8dc452
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 32 deletions.
5 changes: 1 addition & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,11 @@ importFrom(ggplot2,coord_fixed)
importFrom(ggplot2,coord_flip)
importFrom(ggplot2,element_blank)
importFrom(ggplot2,facet_wrap)
importFrom(ggplot2,fortify)
importFrom(ggplot2,geom_abline)
importFrom(ggplot2,geom_boxplot)
importFrom(ggplot2,geom_density)
importFrom(ggplot2,geom_line)
importFrom(ggplot2,geom_point)
importFrom(ggplot2,geom_polygon)
importFrom(ggplot2,geom_qq)
importFrom(ggplot2,geom_segment)
importFrom(ggplot2,geom_sf)
Expand All @@ -158,11 +156,9 @@ importFrom(ggplot2,geom_text)
importFrom(ggplot2,geom_vline)
importFrom(ggplot2,ggplot)
importFrom(ggplot2,ggtitle)
importFrom(ggplot2,guides)
importFrom(ggplot2,labs)
importFrom(ggplot2,qplot)
importFrom(ggplot2,scale_color_manual)
importFrom(ggplot2,scale_colour_gradient)
importFrom(ggplot2,scale_fill_gradient)
importFrom(ggplot2,scale_fill_manual)
importFrom(ggplot2,scale_linetype_discrete)
Expand Down Expand Up @@ -207,6 +203,7 @@ importFrom(parallelMap,parallelLibrary)
importFrom(parallelMap,parallelStop)
importFrom(readODS,write_ods)
importFrom(reshape2,melt)
importFrom(rlang,.data)
importFrom(spdep,geary.test)
importFrom(spdep,mat2listw)
importFrom(spdep,moran.test)
Expand Down
4 changes: 2 additions & 2 deletions R/load_shape.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' Loading the Shape File for Austrian Districts
#'
#' The function simplifies to load the shape file for austrian districts.
#' The function simplifies to load the shape file for Austrian districts.
#'
#' @return A shape file of class \code{SpatialPolygonsDataFrame}.
#' @return A shape file of class \code{"sf", "data.frame"}.
#' @details The shape file contains the borders of Austrian districts. Thus, it
#' can be used for the visualization of estimation results for Austrian
#' districts.
Expand Down
27 changes: 14 additions & 13 deletions R/map_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#' Function \code{map_plot} creates spatial visualizations of the estimates
#' obtained by small area estimation methods.
#'
#' @param object an object of type \code{saeTrafo}, containing the estimates to
#' be visualized.
#' @param object an object of type emdi, containing the estimates to be
#' visualized.
#' @param indicator optional character vector that selects which indicators
#' shall be returned: (i) all calculated indicators ("all");
#' (ii) each indicator name: "Mean", "Quantile_10", "Quantile_25", "Median",
Expand All @@ -21,8 +21,8 @@
#' Defaults to \code{FALSE}.
#' @param CV optional logical. If \code{TRUE}, the CV is also visualized.
#' Defaults to \code{FALSE}.
#' @param map_obj an \code{SpatialPolygonsDataFrame} object as defined by the
#' \pkg{sp} package on which the data should be visualized.
#' @param map_obj an \code{"sf", "data.frame"} object as defined by the
#' \pkg{sf} package on which the data should be visualized.
#' @param map_dom_id a character string containing the name of a variable in
#' \code{map_obj} that indicates the domains.
#' @param map_tab a \code{data.frame} object with two columns that match the
Expand All @@ -31,19 +31,20 @@
#' in both objects differ.
#' @param color a \code{vector} of length 2 defining the lowest and highest
#' color in the plots.
#' @param scale_points a numeric vector of length two. This
#' @param scale_points a structure defining the lowest and the highest
#' value of the colorscale. If a numeric vector of length two is given, this
#' scale will be used for every plot.
#' @param guide character passed to \code{scale_fill_gradient} from
#' \pkg{ggplot2}. Possible values are "none", "colourbar", and "legend".
#' Defaults to "colourbar".
#' @param guide character passed to
#' \code{scale_colour_gradient} from \pkg{ggplot2}.
#' Possible values are "none", "colourbar", and "legend".
#' @param return_data if set to \code{TRUE}, a fortified data frame including
#' the map data as well as the chosen indicators is returned. Customized maps
#' can easily be obtained from this data frame via the package \pkg{ggplot2}.
#' Defaults to \code{FALSE}.
#' @return Creates the plots demanded and, if selected, a fortified data.frame
#' @return Creates the plots demanded, and, if selected, a fortified data.frame
#' containing the mapdata and chosen indicators.
#' @seealso \code{\link[sf]{sf}}, \code{\link{NER_Trafo}},
#' \code{\link{saeTrafoObject}}
#' @seealso \code{\link{direct}}, \code{\link{ebp}}, \code{\link{fh}},
#' \code{\link{emdiObject}}, \code{\link[sf]{sf}}
#' @examples
#' \donttest{
#' data("eusilcA_pop")
Expand Down Expand Up @@ -228,10 +229,10 @@ plot_real <- function(object,

if (any(is.na(matcher))) {
if (all(is.na(matcher))) {
stop(paste("Domain of saeTrafo object and Map object do not match.",
stop(paste("Domain of emdi object and Map object do not match.",
"Try using map_tab"))
} else {
warnings(paste("Not all Domains of saeTrafo object and Map object",
warnings(paste("Not all Domains of emdi object and Map object",
"could be matched. Try using map_tab"))
}
}
Expand Down
4 changes: 2 additions & 2 deletions man/load_shapeaustria.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 9 additions & 11 deletions man/map_plot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c8dc452

Please sign in to comment.