【问题标题】:Gnuplot default line color rgb valuesGnuplot 默认线条颜色 rgb 值
【发布时间】:2021-07-12 03:06:00
【问题描述】:

我正在使用 gnuplot 5.2,并希望获取与默认线条颜色相关的 rgb 值。使用命令test 我得到了可用选项和参数的一个很好的总结,但默认颜色只是由1, 2, 3, .... 标记并且rgb 值没有显示。命令show colors 也很有用,但它只显示颜色的名称和rgb 值,而不显示标签1, 2, 3, ... 所以我不知道哪个是哪个。

我的目标是使用默认的线条颜色和具有透明度的绘图线条。从这里的其他问题中,我了解到这在 5.2 版中是可能的,通过颜色指定 lc rgb #aarrggbb 但为此我需要知道 rgb 值。

而且似乎没有包含默认线条颜色的 gnuplot 的简单文本配置文件(我在 fedora 上),rpm -ql gnuplot 没有显示任何此类配置文件,所以我有点迷路了。

【问题讨论】:

    标签: gnuplot


    【解决方案1】:

    简单回答:

    gnuplot> show linetype
    
            linetype 1,  linecolor rgb "dark-violet"  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
    

    【讨论】:

      【解决方案2】:

      在 gnuplot 5.2 中,您可以通过 test palette 将当前调色板中的 rgb 颜色值放入数据块 $PALETTE。检查help palette

      如果你这样做:

      test palette
      print $PALETTE
      

      你会得到...

      0.0000 0.0000 0.0000 0.0000 0.0000 
      0.0039 0.0626 0.0000 0.0246 0.0215 
      0.0078 0.0886 0.0000 0.0493 0.0321 
      0.0118 0.1085 0.0000 0.0739 0.0409 
      0.0157 0.1252 0.0000 0.0984 0.0487 
      0.0196 0.1400 0.0000 0.1229 0.0559 
      ...
      0.4941 0.7029 0.1206 0.0370 0.2852 
      0.4980 0.7057 0.1235 0.0123 0.2849 
      0.5020 0.7085 0.1265 0.0000 0.2861 
      0.5059 0.7113 0.1295 0.0000 0.2887 
      0.5098 0.7140 0.1325 0.0000 0.2913 
      0.5137 0.7167 0.1356 0.0000 0.2939 
      0.5176 0.7195 0.1387 0.0000 0.2965 
      ...
      0.9725 0.9862 0.9199 0.0000 0.8348 
      0.9765 0.9882 0.9311 0.0000 0.8420 
      0.9804 0.9901 0.9423 0.0000 0.8492 
      0.9843 0.9921 0.9537 0.0000 0.8565 
      0.9882 0.9941 0.9651 0.0000 0.8638 
      0.9922 0.9961 0.9767 0.0000 0.8711 
      0.9961 0.9980 0.9883 0.0000 0.8785 
      1.0000 1.0000 1.0000 0.0000 0.8860 
      

      那么这取决于你到底想用它做什么。

      加法:

      好的,您说的是输入test 时出现的颜色,对吗? 这就是我使用 wxt 终端所得到的。

      在 gnuplot 子文件夹 share 中有一个名为 colors_default.gp 的文件。

      # Ethan A Merritt - my preference for gnuplot colors
      # 2 3 4 5 6 8 are borrowed from the colors_podo set
      #
      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  9 lc rgb "gray50"  lw 1
      set linetype cycle  9
      

      地点:

      dark-violet = #9400d3
      black       = #000000
      

      但是,显然,颜色(在测试屏幕中)以 8 次循环重复。

      【讨论】:

      • 我想我们在谈论两个不同的事情。有调色板和线条的默认颜色。你需要哪一个?我不确定从哪里获取默认线条颜色的 rgb 值,但是使用线条样式(和索引号),您可以定义任何您想要的颜色。检查help linestyle
      猜你喜欢
      • 2014-11-07
      • 2017-06-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多