gnuplot会话的总重置
我想要一种从gnuplot会话的总重置,gnuplot,Gnuplot,我想要一种从gnuplot中完全重置gnuplot会话的方法;完全等同于退出和重新启动 命令reset或reset session()是不够的,因为之前设置的某些选项会在任一命令后保留(例如,设置术语,设置输出,…) 请注意,对于我的目的,解决方案是不够的 对于上下文,我遇到的问题是,我经常使用同一个终端会话来执行许多不同的gnuplot脚本来绘制许多不同的绘图。对于其中一些绘图,我只想使用默认选项,而对于其他绘图,我更希望更具体。如果在运行一个“默认”脚本之前运行一个更“特定”的脚本,许多“特
gnuplot
中完全重置gnuplot
会话的方法;完全等同于退出和重新启动
命令reset
或reset session
()是不够的,因为之前设置的某些选项会在任一命令后保留(例如,设置术语
,设置输出
,…)
请注意,对于我的目的,解决方案是不够的
对于上下文,我遇到的问题是,我经常使用同一个终端会话来执行许多不同的gnuplot
脚本来绘制许多不同的绘图。对于其中一些绘图,我只想使用默认选项,而对于其他绘图,我更希望更具体。如果在运行一个“默认”脚本之前运行一个更“特定”的脚本,许多“特定”设置将应用于“默认”绘图,即使每个脚本都以reset session
命令开始。我目前的解决方案是手动重新启动gnuplot,这有点烦人
以下最小脚本说明了问题的一个示例:在运行reset
和reset session
命令后,终端不会重置为默认值。这里的“默认值”是指在启动时加载的任何终端,在我的例子中是qt
。请注意,终端类型只是reset
命令后会出现的许多问题的一个示例。我想要某种方法将gnuplot
还原到它开始时的状态
show terminal
set terminal pdfcairo
show terminal
reset
reset session
show terminal
我认为您提到的硬重置不是由gnuplot提供的。 如您的示例所示,似乎很难使用
重置会话
执行精确的重置
作为一种解决方法,您可以使用初始化脚本尝试以下方法。
帮助重置
说
以下内容不受重置的影响:
设置术语
设置输出
设置加载路径
设置线型
设置配合
设置编码
设置小数
设置区域设置
设置psdir
set overflow
set multiplot
而且,help reset session
也这样提到
重置会话
删除任何用户定义的变量和函数,恢复
默认设置,然后重新执行系统范围的gnuplotrc初始化
文件和任何私有$HOME/.gnuplot或$XDG_CONFIG_HOME/gnuplot/gnuplotrc
首选项文件。请参见初始化
根据此行为,我建议您在初始化文件“$HOME/.gnuplot”中写入所需的默认设置,在执行重置会话时将调用该文件
以下是执行此操作的步骤:
(1) 使用-d
选项调用gnuplot
(2) 运行命令save“settings.plt”
将当前设置保存到“settings.plt”
(3) 从“settings.plt”的内容中提取必要的设置
在我的环境中就是这样(在你的环境中可能会有所不同)
save
命令不会写出线型的配置,需要单独检查
(4) 运行命令show linetype
,查找线型的默认设置
linetype 1, linecolor rgb "red" linewidth 1.000 dashtype solid pointtype 1 pointsize default
linetype 2, linecolor rgb "#009e73" linewidth 1.000 dashtype solid pointtype 2 pointsize default
linetype 3, linecolor rgb "#56b4e9" linewidth 1.000 dashtype solid pointtype 3 pointsize default
linetype 4, linecolor rgb "#e69f00" linewidth 1.000 dashtype solid pointtype 4 pointsize default
linetype 5, linecolor rgb "#f0e442" linewidth 1.000 dashtype solid pointtype 5 pointsize default
linetype 6, linecolor rgb "#0072b2" linewidth 1.000 dashtype solid pointtype 6 pointsize default
linetype 7, linecolor rgb "#e51e10" linewidth 1.000 dashtype solid pointtype 7 pointsize default
linetype 8, linecolor rgb "black" linewidth 1.000 dashtype solid pointtype 8 pointsize default
Linetypes repeat every 8 unless explicitly defined
有关如何编写线型的详细信息,请参见帮助线型
(5) 把它们写在“$HOME/.gnuplot”中。你能给我们展示一个复制这种情况的最小代码作为例子吗?@binzo在没有正式解决方案的情况下,我添加了一些代码,我认为这是你能做的最好的了。实际上,我将settings.plt
的内容写入了一个脚本,然后可以在我喜欢的时候运行,但效果是一样的。
linetype 1, linecolor rgb "red" linewidth 1.000 dashtype solid pointtype 1 pointsize default
linetype 2, linecolor rgb "#009e73" linewidth 1.000 dashtype solid pointtype 2 pointsize default
linetype 3, linecolor rgb "#56b4e9" linewidth 1.000 dashtype solid pointtype 3 pointsize default
linetype 4, linecolor rgb "#e69f00" linewidth 1.000 dashtype solid pointtype 4 pointsize default
linetype 5, linecolor rgb "#f0e442" linewidth 1.000 dashtype solid pointtype 5 pointsize default
linetype 6, linecolor rgb "#0072b2" linewidth 1.000 dashtype solid pointtype 6 pointsize default
linetype 7, linecolor rgb "#e51e10" linewidth 1.000 dashtype solid pointtype 7 pointsize default
linetype 8, linecolor rgb "black" linewidth 1.000 dashtype solid pointtype 8 pointsize default
Linetypes repeat every 8 unless explicitly defined