gnuplot配置HOME目录

来源:互联网 发布:rup软件过程模型 编辑:程序博客网 时间:2024/06/05 18:09

       本人使用gnuplot绘图,使用console version的来进行处理的时候,经常需要切换目录,非常麻烦。希望有个办法让gnuplot在启动的时候,进入我的gnuplot工作目录。(至于gnuplot的默认work directory可以参考 help startup)      

         HOME目录有那么重要么?

         答案是肯定的,因为gnuplot的所有命令都仅在当前工作目录(指令pwd输出的就是当前工作目录)下起作用,即在所有的绘图指令中,涉及到数据读取,gnuplot都会在当前工作目录下寻找,如果数据文件不在这。gnuplot就报数据异常!!

         怎么办呢?  去百度搜索,结果。。。。。。(难道我的搜索不对,你懂得。。。。。。)

        在console version中,输入命令:pwd(Print Work Directory) 输出的是  当前的工作区。也就是说:gnuplot的命令涉及到的文件,在默认情况下都是在这个目录下的。(根据在console中输入:help startup。获知,gnuplot在install的过程中,会有个配置文件生成;gnuplot每次启动都会读取配置信息,因而理论上, 所有在console中输入的命令在 配置文件中均可以使用。但一般不推荐这么做。)

        我的系统是WIN7 64bit,gnuplot4.6

        怎么说呢,gnuplot的工作目录在安装过程中是存在默认值的,如何修改呢? 一种方法就是  cd命令(change directory)。另外就是在gnuplot加载过程中,修改工作目录。


         一般情况下(针对WIN7平台),在gnuplot的安装目录中 gnuplot/share/下有个gnuplotrc文件。这个文件的默认内容如下:

###### Gnuplot version 4.6 intialization file### This file is loaded by gnuplot at the start of each run.### It is provided as a template, with all commands commented out.### Uncomment and customize lines for local use.### Any commands placed here will affect all users.### To customize gnuplot's initial state for an individual user,### place commands in a private file ~/.gnuplot instead.###### Language initialization#### set locale# set encoding locale###### Default line colors and repeat cycle#### set linetype 1 lc rgb "dark-violet" lw 1# set linetype 2 lc rgb "#009e73" lw 1# set linetype 3 lc rgb "#56b4e9" lw 1# set linetype 4 lc rgb "#e69f00" lw 1# set linetype 5 lc rgb "#f0e442" lw 1# set linetype 6 lc rgb "#0072b2" lw 1# set linetype 7 lc rgb "#e51e10" lw 1# set linetype 8 lc rgb "black"   lw 1# set linetype cycle 8###### Initialize the default loadpath for shared gnuplot scripts and data.### Please confirm that this path is correct before uncommented the line below.######### Some commonly used functions that are not built in#### sinc(x) = sin(x)/x###### Other preferences#### set clip two

这个文件就是 gnuplot加载过程中,读取的配置文件。

在这个文件中,有这样两行:

###### Initialize the default loadpath for shared gnuplot scripts and data.### Please confirm that this path is correct before uncommented the line below.###

这句话是说,通过配置默认loadpath,添加gnuplot 脚本和数据文件的存放目录。通俗的讲,配置了这个loadpath之后,loadpath所指向的文件夹将能够被gnuplot作为工作目录。


cd  "D:\\XXX\\XXX\\XXX"  注意了:目录划分符号为'\\' 。这一行命令能够实现gnuplot的工作目录。



PS :在寻找解决方法的过程中 ,参照了 google的检索结果。  也许你的系统版本,gnuplot版本和我不同,对应的初始化文件名可能不同。



0 0
原创粉丝点击