### Creating a ggplot graphggplot(olive, aes(x = palmitic, y = oleic, color = region)) +geom_point(alpha =0.7) +# Adding transparency to pointslabs(title ="Fatty Acid Composition of Olive Oils Across Italy",x ="Percentage of Palmitic Acid",y ="Percentage of Oleic Acid",color ="Region", caption ="Source: DSLABS Data Set Olive") +theme_minimal()
2nd Visualization
Making a high charter graph
*** CHATGTP was used to help make the high charter and look and fix for errors
hc <-highchart() |>hc_chart(type ="scatter") |>hc_add_series(data = olive[olive$region =="Northern Italy", ], type ="scatter", hcaes(x = palmitic, y = oleic), color ="red", name ="Northern Italy") |>hc_add_series(data = olive[olive$region =="Sardinia", ], type ="scatter", hcaes(x = palmitic, y = oleic), color ="green", name ="Sardinia") |>hc_add_series(data = olive[olive$region =="Southern Italy", ], type ="scatter", hcaes(x = palmitic, y = oleic), color ="blue", name ="Southern Italy") |>hc_legend(layout ="horizontal", align ="center", verticalAlign ="bottom") |>hc_title(text ="Fatty Acid Composition of Olive Oils Across Italy")|>hc_xAxis(title =list(text ="Percentage of Palmitic Acid")) |>hc_yAxis(title =list(text ="Percentage of Oleic Acid")) |>hc_plotOptions(scatter =list(marker =list(symbol ="circle",radius =5 ) ) ) |>hc_tooltip(pointFormat ="<br>Percentage of Palmitic Acid: {point.x:.2f}%<br>Percentage of Oleic Acid: {point.y:.2f}%<br>Area: {point.area}") |>hc_subtitle(text ="Source: DSLABS Data Set Olive")hc
The data set I used is called olive it is from the DSLABS library. The variables I used were region, area, palmitic, and oleic.I created the graph using both high charter and ggplot2. The graph from high charter uses the variable area while the ggplot2 does not. The variable palmitic is used as the x-axis while the variable oleic is used as the y-axis, the color of the dots represents the region of where the oil sample was from. I chose to use the variables palmitic and and oleic because they are two of the main fatty acids found in olive oils. The percentage of each fatty acid varies by region, by using these two variables and the percentage of each by region allows us to gain insight into the composition of olive oils across Italy.
** CHATGTP was used to look for errors and fix them.
** CHATGTP was used to help make the high charter graph