如何在R中绘制一般的sin曲线?根据这篇文章的答案,我试过:
x <- seq(0,pi,length.out=100)
y <- sin(x)
plot(x,y,type="l")
Run Code Online (Sandbox Code Playgroud)
实际上我真正想要的是这个图表,由gnuplot以下产生:
plot sin(x) linestyle 1
Run Code Online (Sandbox Code Playgroud)
此外,我想知道为什么gnuplot即使我没有为变量赋值也会产生图形x.它是否具有预先指定的值或其他内容?
pi只是正弦曲线的一半...添加更多,pi这样你就可以获得更多曲线......
x <- seq(0,8*pi,length.out=100)
y <- sin(x)
plot(x,y,type="l")
Run Code Online (Sandbox Code Playgroud)