text in ggplot2

Step 1: Load the required package. Use the command "library(ggplot2)" to load the ggplot2 package.

Step 2: Create a data frame. Use the command "data <- data.frame(x = c(1, 2, 3, 4, 5), y = c(2, 3, 5, 7, 11))" to create a data frame with x and y values.

Step 3: Create the plot. Use the command "ggplot(data, aes(x = x, y = y)) + geom_point()" to create a scatter plot with x and y values.

Step 4: Add title and labels. Use the command "+ labs(title = 'Scatter Plot', x = 'X Axis', y = 'Y Axis')" to add title and axis labels to the plot.

Step 5: Customize the plot. Use additional commands such as "+ theme_minimal()" to customize the appearance of the plot.

Step 6: Display the plot. Use the command "print(plot)" to display the final plot.