为多个数据帧的图形制作手动键(ggplot2)

时间:2018-12-18 13:42:02

标签: r ggplot2

我有一个由多个数据框组成的图形,并且一直在尝试为其创建一个键,以便可以用指定的标签显示该点的形状和颜色。这是代码:

@GetMapping("/connect")
    public Task connect(@RequestParam("sessionId") String sessionId) throws InterruptedException {

        Session session = sessionService.findOne(sessionId);

        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        String currentPrincipalName = authentication.getName();
        User playerSecond = userService.findOne(currentPrincipalName);
        session.setPlayerSecond(playerSecond);
        sessionService.save(session);
        return session.getTask();
    }

我的目标是显示[(name:ow,color:red,shape:1),(name:(COR)ow,color:pink,shape:1),(name:(COR)uw,color :黄色,形状:5),(名称:uw,颜色:橙色,形状:5),(名称:ay,颜色:绿色,形状:2),(名称:ay(-voice),颜色:蓝色:形状:2)]。我尝试使用ggplot() + geom_segment(df_pow, mapping=aes(x=x, y=y, xend=xv, yend=yv), arrow=arrow(angle=5), size=.25, color="red") + geom_point(data=df_pow, mapping=aes(x=x, y=y), size=2, shape=1, color="red") + geom_segment(df_pCOR_ow, mapping=aes(x=x, y=y, xend=xv, yend=yv), arrow=arrow(angle=5), size=.25, color="pink") + geom_point(data=df_pCOR_ow, mapping=aes(x=x, y=y), size=2, shape=1, color="pink") + geom_segment(df_pCOR_uw, mapping=aes(x=x, y=y, xend=xv, yend=yv), arrow=arrow(angle=5), size=.25, color="yellow") + geom_point(data=df_pCOR_uw, mapping=aes(x=x, y=y), size=2, shape=5, color="yellow") + geom_segment(df_puw, mapping=aes(x=x, y=y, xend=xv, yend=yv), arrow=arrow(angle=5), size=.25, color="orange") + geom_point(data=df_puw, mapping=aes(x=x, y=y), size=2, shape=5, color="orange") + geom_segment(df_pay, mapping=aes(x=x, y=y, xend=xv, yend=yv), arrow=arrow(angle=5), size=.25, color="green") + geom_point(data=df_pay, mapping=aes(x=x, y=y), size=2, shape=2, color="green") + geom_segment(df_pay_, mapping=aes(x=x, y=y, xend=xv, yend=yv), arrow=arrow(angle=5), size=.25, color="blue") + geom_point(data=df_pay_, mapping=aes(x=x, y=y), size=2, shape=2, color="blue") + scale_x_reverse() + scale_y_reverse() + ggtitle("AMO2 Personal Story") + xlab("F2(HZ)") + ylab('F1(Hz)') + xlim(2500, 500) + ylim(800, 200) ,但是我认为我做的不正确。任何帮助将不胜感激。

0 个答案:

没有答案