suppressPackageStartupMessages({
library(ggplot2)
library(latex2exp)
})
# FPP eficiente: x^2 + 0.25y^2 = 200
# y = sqrt(800 - 4x^2)
x_max_eff <- sqrt(200)
x_seq_eff <- seq(0, x_max_eff, length.out = 300)
y_seq_eff <- sqrt(pmax(800 - 4 * x_seq_eff^2, 0))
# FPP ineficiente: x^2 + 0.25y^2 = 180
# y = sqrt(720 - 4x^2)
x_max_ineff <- sqrt(180)
x_seq_ineff <- seq(0, x_max_ineff, length.out = 300)
y_seq_ineff <- sqrt(pmax(720 - 4 * x_seq_ineff^2, 0))
# Pontos de referência
pontos <- tibble::tibble(
x = c(10, 10),
y = c(20, sqrt(320)),
label = c(
"A: alocação igual (l=200)",
"A': alocação igual (l=180)"
),
tipo = c("eficiente", "ineficiente")
)
# Dados das curvas
fpp_eff <- tibble::tibble(x = x_seq_eff, y = y_seq_eff, FPP = "L = 200 (pleno emprego)")
fpp_ineff <- tibble::tibble(x = x_seq_ineff, y = y_seq_ineff, FPP = "L = 180 (desemprego)")
fpp_dados <- dplyr::bind_rows(fpp_eff, fpp_ineff)
ggplot() +
# Área sob a FPP eficiente
geom_ribbon(
data = fpp_eff,
aes(x = x, ymin = 0, ymax = y),
fill = "lightgreen", alpha = 0.2
) +
# Curvas FPP
geom_line(
data = fpp_dados,
aes(x = x, y = y, color = FPP, linetype = FPP),
linewidth = 1.3
) +
# Pontos
geom_point(
data = pontos,
aes(x = x, y = y, shape = tipo),
size = 4, color = c("darkgreen", "tomato")
) +
# Segmento mostrando a perda
geom_segment(
aes(x = 10, xend = 10, y = sqrt(320), yend = 20),
arrow = arrow(length = unit(0.2, "cm"), ends = "both"),
color = "red", linewidth = 0.8
) +
annotate(
"label", x = 12.5, y = (20 + sqrt(320)) / 2,
label = paste0("Perda: ", round(20 - sqrt(320), 1), " unidades de y"),
color = "red", size = 4, fontface = "bold",
fill = "white", label.size = 0.3
) +
# Rótulos dos pontos
annotate(
"label", x = 8, y = 21,
label = "A (10, 20)",
color = "darkgreen", fontface = "bold", size = 4.5,
fill = "white", label.size = 0.3
) +
annotate(
"label", x = 12.5, y = sqrt(320) - 1,
label = paste0("A' (10, ", round(sqrt(320), 1), ")"),
color = "tomato", fontface = "bold", size = 4.5,
fill = "white", label.size = 0.3
) +
# Anotação da região
annotate(
"text", x = 4, y = 8,
label = "Região\nfactível",
size = 4, color = "darkgreen", fontface = "italic"
) +
scale_color_manual(
values = c(
"L = 200 (pleno emprego)" = "darkgreen",
"L = 180 (desemprego)" = "tomato"
)
) +
scale_linetype_manual(
values = c(
"L = 200 (pleno emprego)" = "solid",
"L = 180 (desemprego)" = "dashed"
)
) +
scale_shape_manual(values = c("eficiente" = 16, "ineficiente" = 17), guide = "none") +
labs(
title = "Fronteira de Possibilidades de Produção e ineficiência",
subtitle = "Desemprego de 20 trabalhadores contrai a FPP",
x = TeX(r"(Quantidade de $x$)"),
y = TeX(r"(Quantidade de $y$)"),
color = "FPP",
linetype = "FPP"
) +
scale_x_continuous(breaks = seq(0, 16, by = 2), limits = c(0, 16), expand = c(0, 0)) +
scale_y_continuous(breaks = seq(0, 30, by = 5), limits = c(0, 30), expand = c(0, 0)) +
theme_minimal() +
theme(
plot.title = element_text(size = 18, face = "bold"),
plot.subtitle = element_text(size = 14),
axis.line = element_line(color = "black", linewidth = 0.5),
axis.title = element_text(size = 16, face = "bold"),
axis.text = element_text(size = 14),
legend.position = "bottom",
legend.text = element_text(size = 13)
)