A package that provides shortcuts for making elegant plots
You can install the the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("shanealman/EZRplots")
library(EZRplots)
The first function will create a chloropleth map for the user. The user will input the data set they wish to use for the map, which will have 2 columns: the names of their designated region and the variable of interest. The user will then specify which map they wish to display: whether it is all the countries, the states, global regions, etc. The user will have the option to specify additional parameters stating the units of their variable, how many bins for the legend they wish to create, etc. The function will return the resulting cloropleth map altered to the users' desires.
Example with data set Country_Data, with columns Country_Name and Percent:
leafletPlot(data_set = Country_Data, col_name = "Country_Name", col_variable = "Percent", type_of_map = "countries", bins_of_map = (0:5*.2), col_variable_unit = "%", title = "Choropleth Map of Country Data")
Example with data set US_States_Data, with columns State_Name and Votes:
leafletPlot(data_set = US_States_Data, col_name = "State_Name", col_variable = "Votes", type_of_map = "us_states", bins_of_map = (0:5*2), col_variable_unit = "votes", title = "Choropleth Map of State Votes")
This is a shortcut function to help generate 2D or 3D plots with plot_ly. The user will input their data and the variables they want for the x, y, and z axes. The user will be able to specify the type of plot they want to generate from several basic options like scatter, line, surface, 3d_density, mesh, or an autogenerated plot. Addtional helper functions are available to add a 3D regression plane and to change the plot aesthetics.
This is a function that can produce a variety of scatterplots from ggplot2 depending on the inputs that the user chooses to include in the function. Users may input different datasets, variables, colors, and shapes to customize their graphs. For variable names and colorscusers will need to input their arguments as stings to allow ggplot to work properly within the function. It is also important to note that functions with only two variables should have colors inputed corresponding to those in ggplot2 and the shape argument should be a number corressponding to the point shapes that ggplot2 provides. For functions with three variables you may enter colors from RColorBrewer and the shape argument must be a string of the categorical varibles.
Example with two variables.
ez_scatter(data = iris, x_num = "Petal.Width", y_num = "Petal.Length", color = "steelblue", shape = 3)
Example with three variables.
ez_scatter(data = iris, x_num = "Petal.Width", y_num = "Petal.Length", z_cat = "Species", color = "Spectral", shape = "Species")
This function can be added to an existing scatterplot in order to add a title to the plot, add axis labels, and customize the colors and typography of those labels.
plot <- ez_scatter(data = iris, x_num = "Petal.Width", y_num = "Petal.Length", z_cat = "Species", color = "Blues", shape = "Species")
ez_labels(plot = plot, title = "Petal Width vs Petal Length", x = "Petal Width", y = "Petal Length", title_color = "green", axis_color = "orange", title_type = "bold.italic", axis_type = "bold")