如何在R中的圆周围绘制点 [英] How to plot points around a circle in R

查看:175
本文介绍了如何在R中的圆周围绘制点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在0到360度之间变化的方向上绘制一些数据.最直观的方法是围绕一个圆圈绘制一个点(我只能绘制13个点).

I am trying to plot some data on directions which vary from 0 to360 deg. The most intuitive way of doing this is around a circle where I can plot each point (I only have 13 points to plot).

cont=c(319,124,182,137,55,302,221,25,8,36,132,179,152)

我的一个地块的数据

我尝试按照ggplot2指南进行操作,但尚未使其正常工作.我虽然不是很擅长ggplot ...

I tried following the ggplot2 guides and have not got it to work. I'm not very good at ggplot though...

(我的数据框称为数据")

(my dataframe is called "data")

ggplot(data, aes(x=1), ) + coord_polar(theta = "y") +geom_point(y=cont)

推荐答案

它可以将y添加到ggplot映射中

It works adding y to the ggplot mapping

data <- data.frame(cont = cont)
ggplot(data, aes(x=1, y = cont)) + coord_polar(theta = "y") + geom_point()

您可以添加其他ggplot参数以改善外观.

You can add other ggplot parameters to improve the appearence.

这篇关于如何在R中的圆周围绘制点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆