I have a dataset named dataset
as described below:
I am plotting the density plot using ggplot2.
I want to get those observations of the two group which overlaps in density plot.
Observations | B | Group |
---|---|---|
Obs1 | 4 | Reference |
Obs2 | 3 | Reference |
Obs3 | 5 | Reference |
Obs4 | 3 | Reference |
Obs5 | 3 | Reference |
Obs6 | 3 | User |
Obs7 | 3 | User |
Obs8 | 2 | User |
Obs9 | 2 | User |
Obs10 | 3 | User |
I have used these codes to plot the density plot: `
library(ggplot2)
library(plyr)
library(ggpubr)
#Importing dataset#
density_data <- read.csv("dataset.csv")
#Creating density plot between ref and user data, variable B#
g2 <- ggplot(density_data, aes(x=B, color=Group, fill= Group))
geom_density(color="black", alpha=0.9) labs(x= "B", y= "Density")
g2
` the output plot is like that:
CodePudding user response:
Another way of visualizing your data is with a barplot. Below is code for three visualizations: your histogram, a barplot, and a barplot with labels. Now your ID numbers are part of the visualization.
CodePudding user response:
I don't really understand the question? What do you need to plot or answer?