r - Can't add points to a plot: Error: A continuous variable can not be mapped to shape -
i'm trying add points generated plot
dataframe used in original plot looks this:
> head(df) fa va ca rs ch fsd tsd d p s cluster q 1 7.4 0.29 0.50 1.8 0.042 35 127 0.99370 3.45 0.50 10.2 1 7 2 10.0 0.41 0.45 6.2 0.071 6 14 0.99702 3.21 0.49 11.8 2 7 3 7.8 0.26 0.27 1.9 0.051 52 195 0.99280 3.23 0.50 10.9 3 6 4 6.9 0.32 0.30 1.8 0.036 28 117 0.99269 3.24 0.48 11.0 1 6 5 6.8 0.37 0.28 1.9 0.024 64 106 0.98993 3.45 0.60 12.6 1 8 6 6.2 0.25 0.44 15.8 0.057 39 167 0.99804 3.14 0.51 9.2 3 5
i generate plot this:
> ggplot(data=df, aes(x=p, y=tsd, color=cluster )) + + geom_point() + + geom_point(data=centers, aes(x=p,y=tsd, color='center')) + + geom_point(data=centers, aes(x=p,y=tsd, color='center'), size=52, alpha=.3, show_guide=false)
now need add more points plot. dataframe want add looks this:
> head(df2) fa va ca rs ch fsd tsd d p s cluster q 1 6.2 0.23 0.35 0.7 0.051 24 111 0.99160 3.37 0.43 11.0 1 3 2 11.8 0.23 0.38 11.1 0.034 15 123 0.99970 2.93 0.55 9.7 1 3 3 6.6 0.36 0.29 1.6 0.021 24 85 0.98965 3.41 0.61 12.4 1 9 4 9.1 0.27 0.45 10.6 0.035 28 124 0.99700 3.20 0.46 10.4 1 9 5 8.3 0.33 0.42 1.2 0.033 18 96 0.99110 3.20 0.32 12.4 1 3 6 7.4 0.24 0.36 2.0 0.031 27 139 0.99055 3.28 0.48 12.5 1 9
this error
> last_plot() + geom_point(data=df2, aes(x=tsd, y=p, shape=5, alpha=.7, size=4.5) , show_guide=false) error: continuous variable can not mapped shape
Comments
Post a Comment