SlideShare uma empresa Scribd logo
1 de 18
Baixar para ler offline
PAQUETE GGPLOT.- POTENCIA Y
FACILIDAD PARA GENERAR GRÁFICOS
Néstor Montaño, Julio Villamar
Instituto de Ciencias Matemáticas
nestor.montano@gmail.com, j.villamar.2009@gmail.com
Componentes de un gráfico
• Datos junto con características estéticas
• Objetos geométricos, (puntos, líneas, polígonos, áreas, etc.)
• Transformaciones estadísticas
• Escalas
• Sistema de coordenadas
• Condicionamiento
Comando qplot
• Considere un data.frame llamado “datos” el cual contiene
las variables: “Peso” “Altura” y “genero”
> qplot(x, y, data)
> qplot(altura, peso, data=datos)
Los comandos así planteados
generan un gráfico de
dispersión Altura vs Peso
…Comando qplot
“altura” vs “peso” según el
“género”, entonces podemos
agregar al grafico la
característica estética color
asociada a la variable
categórica “genero”.
>qplot(altura, peso, data= datos, colour =genero ,xlab="Altura
(Centimetros)", ylab="Peso (Libras)")
…Comando qplot
Aquí además de los
puntos se muestra la
tendencia mediante una
línea suavizada.
>qplot(altura,peso,data= datos, geom=c("point","smooth"),
xlab="Altura (Centimetros)", ylab="Peso (Libras)")
> library(splines)
>qplot(altura,peso,data= datos, geom=c("point","smooth"), method=”lm”, xlab="Altura
(Centimetros)", ylab="Peso (Libras)")
También se puede usar
librerías especializadas para
generar la tendencia.
…Comando qplot
Este gráfico se ilustra es uso
de transparencias, así los
puntos más oscuros indican
que hay varias observaciones
ocupando el mismo lugar.
> qplot(nivel,peso, data = x, alpha=I(1/5), xlab="Nivel de
Educacion", ylab="Peso (libras)")
…Comando qplot
Si se quiere conocer si
existe alguna mejoría en
la relación “altura” vs
“peso” cuando aumenta
el “nivel de educación”
de los individuos, se usa
el comando facet como
se muestra aquí.
> qplot(nivel,peso, data = x, alpha=I(1/5), xlab="Nivel de
Educacion", ylab="Peso (libras)")
…Comando qplot
Ahora agrupamos los
datos por nivel de
educación y por el
género
> qplot(altura,peso,data= datos, xlab="Altura (Centimetros)" ,
ylab="Peso (Libras)") + facet_grid(genero~nivel)
…Comando qplot
Histograma de frecuencias para la variable Peso
>qplot(peso, data= datos, geom = “histogram”)
…Comando qplot
Aquí se modifica el
ancho de los intervalos,
además se espefica los
limites del eje x.
>qplot(peso, data= datos, geom = “histogram”, binwidth = 5,
xlim=c(80,220))
Comando ggplot
Al usar ggplot() el primer paso es crear el objeto
“gráfico” de la siguiente manera:
> g <- ggplot(datos, aes(altura, peso, colour = genero))
Aquí se asigna a la variable “g” el gráfico creado, el
mismo que usa el data.frame “datos” y las
características estéticas que se le declaran son “altura”
para el eje x, “peso” para el eje y, y “género” para color.
Así planteado, el gráfico aún no puede ser visualizado
pues no se le ha insertado capa alguna
Comando ggplot
Aquí, al la variable “g”
se le aumenta un layer
de puntos
> g + layer( geom = ”point”)
> g + geom_point
Otra forma (más
sencilla) de hacer esto
es:
Comando ggplot
> g + geom_point()+ geom_smooth()
Comando ggplot
> g + geom_point() + facet_grid(.~nivel)
Comando ggplot
> h<- ggplot (datos, aes(peso))
> h + geom_histogram(binwidth=5) + xlim=c(80,220))
Comando ggplot
> h<- ggplot (datos, aes(peso))
> h + geom_histogram(binwidth=5) + xlim=c(80,220)) +
opts(panel.background = theme_rect(colour = NA)) +
opts(panel.grid.major = theme_line(linetype = "dotted"))
En este gráfico se especifica el
ancho del intervalo del
histograma, el limite del eje x y
además se ha modificado el fondo
y la grilla.
Poder del paquete ggplot
Poder del paquete ggplot

Mais conteúdo relacionado

Mais procurados

Probability distribution in R
Probability distribution in RProbability distribution in R
Probability distribution in RAlichy Sowmya
 
Numerical analysis kuhn tucker eqn
Numerical analysis  kuhn tucker eqnNumerical analysis  kuhn tucker eqn
Numerical analysis kuhn tucker eqnSHAMJITH KM
 
Introduction to PROMETHEE : An Outranking MCDM
Introduction to PROMETHEE : An Outranking MCDMIntroduction to PROMETHEE : An Outranking MCDM
Introduction to PROMETHEE : An Outranking MCDMMrinmoy Majumder
 
Support Vector Machines
Support Vector MachinesSupport Vector Machines
Support Vector Machinesnextlib
 
Data-driven modeling: Lecture 01
Data-driven modeling: Lecture 01Data-driven modeling: Lecture 01
Data-driven modeling: Lecture 01jakehofman
 
Time series analysis- Part 2
Time series analysis- Part 2Time series analysis- Part 2
Time series analysis- Part 2QuantUniversity
 
Time series analysis in Stata
Time series analysis in StataTime series analysis in Stata
Time series analysis in Statashahisec1
 
07 Machine Learning - Expectation Maximization
07 Machine Learning - Expectation Maximization07 Machine Learning - Expectation Maximization
07 Machine Learning - Expectation MaximizationAndres Mendez-Vazquez
 
Linear regression without tears
Linear regression without tearsLinear regression without tears
Linear regression without tearsAnkit Sharma
 
Tamara G. Kolda, Distinguished Member of Technical Staff, Sandia National Lab...
Tamara G. Kolda, Distinguished Member of Technical Staff, Sandia National Lab...Tamara G. Kolda, Distinguished Member of Technical Staff, Sandia National Lab...
Tamara G. Kolda, Distinguished Member of Technical Staff, Sandia National Lab...MLconf
 
STATA - Linear Regressions
STATA - Linear RegressionsSTATA - Linear Regressions
STATA - Linear Regressionsstata_org_uk
 
Principal Component Analysis and Cluster Analysis
Principal Component Analysis and Cluster AnalysisPrincipal Component Analysis and Cluster Analysis
Principal Component Analysis and Cluster AnalysisMuhammed Ameer
 
support vector regression
support vector regressionsupport vector regression
support vector regressionAkhilesh Joshi
 
Multiple comparison problem
Multiple comparison problemMultiple comparison problem
Multiple comparison problemJiri Haviger
 
Introduction to Probability and Bayes' Theorom
Introduction to Probability and Bayes' TheoromIntroduction to Probability and Bayes' Theorom
Introduction to Probability and Bayes' TheoromYugal Gupta
 

Mais procurados (20)

Probability distribution in R
Probability distribution in RProbability distribution in R
Probability distribution in R
 
Probability
ProbabilityProbability
Probability
 
Numerical analysis kuhn tucker eqn
Numerical analysis  kuhn tucker eqnNumerical analysis  kuhn tucker eqn
Numerical analysis kuhn tucker eqn
 
Introduction to PROMETHEE : An Outranking MCDM
Introduction to PROMETHEE : An Outranking MCDMIntroduction to PROMETHEE : An Outranking MCDM
Introduction to PROMETHEE : An Outranking MCDM
 
Support Vector Machines
Support Vector MachinesSupport Vector Machines
Support Vector Machines
 
Data-driven modeling: Lecture 01
Data-driven modeling: Lecture 01Data-driven modeling: Lecture 01
Data-driven modeling: Lecture 01
 
Linear regression theory
Linear regression theoryLinear regression theory
Linear regression theory
 
Sampling Distribution
Sampling DistributionSampling Distribution
Sampling Distribution
 
Time series analysis- Part 2
Time series analysis- Part 2Time series analysis- Part 2
Time series analysis- Part 2
 
Time series analysis in Stata
Time series analysis in StataTime series analysis in Stata
Time series analysis in Stata
 
07 Machine Learning - Expectation Maximization
07 Machine Learning - Expectation Maximization07 Machine Learning - Expectation Maximization
07 Machine Learning - Expectation Maximization
 
Linear regression without tears
Linear regression without tearsLinear regression without tears
Linear regression without tears
 
Tamara G. Kolda, Distinguished Member of Technical Staff, Sandia National Lab...
Tamara G. Kolda, Distinguished Member of Technical Staff, Sandia National Lab...Tamara G. Kolda, Distinguished Member of Technical Staff, Sandia National Lab...
Tamara G. Kolda, Distinguished Member of Technical Staff, Sandia National Lab...
 
STATA - Linear Regressions
STATA - Linear RegressionsSTATA - Linear Regressions
STATA - Linear Regressions
 
Análisis de regresión logística.pdf
Análisis de regresión logística.pdfAnálisis de regresión logística.pdf
Análisis de regresión logística.pdf
 
Counting
CountingCounting
Counting
 
Principal Component Analysis and Cluster Analysis
Principal Component Analysis and Cluster AnalysisPrincipal Component Analysis and Cluster Analysis
Principal Component Analysis and Cluster Analysis
 
support vector regression
support vector regressionsupport vector regression
support vector regression
 
Multiple comparison problem
Multiple comparison problemMultiple comparison problem
Multiple comparison problem
 
Introduction to Probability and Bayes' Theorom
Introduction to Probability and Bayes' TheoromIntroduction to Probability and Bayes' Theorom
Introduction to Probability and Bayes' Theorom
 

Destaque

Tutorial de php y my sql completo
Tutorial de php y my sql completoTutorial de php y my sql completo
Tutorial de php y my sql completoIgnacio Reyes
 
Análisis espacial con R (asignatura de Master - UPM)
Análisis espacial con R (asignatura de Master - UPM)Análisis espacial con R (asignatura de Master - UPM)
Análisis espacial con R (asignatura de Master - UPM)Vladimir Gutierrez, PhD
 
WF ED 540, Class Meeting 3 - Introduction to dplyr, 2016
WF ED 540, Class Meeting 3 - Introduction to dplyr, 2016WF ED 540, Class Meeting 3 - Introduction to dplyr, 2016
WF ED 540, Class Meeting 3 - Introduction to dplyr, 2016Penn State University
 
20160611 kintone Café 高知 Vol.3 LT資料
20160611 kintone Café 高知 Vol.3 LT資料20160611 kintone Café 高知 Vol.3 LT資料
20160611 kintone Café 高知 Vol.3 LT資料安隆 沖
 
R Brown-bag seminars : Seminar-8
R Brown-bag seminars : Seminar-8R Brown-bag seminars : Seminar-8
R Brown-bag seminars : Seminar-8Muhammad Nabi Ahmad
 
Learn to use dplyr (Feb 2015 Philly R User Meetup)
Learn to use dplyr (Feb 2015 Philly R User Meetup)Learn to use dplyr (Feb 2015 Philly R User Meetup)
Learn to use dplyr (Feb 2015 Philly R User Meetup)Fan Li
 
WF ED 540, Class Meeting 3 - mutate and summarise, 2016
WF ED 540, Class Meeting 3 - mutate and summarise, 2016WF ED 540, Class Meeting 3 - mutate and summarise, 2016
WF ED 540, Class Meeting 3 - mutate and summarise, 2016Penn State University
 
WF ED 540, Class Meeting 3 - select, filter, arrange, 2016
WF ED 540, Class Meeting 3 - select, filter, arrange, 2016WF ED 540, Class Meeting 3 - select, filter, arrange, 2016
WF ED 540, Class Meeting 3 - select, filter, arrange, 2016Penn State University
 
Reproducible Research in R and R Studio
Reproducible Research in R and R StudioReproducible Research in R and R Studio
Reproducible Research in R and R StudioSusan Johnston
 
Data and donuts: Data Visualization using R
Data and donuts: Data Visualization using RData and donuts: Data Visualization using R
Data and donuts: Data Visualization using RC. Tobin Magle
 
Chunked, dplyr for large text files
Chunked, dplyr for large text filesChunked, dplyr for large text files
Chunked, dplyr for large text filesEdwin de Jonge
 
Next Generation Programming in R
Next Generation Programming in RNext Generation Programming in R
Next Generation Programming in RFlorian Uhlitz
 
R and Rcmdr Statistical Software
R and Rcmdr Statistical SoftwareR and Rcmdr Statistical Software
R and Rcmdr Statistical Softwarearttan2001
 
Introduction to R Short course Fall 2016
Introduction to R Short course Fall 2016Introduction to R Short course Fall 2016
Introduction to R Short course Fall 2016Spencer Fox
 
Spatial Data Science with R
Spatial Data Science with RSpatial Data Science with R
Spatial Data Science with Ramsantac
 

Destaque (20)

(3) Curso sobre el software estadístico R: La librería ggplot2
(3) Curso sobre el software estadístico R: La librería ggplot2(3) Curso sobre el software estadístico R: La librería ggplot2
(3) Curso sobre el software estadístico R: La librería ggplot2
 
Tutorial de php y my sql completo
Tutorial de php y my sql completoTutorial de php y my sql completo
Tutorial de php y my sql completo
 
Análisis espacial con R (asignatura de Master - UPM)
Análisis espacial con R (asignatura de Master - UPM)Análisis espacial con R (asignatura de Master - UPM)
Análisis espacial con R (asignatura de Master - UPM)
 
WF ED 540, Class Meeting 3 - Introduction to dplyr, 2016
WF ED 540, Class Meeting 3 - Introduction to dplyr, 2016WF ED 540, Class Meeting 3 - Introduction to dplyr, 2016
WF ED 540, Class Meeting 3 - Introduction to dplyr, 2016
 
20160611 kintone Café 高知 Vol.3 LT資料
20160611 kintone Café 高知 Vol.3 LT資料20160611 kintone Café 高知 Vol.3 LT資料
20160611 kintone Café 高知 Vol.3 LT資料
 
Rlecturenotes
RlecturenotesRlecturenotes
Rlecturenotes
 
R Brown-bag seminars : Seminar-8
R Brown-bag seminars : Seminar-8R Brown-bag seminars : Seminar-8
R Brown-bag seminars : Seminar-8
 
Learn to use dplyr (Feb 2015 Philly R User Meetup)
Learn to use dplyr (Feb 2015 Philly R User Meetup)Learn to use dplyr (Feb 2015 Philly R User Meetup)
Learn to use dplyr (Feb 2015 Philly R User Meetup)
 
WF ED 540, Class Meeting 3 - mutate and summarise, 2016
WF ED 540, Class Meeting 3 - mutate and summarise, 2016WF ED 540, Class Meeting 3 - mutate and summarise, 2016
WF ED 540, Class Meeting 3 - mutate and summarise, 2016
 
R seminar dplyr package
R seminar dplyr packageR seminar dplyr package
R seminar dplyr package
 
WF ED 540, Class Meeting 3 - select, filter, arrange, 2016
WF ED 540, Class Meeting 3 - select, filter, arrange, 2016WF ED 540, Class Meeting 3 - select, filter, arrange, 2016
WF ED 540, Class Meeting 3 - select, filter, arrange, 2016
 
Reproducible Research in R and R Studio
Reproducible Research in R and R StudioReproducible Research in R and R Studio
Reproducible Research in R and R Studio
 
Dplyr and Plyr
Dplyr and PlyrDplyr and Plyr
Dplyr and Plyr
 
Data and donuts: Data Visualization using R
Data and donuts: Data Visualization using RData and donuts: Data Visualization using R
Data and donuts: Data Visualization using R
 
Chunked, dplyr for large text files
Chunked, dplyr for large text filesChunked, dplyr for large text files
Chunked, dplyr for large text files
 
Next Generation Programming in R
Next Generation Programming in RNext Generation Programming in R
Next Generation Programming in R
 
R and Rcmdr Statistical Software
R and Rcmdr Statistical SoftwareR and Rcmdr Statistical Software
R and Rcmdr Statistical Software
 
Tokyor36
Tokyor36Tokyor36
Tokyor36
 
Introduction to R Short course Fall 2016
Introduction to R Short course Fall 2016Introduction to R Short course Fall 2016
Introduction to R Short course Fall 2016
 
Spatial Data Science with R
Spatial Data Science with RSpatial Data Science with R
Spatial Data Science with R
 

Semelhante a Paquete ggplot - Potencia y facilidad para generar gráficos en R

Semelhante a Paquete ggplot - Potencia y facilidad para generar gráficos en R (20)

Clase 3 (1)
Clase 3 (1)Clase 3 (1)
Clase 3 (1)
 
Graficas en matlab 2 d y 3d
Graficas en matlab 2 d y 3dGraficas en matlab 2 d y 3d
Graficas en matlab 2 d y 3d
 
clase 7 GRAFICOS 2D.pdf
clase 7 GRAFICOS 2D.pdfclase 7 GRAFICOS 2D.pdf
clase 7 GRAFICOS 2D.pdf
 
Creacion de graficos eficientes con ggplot2
Creacion de graficos eficientes con ggplot2Creacion de graficos eficientes con ggplot2
Creacion de graficos eficientes con ggplot2
 
Plots
PlotsPlots
Plots
 
Matlab 2 Capitulo 6
Matlab 2 Capitulo 6Matlab 2 Capitulo 6
Matlab 2 Capitulo 6
 
Graficas 2D y 3D
Graficas 2D y 3DGraficas 2D y 3D
Graficas 2D y 3D
 
Graficas en matlab
Graficas en matlabGraficas en matlab
Graficas en matlab
 
Graficos matlab
Graficos matlabGraficos matlab
Graficos matlab
 
Graficos matlab
Graficos matlabGraficos matlab
Graficos matlab
 
Mat lab03
Mat lab03Mat lab03
Mat lab03
 
Gráficas en Matlab
Gráficas en MatlabGráficas en Matlab
Gráficas en Matlab
 
Enseñar funciones con advanced grapher
Enseñar funciones con advanced grapherEnseñar funciones con advanced grapher
Enseñar funciones con advanced grapher
 
Enseñar funciones con advanced grapher
Enseñar funciones con advanced grapherEnseñar funciones con advanced grapher
Enseñar funciones con advanced grapher
 
(2) Curso sobre el software estadístico R: La librería googleVis
(2) Curso sobre el software estadístico R: La librería googleVis(2) Curso sobre el software estadístico R: La librería googleVis
(2) Curso sobre el software estadístico R: La librería googleVis
 
Diapograficos
DiapograficosDiapograficos
Diapograficos
 
Gnuplot tut
Gnuplot tutGnuplot tut
Gnuplot tut
 
Graficos en matlab
Graficos en matlabGraficos en matlab
Graficos en matlab
 
1 curso de-solid-works-pdf
1 curso de-solid-works-pdf1 curso de-solid-works-pdf
1 curso de-solid-works-pdf
 
Graficos en Qt.ppt
Graficos en Qt.pptGraficos en Qt.ppt
Graficos en Qt.ppt
 

Último

CONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptx
CONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptxCONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptx
CONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptxroberthirigoinvasque
 
origen y desarrollo del ensayo literario
origen y desarrollo del ensayo literarioorigen y desarrollo del ensayo literario
origen y desarrollo del ensayo literarioELIASAURELIOCHAVEZCA1
 
Concepto y definición de tipos de Datos Abstractos en c++.pptx
Concepto y definición de tipos de Datos Abstractos en c++.pptxConcepto y definición de tipos de Datos Abstractos en c++.pptx
Concepto y definición de tipos de Datos Abstractos en c++.pptxFernando Solis
 
La Sostenibilidad Corporativa. Administración Ambiental
La Sostenibilidad Corporativa. Administración AmbientalLa Sostenibilidad Corporativa. Administración Ambiental
La Sostenibilidad Corporativa. Administración AmbientalJonathanCovena1
 
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLAACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLAJAVIER SOLIS NOYOLA
 
Feliz Día de la Madre - 5 de Mayo, 2024.pdf
Feliz Día de la Madre - 5 de Mayo, 2024.pdfFeliz Día de la Madre - 5 de Mayo, 2024.pdf
Feliz Día de la Madre - 5 de Mayo, 2024.pdfMercedes Gonzalez
 
Abril 2024 - Maestra Jardinera Ediba.pdf
Abril 2024 -  Maestra Jardinera Ediba.pdfAbril 2024 -  Maestra Jardinera Ediba.pdf
Abril 2024 - Maestra Jardinera Ediba.pdfValeriaCorrea29
 
Diapositivas de animales reptiles secundaria
Diapositivas de animales reptiles secundariaDiapositivas de animales reptiles secundaria
Diapositivas de animales reptiles secundariaAlejandraFelizDidier
 
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICABIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICAÁngel Encinas
 
INSTRUCCION PREPARATORIA DE TIRO .pptx
INSTRUCCION PREPARATORIA DE TIRO   .pptxINSTRUCCION PREPARATORIA DE TIRO   .pptx
INSTRUCCION PREPARATORIA DE TIRO .pptxdeimerhdz21
 
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VSOCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VSYadi Campos
 
Tema 19. Inmunología y el sistema inmunitario 2024
Tema 19. Inmunología y el sistema inmunitario 2024Tema 19. Inmunología y el sistema inmunitario 2024
Tema 19. Inmunología y el sistema inmunitario 2024IES Vicent Andres Estelles
 
ACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLA
ACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLAACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLA
ACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLAJAVIER SOLIS NOYOLA
 
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURAFORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURAEl Fortí
 
TEMA 14.DERIVACIONES ECONÓMICAS, SOCIALES Y POLÍTICAS DEL PROCESO DE INTEGRAC...
TEMA 14.DERIVACIONES ECONÓMICAS, SOCIALES Y POLÍTICAS DEL PROCESO DE INTEGRAC...TEMA 14.DERIVACIONES ECONÓMICAS, SOCIALES Y POLÍTICAS DEL PROCESO DE INTEGRAC...
TEMA 14.DERIVACIONES ECONÓMICAS, SOCIALES Y POLÍTICAS DEL PROCESO DE INTEGRAC...jlorentemartos
 
6°_GRADO_-_MAYO_06 para sexto grado de primaria
6°_GRADO_-_MAYO_06 para sexto grado de primaria6°_GRADO_-_MAYO_06 para sexto grado de primaria
6°_GRADO_-_MAYO_06 para sexto grado de primariaWilian24
 
LA LITERATURA DEL BARROCO 2023-2024pptx.pptx
LA LITERATURA DEL BARROCO 2023-2024pptx.pptxLA LITERATURA DEL BARROCO 2023-2024pptx.pptx
LA LITERATURA DEL BARROCO 2023-2024pptx.pptxlclcarmen
 
TIENDAS MASS MINIMARKET ESTUDIO DE MERCADO
TIENDAS MASS MINIMARKET ESTUDIO DE MERCADOTIENDAS MASS MINIMARKET ESTUDIO DE MERCADO
TIENDAS MASS MINIMARKET ESTUDIO DE MERCADOPsicoterapia Holística
 
2 REGLAMENTO RM 0912-2024 DE MODALIDADES DE GRADUACIÓN_.pptx
2 REGLAMENTO RM 0912-2024 DE MODALIDADES DE GRADUACIÓN_.pptx2 REGLAMENTO RM 0912-2024 DE MODALIDADES DE GRADUACIÓN_.pptx
2 REGLAMENTO RM 0912-2024 DE MODALIDADES DE GRADUACIÓN_.pptxRigoTito
 

Último (20)

CONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptx
CONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptxCONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptx
CONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptx
 
origen y desarrollo del ensayo literario
origen y desarrollo del ensayo literarioorigen y desarrollo del ensayo literario
origen y desarrollo del ensayo literario
 
Concepto y definición de tipos de Datos Abstractos en c++.pptx
Concepto y definición de tipos de Datos Abstractos en c++.pptxConcepto y definición de tipos de Datos Abstractos en c++.pptx
Concepto y definición de tipos de Datos Abstractos en c++.pptx
 
La Sostenibilidad Corporativa. Administración Ambiental
La Sostenibilidad Corporativa. Administración AmbientalLa Sostenibilidad Corporativa. Administración Ambiental
La Sostenibilidad Corporativa. Administración Ambiental
 
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLAACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
 
Feliz Día de la Madre - 5 de Mayo, 2024.pdf
Feliz Día de la Madre - 5 de Mayo, 2024.pdfFeliz Día de la Madre - 5 de Mayo, 2024.pdf
Feliz Día de la Madre - 5 de Mayo, 2024.pdf
 
Abril 2024 - Maestra Jardinera Ediba.pdf
Abril 2024 -  Maestra Jardinera Ediba.pdfAbril 2024 -  Maestra Jardinera Ediba.pdf
Abril 2024 - Maestra Jardinera Ediba.pdf
 
Diapositivas de animales reptiles secundaria
Diapositivas de animales reptiles secundariaDiapositivas de animales reptiles secundaria
Diapositivas de animales reptiles secundaria
 
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICABIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
 
INSTRUCCION PREPARATORIA DE TIRO .pptx
INSTRUCCION PREPARATORIA DE TIRO   .pptxINSTRUCCION PREPARATORIA DE TIRO   .pptx
INSTRUCCION PREPARATORIA DE TIRO .pptx
 
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VSOCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
 
Power Point: Fe contra todo pronóstico.pptx
Power Point: Fe contra todo pronóstico.pptxPower Point: Fe contra todo pronóstico.pptx
Power Point: Fe contra todo pronóstico.pptx
 
Tema 19. Inmunología y el sistema inmunitario 2024
Tema 19. Inmunología y el sistema inmunitario 2024Tema 19. Inmunología y el sistema inmunitario 2024
Tema 19. Inmunología y el sistema inmunitario 2024
 
ACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLA
ACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLAACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLA
ACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLA
 
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURAFORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
 
TEMA 14.DERIVACIONES ECONÓMICAS, SOCIALES Y POLÍTICAS DEL PROCESO DE INTEGRAC...
TEMA 14.DERIVACIONES ECONÓMICAS, SOCIALES Y POLÍTICAS DEL PROCESO DE INTEGRAC...TEMA 14.DERIVACIONES ECONÓMICAS, SOCIALES Y POLÍTICAS DEL PROCESO DE INTEGRAC...
TEMA 14.DERIVACIONES ECONÓMICAS, SOCIALES Y POLÍTICAS DEL PROCESO DE INTEGRAC...
 
6°_GRADO_-_MAYO_06 para sexto grado de primaria
6°_GRADO_-_MAYO_06 para sexto grado de primaria6°_GRADO_-_MAYO_06 para sexto grado de primaria
6°_GRADO_-_MAYO_06 para sexto grado de primaria
 
LA LITERATURA DEL BARROCO 2023-2024pptx.pptx
LA LITERATURA DEL BARROCO 2023-2024pptx.pptxLA LITERATURA DEL BARROCO 2023-2024pptx.pptx
LA LITERATURA DEL BARROCO 2023-2024pptx.pptx
 
TIENDAS MASS MINIMARKET ESTUDIO DE MERCADO
TIENDAS MASS MINIMARKET ESTUDIO DE MERCADOTIENDAS MASS MINIMARKET ESTUDIO DE MERCADO
TIENDAS MASS MINIMARKET ESTUDIO DE MERCADO
 
2 REGLAMENTO RM 0912-2024 DE MODALIDADES DE GRADUACIÓN_.pptx
2 REGLAMENTO RM 0912-2024 DE MODALIDADES DE GRADUACIÓN_.pptx2 REGLAMENTO RM 0912-2024 DE MODALIDADES DE GRADUACIÓN_.pptx
2 REGLAMENTO RM 0912-2024 DE MODALIDADES DE GRADUACIÓN_.pptx
 

Paquete ggplot - Potencia y facilidad para generar gráficos en R

  • 1. PAQUETE GGPLOT.- POTENCIA Y FACILIDAD PARA GENERAR GRÁFICOS Néstor Montaño, Julio Villamar Instituto de Ciencias Matemáticas nestor.montano@gmail.com, j.villamar.2009@gmail.com
  • 2. Componentes de un gráfico • Datos junto con características estéticas • Objetos geométricos, (puntos, líneas, polígonos, áreas, etc.) • Transformaciones estadísticas • Escalas • Sistema de coordenadas • Condicionamiento
  • 3. Comando qplot • Considere un data.frame llamado “datos” el cual contiene las variables: “Peso” “Altura” y “genero” > qplot(x, y, data) > qplot(altura, peso, data=datos) Los comandos así planteados generan un gráfico de dispersión Altura vs Peso
  • 4. …Comando qplot “altura” vs “peso” según el “género”, entonces podemos agregar al grafico la característica estética color asociada a la variable categórica “genero”. >qplot(altura, peso, data= datos, colour =genero ,xlab="Altura (Centimetros)", ylab="Peso (Libras)")
  • 5. …Comando qplot Aquí además de los puntos se muestra la tendencia mediante una línea suavizada. >qplot(altura,peso,data= datos, geom=c("point","smooth"), xlab="Altura (Centimetros)", ylab="Peso (Libras)") > library(splines) >qplot(altura,peso,data= datos, geom=c("point","smooth"), method=”lm”, xlab="Altura (Centimetros)", ylab="Peso (Libras)") También se puede usar librerías especializadas para generar la tendencia.
  • 6. …Comando qplot Este gráfico se ilustra es uso de transparencias, así los puntos más oscuros indican que hay varias observaciones ocupando el mismo lugar. > qplot(nivel,peso, data = x, alpha=I(1/5), xlab="Nivel de Educacion", ylab="Peso (libras)")
  • 7. …Comando qplot Si se quiere conocer si existe alguna mejoría en la relación “altura” vs “peso” cuando aumenta el “nivel de educación” de los individuos, se usa el comando facet como se muestra aquí. > qplot(nivel,peso, data = x, alpha=I(1/5), xlab="Nivel de Educacion", ylab="Peso (libras)")
  • 8. …Comando qplot Ahora agrupamos los datos por nivel de educación y por el género > qplot(altura,peso,data= datos, xlab="Altura (Centimetros)" , ylab="Peso (Libras)") + facet_grid(genero~nivel)
  • 9. …Comando qplot Histograma de frecuencias para la variable Peso >qplot(peso, data= datos, geom = “histogram”)
  • 10. …Comando qplot Aquí se modifica el ancho de los intervalos, además se espefica los limites del eje x. >qplot(peso, data= datos, geom = “histogram”, binwidth = 5, xlim=c(80,220))
  • 11. Comando ggplot Al usar ggplot() el primer paso es crear el objeto “gráfico” de la siguiente manera: > g <- ggplot(datos, aes(altura, peso, colour = genero)) Aquí se asigna a la variable “g” el gráfico creado, el mismo que usa el data.frame “datos” y las características estéticas que se le declaran son “altura” para el eje x, “peso” para el eje y, y “género” para color. Así planteado, el gráfico aún no puede ser visualizado pues no se le ha insertado capa alguna
  • 12. Comando ggplot Aquí, al la variable “g” se le aumenta un layer de puntos > g + layer( geom = ”point”) > g + geom_point Otra forma (más sencilla) de hacer esto es:
  • 13. Comando ggplot > g + geom_point()+ geom_smooth()
  • 14. Comando ggplot > g + geom_point() + facet_grid(.~nivel)
  • 15. Comando ggplot > h<- ggplot (datos, aes(peso)) > h + geom_histogram(binwidth=5) + xlim=c(80,220))
  • 16. Comando ggplot > h<- ggplot (datos, aes(peso)) > h + geom_histogram(binwidth=5) + xlim=c(80,220)) + opts(panel.background = theme_rect(colour = NA)) + opts(panel.grid.major = theme_line(linetype = "dotted")) En este gráfico se especifica el ancho del intervalo del histograma, el limite del eje x y además se ha modificado el fondo y la grilla.