[英]Plot sine curve in R
How can I plot a generic sin curve in R? 如何在R中绘制一般的sin曲线? Based on the answer of this post , I tried:
根据这篇文章的答案,我试过:
x <- seq(0,pi,length.out=100)
y <- sin(x)
plot(x,y,type="l")
Actually what I really would is this graph, produced by gnuplot
: 实际上我真正想要的是这个图,由
gnuplot
:
plot sin(x) linestyle 1
Furthermore, I would like to know why gnuplot
produces a graph even if I do not assign any value to the variable x
. 此外,我想知道为什么
gnuplot
产生图形,即使我没有为变量x
赋值。 Does it have a preassigned value or something else? 它是否具有预先指定的值或其他内容?
pi
is just one half of a sine curve... add more pi
so you will get more curves... pi
只是正弦曲线的一半...添加更多pi
以便您获得更多曲线......
x <- seq(0,8*pi,length.out=100)
y <- sin(x)
plot(x,y,type="l")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.