对于gnuplot
我有一个小问题,我需要加入for循环,以迅速绘制不同的函数,在这里我留下原型代码
reset
set terminal png
plot for [i=1:2]\
set output "Graph".i.".png"\
if (i==1)\
x title 'Graph'.i;\
if (i==2)\
2x+3x**2 title 'Graph'.i;\
if (i==3)\
3x+8+4x**2-15x**3 title 'Graph'.i
unset output
I have a little problem, I need to join the for loop with the if condition to graph different functions quickly, here I leave the prototype code
reset
set terminal png
plot for [i=1:2]\
set output "Graph".i.".png"\
if (i==1)\
x title 'Graph'.i;\
if (i==2)\
2x+3x**2 title 'Graph'.i;\
if (i==3)\
3x+8+4x**2-15x**3 title 'Graph'.i
unset output
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定您是否正在寻找以下示例。如果没有,请重新提出您的问题。
例如,您可以定义几个功能,然后由三元运营商选择它们(检查
help ternary
)。在for循环中,您还可以将项目定义为字符串。这使您可以随意更改数值顺序。脚本:
结果:
I am not sure if you are looking for something like the following example. If not, please rephrase your question.
You could for example define several functions and select them by the ternary operator (check
help ternary
). In a for loop you can also define items as strings. This allows you to change the numerical order as you like.Script:
Result: