1. Assignment

Create a web page presentation using R Markdown that features a plot created with Plotly. Host your webpage on either GitHub Pages, RPubs, or NeoCities. Your webpage must contain the date that you created the document, and it must contain a plot created with Plotly. We would love to see you show off your creativity!

2. Project Objective

The objectives of the projects are the following:

A.From a data set implement the functionality.

B. Create an interactive graph using the plotly () function.

C. Publish a page either in Rpubs, GitPages or Neocities where the developed project is observed.

3. Introduction

Este ejercicio tiene como objetivo hacer un gráfico usando la función plotly (), así como también usando un conjunto de datos muy común en RStudio denominado Diamonts que muestra la pureza y calidad de los diamantes.

4. Description of diamonts data and variables

In total there are 53,930 records with 10 variables, which we show below:

5. Description of the topic and the clarity variable

We use a 10X magnifying glass (10x magnification) or a binocular to observe inclusions in a diamond. Once detected, an inclusion is observed by the table or by the crown to determine:

These three factors determine its visibility and are translated by the purity scale.

5. Load and display the data

Load and display the data

carat cut       color clarity depth table price     x     y     z
<dbl> <ord>     <ord> <ord>   <dbl> <dbl> <int> <dbl> <dbl> <dbl>
1 0.23  Ideal     E     SI2      61.5    55   326  3.95  3.98  2.43
2 0.21  Premium   E     SI1      59.8    61   326  3.89  3.84  2.31
3 0.23  Good      E     VS1      56.9    65   327  4.05  4.07  2.31
4 0.290 Premium   I     VS2      62.4    58   334  4.2   4.23  2.63
5 0.31  Good      J     SI2      63.3    58   335  4.34  4.35  2.75
6 0.24  Very Good J     VVS2     62.8    57   336  3.94  3.96  2.48
7 0.24  Very Good I     VVS1     62.3    57   336  3.95  3.98  2.47
8 0.26  Very Good H     SI1      61.9    55   337  4.07  4.11  2.53
9 0.22  Fair      E     VS2      65.1    61   337  3.87  3.78  2.49
10 0.23  Very Good H     VS1      59.4    61   338  4     4.05  2.39
# ... with 53,930 more rows

6. Configuration and installation

### install.packages("ggplot2")
### install.packages("stats")
### install.packages("graphics")
### install.packages("plotly")

library("ggplot2")
library("stats")
library("graphics")
library("plotly")
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout

7. Visualization with function plotly()

data <- with(diamonds, table(cut, clarity))
vis <- plot_ly(diamonds, x = ~cut, y = ~clarity, z = ~data)
vis <- vis %>% add_histogram2d(colorscale = "Blues")
vis

8. Visualization two with function plotly()

data1 <- with(diamonds, table(price, color))
vis1 <- plot_ly(diamonds, x = ~color, y = ~price, z = ~data1)
vis1 <- vis1 %>% add_histogram2d(colorscale = "Reds")
vis1