Pessoal, eu gostaria de colocar dois plots em uma mesma figura.
Isto aqui abaixo eu sei fazer:
height = rnorm(n=100, mean = 165, sd = 5)
weight = rpois(n = 100, lambda = 6)
par(mfrow =c(1,2))
plot(height, col=“blue”)
plot(weight, col=“red”)
Gostaria de fazer a mesma coisa usando o ggplot, alguém sabe como fazer?
Caso sim qual library eu deveria usar? Agradeço qualquer contribuição.
Até a criação do data frame (arquivo) df_long funcionou.
Deu erro a partir daqui, veja:
ggplot(df, aes(x = height, y = value, col = weight)) +
geom_boxplot() +
facet_wrap(~variable, ncol = 2)
Error in combine_vars():
! At least one layer must contain all faceting variables: variable Plot is missing variable Layer 1 is missing variable
Run rlang::last_trace() to see where the error occurred.
Agora funcionou
Sim eu uso R studio em um MacOS High Sierra versão 10.13.6.
Quando eu rodo o ggplot2 dá essa warining abaixo:
library(ggplot2)
Warning message:
R graphics engine version 15 is not supported by this version of RStudio. The Plots tab will be disabled until a newer version of RStudio is installed.