My data frame looks like this :
data
>
| Segment 1 | Segment 2 | Segment 3
Segment 1 | 0.6861964 | 0.16669839 | 0.14710523
Segment 2 | 0.2211293 | 0.69263231 | 0.08623838
Segment 3 | 0.2595055 | 0.05354549 | 0.68694899
I would like to use in both axis Segment 1, Segment 2 and Segment 3 and use the values inside the table as parameters to have points of different sizes.
What I tried for the moment is to add a column Segments to the above data frame and did a melt() in order to obtain the following table:
data_melt <- melt(data, id = "Segments")
>
| Segments | variable | value
1 | Segment 1 | Segment 1 | 0.68619638
2 | Segment 2 | Segment 1 | 0.22112931
3 | Segment 3 | Segment 1 | 0.25950552
4 | Segment 1 | Segment 2 | 0.16669839
5 | Segment 2 | Segment 2 | 0.69263231
6 | Segment 3 | Segment 2 | 0.05354549
Then trying to plot it I am stuck and could not find a ressource solving my problem.
ggplot(test, aes(x = Segments, y = variable, size = value))
geom_point()
It plots the axis but no point appears and I get the following message:
geom_point: na.rm = FALSE
stat_identity: na.rm = FALSE
position_identity

aes,xandyare set to a string variables (x="Segment 1"), not a numeric value. You are attempting to plot strings as points.data_meltthe fact that they were on the same line was enough+. VTC as "simple typographical error".variablenumber, you will have to just have the values 1 or 2 in the variable column.