R/draw.figure.R

# library(ggplot2)
# library(lazyeval)
# library(dplyr)
# library(grDevices)
# library(RColorBrewer)
# library(assertthat)
# library(grid)
# library(lazyeval)
# # library(pryr)
# devtools::install_github("Nicolabo/PERUanalytics")
# library(PERUanalytics)
# # 
# df <- data.frame(id = 1:400, letter = rep(letters[1:20],each = 20), number = sample(1:40,400,replace = T),number2 = sample(1:15,400,replace = T),
#                  size = c(rep(8,100),rep(6,100),rep(4,100),rep(2,100)))
# 
# 
# #------------------------------------------------------------------------------
# 
# # Test-------------------------------------------------------------------------
# 
# ggplot(mtcars, aes(wt, qsec, color = factor(cyl)))+
#   geom_point(size = 10)+
#   theme_peru("color", diverging_colors, "dasda")
# 
# ggplot(mtcars, aes(wt, qsec))+
#   geom_point(size = 6)+
# 
# 
# myFunction <- function()
#   list(geom_vline(xintercept = 20),
#        geom_point(data = mtcars))
# 
# 
# p <- ggplot(aes(x = mpg, y = hp), data = mtcars)+
#   myFunction()
# 
# draw_point(mtcars, wt, qsec,color = factor(cyl), size_point = 10,y_title_name = "loloy", x_title_name = "lolox")
# plot <- describe_axis("X-axis variable", "Y-axis variable", plot)
# draw_single_point(mtcars, x = "wt", y = "qsec",save = T)
# #End Test----------------------------------------------------------------------
# 
# draw_single_point(df, x = "id", y = "number", size = 4,save_plot = T)
# draw_multi_point(df, x = "id", y = "number", color = "letter")
# 
# ######################################################################
# plot <- ggplot(df, aes(id, number, color = letter))+
#   geom_point(size = 4)+
#   theme_pearson()+
# #   scale_color_brewer(palette = "RdBu")
#   scale_color_manual(values = categorical_colors)
# 
# plot <- describe_axis(x_axis = "Wt", y_axis = "Qsecund", plot )
# 
# save_plot(file_name = "first_plot",plot)
# plot
# 
# plot+
#   implement_scale_color("color", diverging_colors)
# 
# 
# 
# 
# 
# plot+
#   implement_scale_color("color")
# 
# save_pplot(name = "first_plot",plot)
# 
# draw_single_point(mtcars, x = "wt", y = "cyl", file_name = "asfasf",save_plot = T)
# sapply(mtcars, class)
# draw_multi_point(mtcars, x = "wt", y = "cyl", color = "cyl")
# #---------------------------------------------------------------------
# 
# 
# draw_smooth <- function(data, se = F, save = F, ...){
#   plot <- ggplot(data, aes_string(...))+
#     geom_smooth(se = se)+
#     theme_pearson()
#   if (save_plot == F) plot
#   else save_pplot(file_name, plot)
# }
# 
# draw_smooth(df, x = "id", y ="wt",se = F)
# #---------------------------------------------------------------------
# 
# draw_line <- function(data, x, y, ...,size_line = 2, legend_title = "Legend",
#                       y_title_name = y, x_title_name = x, save_plot = F,
#                       file_name = "plot", type_file = "png"){
#   
#   plot <- ggplot(data, aes_string(x, y, ...))+
#     geom_line(size = size_line)+
#     theme_pearson()
#   plot <- describe_axis(x_title_name, y_title_name, plot)
#   if (save_plot != F) save_plot(file_name, plot)
#   plot
# }
# 
# 
# 
# draw_line(df, x = "wt", y = "hp", fill = factor("am"), size_line = 1)
# # z factorami w typie color albo fill?
# #---------------------------------------------------------------------
# draw_bar <- function(data, bar_type, save = F, ...){
#   plot <- ggplot(data, aes_string(...))+
#     geom_bar(stat = bar_type)+
#     theme_pearson()
#   if (save_plot == F) plot
#   else save_pplot(file_name, plot)
# }
# 
# draw_bar(df, x = "wt", y = "am", bar_type = "identity")
# 
# 
# 0
Nicolabo/PERUanalytics documentation built on May 7, 2019, 6:18 p.m.