class: center, middle, inverse, title-slide .title[ # R Markdown Presentation & Plotly ] .author[ ### PamiQami ] .date[ ### 06-Jan-2024 ] --- ### Introduction 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! --- ### Grading Criteria Overview The rubric contains the following two questions: Does the web page feature a date and is this date less than two months before the date that you're grading this assignment? Is the web page a presentation and does it feature an interactive plot that appears to have been created with Plotly? --- ### Introduction to the Volcano Dataset - **Dataset Overview**: Represents topography of Auckland's Maungawhau (Mount Eden), a volcanic peak in New Zealand. - **Matrix Format**: 87 rows x 61 columns, each cell indicating elevation at that point. - **Elevation Range**: Varied elevations depicting the volcano's surface features. - **Visualization Use**: Ideal for 3D surface plots, contour maps, and heatmaps to analyze terrain structure. - **Educational Application**: Commonly used in data visualization and geosciences education. --- ### Presentation of Dataset using a Surface Plot ```r # Load the plotly package for creating interactive plots. library(plotly) ``` ``` ## Loading required package: ggplot2 ``` ``` ## ## 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 ``` --- ```r custom_colorscale <- list( c(0, "green"), c(0.25, "lightgreen"), c(0.5, "yellow"), c(0.75, "orange"), c(1, "red") ) # Create a surface plot using the 'volcano' dataset. plot_ly(z=volcano, type="surface", colorscale = custom_colorscale) %>% layout(scene = list(colorbar = list(title = "Elevation", zmin = 100, zmax = 180))) ```
--- ### Presentation of Dataset using a 3D contour plot ```r # Create a 3D contour plot of the volcano dataset plot_ly(z = ~volcano, type = "contour", contours = list( showlabels = TRUE, labelfont = list( size = 12, color = 'white' ) )) %>% layout(title = "3D Contour Plot of the Volcano Dataset", scene = list( zaxis = list(title = "Elevation") )) ```
--- ### Analytical Graph - Histogram of Elevation ```r # Convert the 'volcano' dataset to a vector. volcano_values <- as.vector(volcano) # Create a histogram using the Plotly package. plot_ly(x = volcano_values, type = "histogram", marker = list(color = "grey")) %>% # Customize the layout of the plot. layout(title = "Histogram of Elevation Values") ```