zoukankan      html  css  js  c++  java
  • gnuplot配置HOME目录

    http://blog.csdn.net/jspenliany/article/details/39828261

      本人使用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文件。这个文件的默认内容如下:

    [plain] view plain copy
     
     在CODE上查看代码片派生到我的代码片
    1. ###  
    2. ### Gnuplot version 4.6 intialization file  
    3. ### This file is loaded by gnuplot at the start of each run.  
    4. ### It is provided as a template, with all commands commented out.  
    5. ### Uncomment and customize lines for local use.  
    6. ### Any commands placed here will affect all users.  
    7. ### To customize gnuplot's initial state for an individual user,  
    8. ### place commands in a private file ~/.gnuplot instead.  
    9.   
    10. ###  
    11. ### Language initialization  
    12. ###  
    13. # set locale  
    14. # set encoding locale  
    15.   
    16. ###  
    17. ### Default line colors and repeat cycle  
    18. ###  
    19. # set linetype 1 lc rgb "dark-violet" lw 1  
    20. # set linetype 2 lc rgb "#009e73" lw 1  
    21. # set linetype 3 lc rgb "#56b4e9" lw 1  
    22. # set linetype 4 lc rgb "#e69f00" lw 1  
    23. # set linetype 5 lc rgb "#f0e442" lw 1  
    24. # set linetype 6 lc rgb "#0072b2" lw 1  
    25. # set linetype 7 lc rgb "#e51e10" lw 1  
    26. # set linetype 8 lc rgb "black"   lw 1  
    27. # set linetype cycle 8  
    28.   
    29. ###  
    30. ### Initialize the default loadpath for shared gnuplot scripts and data.  
    31. ### Please confirm that this path is correct before uncommented the line below.  
    32. ###  
    33.   
    34. ###  
    35. ### Some commonly used functions that are not built in  
    36. ###  
    37. # sinc(x) = sin(x)/x  
    38.   
    39. ###  
    40. ### Other preferences  
    41. ###  
    42. # set clip two  

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

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

    [plain] view plain copy
     
     在CODE上查看代码片派生到我的代码片
    1. ###  
    2. ### Initialize the default loadpath for shared gnuplot scripts and data.  
    3. ### Please confirm that this path is correct before uncommented the line below.  
    4. ###  

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

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

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

  • 相关阅读:
    性能优化随笔
    Linux文件类型及如何查看,修改文件读写权限
    ngx_pagespeed
    用U盘安装Linux系统的简单方法
    Maven 3 入门 安装与配置
    CentOS 6.2 安装教程
    各种代码文件中的注释格式
    Linux下的WebLogic安装部署
    Win8常用快捷键
    Jenkins入门总结
  • 原文地址:https://www.cnblogs.com/zkwarrior/p/5818429.html
Copyright © 2011-2022 走看看