r - 在 R 中绘制正弦曲线

标签 r plot gnuplot

如何在 R 中绘制通用正弦曲线?
基于 this post 的回答, 我试过:

x <- seq(0,pi,length.out=100)
y <- sin(x)
plot(x,y,type="l")

enter image description here

实际上我真正想要的是这张图,由 gnuplot 制作:
plot sin(x) linestyle 1

enter image description here

另外,我想知道为什么gnuplot即使我没有为变量 x 分配任何值也会产生一个图形.它是否有预先分配的值或其他什么?

最佳答案

pi只是正弦曲线的一半...添加更多 pi所以你会得到更多的曲线...

x <- seq(0,8*pi,length.out=100)
y <- sin(x)
plot(x,y,type="l")

关于r - 在 R 中绘制正弦曲线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40531262/

相关文章:

r - 创建 R 包 - 依赖项

regex - R 中的正向预测

r - 在 `r` 的 `caret` 包中训练测试拆分

r - R中绘图中的连接点

r - 如何绘制和保存 tableGrob 对象

geolocation - 使用 Matlab 在世界地图上绘制地理位置

alignment - gnuplot - 不同长度的水平键标题的对齐

r - 结合 texreg、knitr、booktabs 和 dcolumn

swift - 在 Swift 中调用 Gnuplot

gnuplot - 在gnuplot的条形图上添加误差线