library(ggplot2)
library("reshape2")
library(ggpubr)
load("C:/Users/MCker/Desktop/data_paper/raspberry_paper_small_lambda_ext.RData")
#C:\Users\MCker\Desktop\data_paper
#+ylab("")
Ts <- unique(simulated_data$T)
Ts <- c(7,15,30, 50, 100,300)
df <- simulated_data[c('mse_pca_f','n', 'T' )]
colnames(df) <- c('MSE', 'n', 'T')
df <- df[ which( df$T %in% Ts) , ]
df <- reshape(df, idvar = "n", timevar = "T", direction = "wide")
names <- c()
for (index in 1:length(Ts)) {names[index] = paste('T=',Ts[index],sep='')}
colnames(df) <- c('n', names)
df_long <- melt(df, id = 'n')
colnames(df_long) <- c('n', 'Periods', 'MSE')
figure1 <- ggplot(df_long, aes(x=n, y=MSE, color=Periods)) +theme(axis.text=element_text(size=20),
axis.title=element_text(size=20),
legend.title = element_text(size = 20),
legend.text = element_text(size = 20),
legend.position="bottom") + geom_line()
ggsave("C:/Users/MCker/Desktop/data_paper/plots_small/plot_mse_factor1_small.png", width=5.5, height=3)
#----------fig3-------------------------------------------------
df <- simulated_data[c('mse_pca_f.1','n', 'T' )]
colnames(df) <- c('MSE', 'n', 'T')
df <- df[ which( df$T %in% Ts) , ]
df <- reshape(df, idvar = "n", timevar = "T", direction = "wide")
names <- c()
for (index in 1:length(Ts)) {names[index] = paste('T=',Ts[index],sep='')}
colnames(df) <- c('n', names)
df_long <- melt(df, id = 'n')
colnames(df_long) <- c('n', 'Periods', 'MSE')
figure2 <- ggplot(df_long, aes(x=n, y=MSE, color=Periods)) +theme(axis.text=element_text(size=20),
axis.title=element_text(size=20),
legend.title = element_text(size = 20),
legend.text = element_text(size = 20),
legend.position="bottom") + geom_line()
ggsave("C:/Users/MCker/Desktop/data_paper/plots_small/plot_mse_factor2_small.png",width=5.5, height=3)
#----------fig3-------------------------------------------------
df <- simulated_data[c('mse_pca_f.2','n', 'T' )]
colnames(df) <- c('MSE', 'n', 'T')
df <- df[ which( df$T %in% Ts) , ]
df <- reshape(df, idvar = "n", timevar = "T", direction = "wide")
names <- c()
for (index in 1:length(Ts)) {names[index] = paste('T=',Ts[index],sep='')}
colnames(df) <- c('n', names)
df_long <- melt(df, id = 'n')
colnames(df_long) <- c('n', 'Periods', 'MSE')
figure3 <- ggplot(df_long, aes(x=n, y=MSE, color=Periods)) +theme(axis.text=element_text(size=20),
axis.title=element_text(size=20),
legend.title = element_text(size = 20),
legend.text = element_text(size = 20),
legend.position="bottom") + geom_line()
ggsave("C:/Users/MCker/Desktop/data_paper/plots_small/plot_mse_factor3_small.png",width=5.5, height=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.