MRT_1F <-c(517.1468515630205, 85.13094142168089, 30.333207896694553, 12.694776264558937, 3.3041601673945418, 1.1823111717498882, 1.1892293502386786)
MRT_3F <-c(156.68929936163462, 11.540837783562276, 0.4512835621696538, 0.4509797929766453, 0.4502068233039181, 0.4496185276300172, 0.4543157082191288)
MRT_5F <-c(83.90319666471157, 0.3068151086494968, 0.30522314133037304, 0.3072588968084928, 0.30655265997285697, 0.3055812715727718, 0.3053297166713006)
MRT_10F <-c(29.55430642951759, 0.19832832665772515, 0.1971923924717474, 0.19796648905716516, 0.19615594370806338, 0.2034569237883263, 0.19617420889447737)
MRT_15F <-c(11.317736530583566, 0.167364215666193, 0.16172168266811013, 0.16701085329580515, 0.1598052657153692, 0.1645934043532696, 0.16216563797118075)
MRT_sem_F <-c(11.93430909937736, 0.6095414637034009, 0.6060645101029295, 0.612167181646899, 0.6146761002685637, 0.6096747087200697, 0.6125810476877268)
clock <- c(0.1, 0.5, 1, 1.5, 2, 2.5, 3)
data <- data.frame(clock, MRT_1F, MRT_3F, MRT_5F, MRT_10F, MRT_15F, MRT_sem_F)
layout(matrix(1, nrow=1, ncol=1))
ggplot(data, aes(x=clock)) +
geom_line(aes(y=MRT_1F, color="MRT_1F")) +
geom_line(aes(y=MRT_3F, color="MRT_3F")) +
geom_line(aes(y=MRT_5F, color="MRT_5F")) +
geom_line(aes(y=MRT_10F, color="MRT_10F")) +
geom_line(aes(y=MRT_15F, color="MRT_15F")) +
geom_line(aes(y=MRT_sem_F, color="MRT_sem_F")) +
scale_y_log10() +
labs(title="Comparação de MRTs", x="Clock", y="Tempo (log)") +
theme_minimal()
data <- data.frame(
Quality = rep(c("Good", "Very Good", "Excellent"), 4),
Price = rep(c("$10-19", "$20-29", "$30-39", "$40-49"), each = 3),
Percentage = c(53.8, 43.6, 2.6, 33.9, 54.2, 11.9, 2.6, 60.5, 36.8, 0.0, 21.4, 78.6)
)
ggplot(data, aes(x=Price, y=Percentage, fill=Quality)) +
geom_bar(stat="identity", position="stack") +
scale_fill_manual(values=c("#E6E6E6", "#666666", "black")) +
scale_y_log10() +
labs(title="Distribuição da Qualidade da Refeição por Faixa de Preço",
x="Faixa de Preço",
y="Porcentagem",
fill="Qualidade") +
theme_minimal()
## Warning in scale_y_log10(): log-10 transformation introduced infinite values.
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_bar()`).
data("airquality")
may_temps <- airquality %>% filter(Month == 5) %>% pull(Temp)
may_temps_celsius <- (may_temps - 32) / 1.8
ggplot(data.frame(Temperature = may_temps_celsius), aes(x = Temperature)) +
geom_histogram(aes(y=..density..), bins=10, fill="blue", alpha=0.5) +
geom_density(color="red", size=1) +
labs(title="Histograma das Temperaturas de Maio",
x="Temperatura (°C)",
y="Densidade") +
theme_minimal()
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: The dot-dot notation (`..density..`) was deprecated in ggplot2 3.4.0.
## ℹ Please use `after_stat(density)` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
sales <- read.table("https://training-course-material.com/images/8/8f/Sales.txt", header=TRUE)
sales <- sales %>% mutate(Percentage = round(SALES / sum(SALES) * 100, 1))
ggplot(sales, aes(x="", y=SALES, fill=COUNTRY)) +
geom_bar(stat="identity", width=1) +
coord_polar("y", start=0) +
theme_void() +
labs(title="Porcentagem de Vendas por País") +
geom_text(aes(label = paste0(Percentage, "%")), position = position_stack(vjust = 0.5)) +
theme(legend.position="right")
data("InsectSprays")
ggplot(InsectSprays, aes(x=spray, y=count, fill=spray)) +
geom_boxplot(outlier.shape = NA, fill="yellow") +
labs(title="Boxplot das Contagens de Insetos por Inseticida",
x="Inseticida",
y="Contagem") +
theme_minimal()
data_0_1 <- read.csv("monitoringCloudData_0.1.csv")
data_0_5 <- read.csv("monitoringCloudData_0.5.csv")
data_1 <- read.csv("monitoringCloudData_1.csv")
data_NONE <- read.csv("monitoringCloudData_NONE.csv")
# Converter memória para MB
convert_to_MB <- function(memory) {
if (grepl("TB", memory)) {
return(as.numeric(gsub("TB", "", memory)) * 1000000)
} else if (grepl("GB", memory)) {
return(as.numeric(gsub("GB", "", memory)) * 1024)
} else if (grepl("MB", memory)) {
return(as.numeric(gsub("MB", "", memory)))
} else {
return(NA)
}
}
data_0_1$usedMemory <- sapply(data_0_1$usedMemory, convert_to_MB)
data_0_5$usedMemory <- sapply(data_0_5$usedMemory, convert_to_MB)
data_1$usedMemory <- sapply(data_1$usedMemory, convert_to_MB)
data_NONE$usedMemory <- sapply(data_NONE$usedMemory, convert_to_MB)
# Ajustar currentTime para tempo contínuo (em horas)
adjust_time <- function(df) {
start_time <- as.POSIXct(df$currentTime[1])
df$currentTime <- as.numeric(difftime(as.POSIXct(df$currentTime), start_time, units = "hours"))
return(df)
}
data_0_1 <- adjust_time(data_0_1)
data_0_5 <- adjust_time(data_0_5)
data_1 <- adjust_time(data_1)
data_NONE <- adjust_time(data_NONE)
# Gerar os gráficos usando base R conforme pedido
layout(matrix(1:4, nrow = 2, ncol = 2))
plot(data_0_1$currentTime, data_0_1$usedMemory, type = "l", xlab = "Tempo (Horas)", ylab = "Memória Usada (MB)", main = "0.1")
plot(data_0_5$currentTime, data_0_5$usedMemory, type = "l", xlab = "Tempo (Horas)", ylab = "Memória Usada (MB)", main = "0.5")
plot(data_1$currentTime, data_1$usedMemory, type = "l", xlab = "Tempo (Horas)", ylab = "Memória Usada (MB)", main = "1.0")
plot(data_NONE$currentTime, data_NONE$usedMemory, type = "l", xlab = "Tempo (Horas)", ylab = "Memória Usada (MB)", main = "NONE")
netflix <- read.csv("netflix_titles.csv")
netflix_filtered <- netflix %>% filter(!is.na(country) & !grepl(",", country))
top_countries <- netflix_filtered %>% count(country, sort=TRUE) %>% head(10)
plot_ly(top_countries, labels = ~country, values = ~n, type = 'pie', textinfo = 'label+percent') %>%
layout(title = "Top 10 Países com mais conteúdos na Netflix")
plot_ly(
type = 'table',
header = list(values = c("País", "Total de conteúdos"),
fill = list(color = "gray"),
font = list(color = "white", size = 14),
align = "center"),
cells = list(values = list(top_countries$country, top_countries$n),
align = "center")
)
decades_data <- netflix %>%
mutate(decade = floor(release_year / 10) * 10) %>%
count(decade, type)
plot_ly(decades_data, x = ~decade, y = ~n, type = 'scatter', mode = 'lines+markers',
color = ~type, colors = c("blue", "yellow")) %>%
layout(title = "Quantidade de conteúdo por década", xaxis = list(title = "Década"),
yaxis = list(title = "Total de conteúdos"))
genres <- c("Dramas", "Action & Adventure", "Comedies")
genre_data <- netflix %>%
filter(release_year >= 2000 & release_year <= 2010) %>%
mutate(primary_genre = sapply(strsplit(listed_in, ","), `[`, 1)) %>%
filter(primary_genre %in% genres) %>%
count(release_year, primary_genre)
plot_ly(genre_data, x = ~release_year, y = ~n, type = 'bar',
color = ~primary_genre, barmode = 'group') %>%
layout(title = "Quantidade de filmes por gênero (2000-2010)",
xaxis = list(title = "Ano"),
yaxis = list(title = "Total de filmes"))
## Warning: 'bar' objects don't have these attributes: 'barmode'
## Valid attributes include:
## '_deprecated', 'alignmentgroup', 'base', 'basesrc', 'cliponaxis', 'constraintext', 'customdata', 'customdatasrc', 'dx', 'dy', 'error_x', 'error_y', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'insidetextanchor', 'insidetextfont', 'legendgroup', 'legendgrouptitle', 'legendrank', 'marker', 'meta', 'metasrc', 'name', 'offset', 'offsetgroup', 'offsetsrc', 'opacity', 'orientation', 'outsidetextfont', 'selected', 'selectedpoints', 'showlegend', 'stream', 'text', 'textangle', 'textfont', 'textposition', 'textpositionsrc', 'textsrc', 'texttemplate', 'texttemplatesrc', 'transforms', 'type', 'uid', 'uirevision', 'unselected', 'visible', 'width', 'widthsrc', 'x', 'x0', 'xaxis', 'xcalendar', 'xhoverformat', 'xperiod', 'xperiod0', 'xperiodalignment', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'yhoverformat', 'yperiod', 'yperiod0', 'yperiodalignment', 'ysrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'
## Warning: 'bar' objects don't have these attributes: 'barmode'
## Valid attributes include:
## '_deprecated', 'alignmentgroup', 'base', 'basesrc', 'cliponaxis', 'constraintext', 'customdata', 'customdatasrc', 'dx', 'dy', 'error_x', 'error_y', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'insidetextanchor', 'insidetextfont', 'legendgroup', 'legendgrouptitle', 'legendrank', 'marker', 'meta', 'metasrc', 'name', 'offset', 'offsetgroup', 'offsetsrc', 'opacity', 'orientation', 'outsidetextfont', 'selected', 'selectedpoints', 'showlegend', 'stream', 'text', 'textangle', 'textfont', 'textposition', 'textpositionsrc', 'textsrc', 'texttemplate', 'texttemplatesrc', 'transforms', 'type', 'uid', 'uirevision', 'unselected', 'visible', 'width', 'widthsrc', 'x', 'x0', 'xaxis', 'xcalendar', 'xhoverformat', 'xperiod', 'xperiod0', 'xperiodalignment', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'yhoverformat', 'yperiod', 'yperiod0', 'yperiodalignment', 'ysrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'
## Warning: 'bar' objects don't have these attributes: 'barmode'
## Valid attributes include:
## '_deprecated', 'alignmentgroup', 'base', 'basesrc', 'cliponaxis', 'constraintext', 'customdata', 'customdatasrc', 'dx', 'dy', 'error_x', 'error_y', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'insidetextanchor', 'insidetextfont', 'legendgroup', 'legendgrouptitle', 'legendrank', 'marker', 'meta', 'metasrc', 'name', 'offset', 'offsetgroup', 'offsetsrc', 'opacity', 'orientation', 'outsidetextfont', 'selected', 'selectedpoints', 'showlegend', 'stream', 'text', 'textangle', 'textfont', 'textposition', 'textpositionsrc', 'textsrc', 'texttemplate', 'texttemplatesrc', 'transforms', 'type', 'uid', 'uirevision', 'unselected', 'visible', 'width', 'widthsrc', 'x', 'x0', 'xaxis', 'xcalendar', 'xhoverformat', 'xperiod', 'xperiod0', 'xperiodalignment', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'yhoverformat', 'yperiod', 'yperiod0', 'yperiodalignment', 'ysrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'