I have troubles plotting a scatter plot for my data. I have 1 independent variable "Strain" for which I have 3 explanatory values. See structure dataframe
'data.frame': 30 obs. of 4 variables:
$ Strain : Factor w/ 30 levels "1","10","11",..: 1 12 14 15 25 27 28 29 30 2 ...
$ second_hour : Factor w/ 30 levels "10356.3888888889",..: 15 16 8 14 7 6 11 10 13 12 ...
$ second_hour_n: Factor w/ 30 levels "10149.4751953184",..: 5 4 15 6 18 19 13 14 9 12 ...
$ Beula : num 21674 21308 19905 20817 20017 ...
> head(hour_2)
Strain second_hour second_hour_n Beula
1 1 19354.4444444444 12103.3628274451 21673.72
2 2 20021.2222222222 11577.7991047524 21307.61
3 3 16105.9444444444 14425.8808435683 19905.39
4 4 18993.3888888889 12149.3204615723 20816.78
5 5 15541.3888888889 15370.8433645383 20016.94
6 6 14767.1666666667 16288.3635541566 19000.44
I would like to plot in a scatterplot each explanatory value for each strain colored coded.
In my current attempt I first melt the dataframe using the following code:
> hour_2_melted <- melt(hour_2, id.vars = "Strain")
Warning message:
attributes are not identical across measure variables; they will be dropped
Then I plot
ggplot(hour_2_melted, aes(Strain, value)) + geom_point()
However the Y axis cannot be changed because its continuous, I do not want each value to be shown on the y axis. Also the x axis is in a strange order. Lastly, how do I color code the 3 different explanatory values?
Any help is appreciated.