[英]How to edit R plots generated by other function that uses plot to create it?
[英]How to create a function that plots radials in R?
我以前從未在 R 中繪制過徑向線,所以我不知道我在做什么。 我應該使用不同類型的繪圖嗎? 我還有一個 r 和 theta 的列表,但是我不確定如何創建一個循環以將它們全部轉換為笛卡爾坐標?
數據
"theta","r"
0,4
0.31,2.07
0.63,2.15
0.94,3.08
1.26,4.09
1.57,2.39
1.88,1.96
2.2,3.72
2.51,4.72
2.83,2.87
3.14,1.67
3.46,3.51
3.77,4.37
4.08,2.24
4.4,2.23
4.71,4.18
5.03,3.12
5.34,2.67
5.65,2.19
5.97,3.16
ggplot2
包允許非常方便地在極坐標中繪圖:
library(ggplot2)
ggplot(DF, aes(theta, r)) +
geom_line() +
coord_polar()
coord_polar()
完成所有轉換。
DF <- data.table::fread("theta,r
0,4
0.31,2.07
0.63,2.15
0.94,3.08
1.26,4.09
1.57,2.39
1.88,1.96
2.2,3.72
2.51,4.72
2.83,2.87
3.14,1.67
3.46,3.51
3.77,4.37
4.08,2.24
4.4,2.23
4.71,4.18
5.03,3.12
5.34,2.67
5.65,2.19
5.97,3.16")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.