ggplotboxplot only lines

Hello Community
i have problems creating a boxplot with ggplot2.
don't understand why all my data is displayed separately and not as a boxplot?
My data looks like this:
Sample;Treatment;Photosynthesis;GDCPCT
Salsola divaricata;WL;C2;0,884788457
Salsola divaricata;WL;C2;0,888132934
Salsola divaricata;WL;C2;0,908875403
Salsola divaricata;WL;C2;0,921532881
Salsola divaricata;WL;C2;0,938461479
Salsola divaricata;WL;C2;0,958913242
Salsola montana;WL;C3 proto kranz;0,926912652
Salsola montana;WL;C3 proto kranz;0,938329189
Salsola montana;WL;C3 proto kranz;0,957788776
Salsola montana;WL;C3 proto kranz;0,959011193
Salsola montana;WL;C3 proto kranz;0,980656801
Salsoa oppositifolia;WL;C4;0,913523297
Salsoa oppositifolia;WL;C4;0,96822834
Salsoa oppositifolia;WL;C4;0,982460805
Salsoa oppositifolia;WL;C4;0,991995221
Salsoa oppositifolia;WL;C4;0,999840011
Salsoa oppositifolia;WL;C4;1
Salsoa verticillata;WL;C2;0,904632244
Salsoa verticillata;WL;C2;0,906326852
Salsoa verticillata;WL;C2;0,910975881
Salsoa verticillata;WL;C2;0,914321407
Salsoa verticillata;WL;C2;0,933533714
Salsoa verticillata;WL;C2;0,942705949
Salsoa webii;WL;C3;0,855379583
Salsoa webii;WL;C3;0,945500033
Salsoa webii;WL;C3;0,954598608
Anabasis articulata;WL;C4;0,984939717
Caroxylon vermiculatum;WL;C4;0,93828052
Salsola genistoides;WL;C3;0,842734338
Salsoa webii;WL;C3;0,81883307

and the code is as follows:
ggplot(data=GDCP, aes(x= Sample, y= GDCPCT)) + geom_boxplot()

and this is the graphic:

I hope someone can tell me why it doesn't work.

Your data for the y-axis are not numeric but characters!
If you import this from a csv file try setting the separator for numerics to ",".
Alternatively you can replace this in the dataframe, or try this in your ggplot-call:
y= as.numeric(str_replace(GDCPCT, ",", "."))
(needs library stringr or the tidyverse package)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.