graph - Gnuplot:使用矩阵格式的 4d 颜色图

标签 graph charts gnuplot

我知道对于 4d 颜色图(3d 表面,颜色由第 4 个字段给出),我可以使用格式的数据文件

# X Y Z C
  1 1 0 4
  1 2 1 3

  2 1 4 2
  2 2 4 5
  ...

然后使用
set pm3d
splot "datafile.dat" u 1:2:3:4 with pm3d

另一方面,我知道如何制作一个简单的曲面图,其中 X 和 Y 值是隐式的,而 Z 值是矩阵格式:
#Z DATA ONLY
0 1
4 4

splot "datafile.dat" matrix 

有没有办法使用这种矩阵格式制作 4d 彩色图?例如,从一个文件中获取 Z 数据并从另一个文件中获取相应的颜色数据,或者将 Z 值和颜色以矩阵格式合并到一个文件中?

最佳答案

如果我正确理解了这个问题,这似乎是可能的。请参阅下面的示例。

  • http://www.gnuplotting.org/tag/matrix/

    All we need to create such a plot is the image plot style, and of course the data have to be in a proper format. Suppose the following matrix which represents z-values of a measurement.

    0 1 2 3 4 3 2 1 0
    0 1 2 3 4 3 2 1 0
    0 1 2 3 4 3 2 1 0
    0 1 2 3 4 3 2 1 0
    0 1 2 3 4 3 2 1 0
    0 1 2 3 4 3 2 1 0
    0 1 2 3 4 3 2 1 0
    0 1 2 3 4 3 2 1 0
    0 1 2 3 4 3 2 1 0
    

    In order to plot these values in different gray color tones, we specify the corresponding palette. In addition we apply the above mentioned image plot style and the matrix format option. The result is shown in Fig. 2.

    set palette grey
    plot 'color_map.dat' matrix with image
    

    z values with color

  • http://gnuplot.sourceforge.net/demo/heatmaps.html

    #
    # Two ways of generating a 2D heat map from ascii data
    #
    
    set title "Heat Map generated from a file containing Z values only"
    unset key
    set tic scale 0
    
    # Color runs from white to green
    set palette rgbformula -7,2,-7
    set cbrange [0:5]
    set cblabel "Score"
    unset cbtics
    
    set xrange [-0.5:4.5]
    set yrange [-0.5:4.5]
    
    set view map
    splot '-' matrix with image
    5 4 3 1 0
    2 2 0 0 1
    0 0 0 1 0
    0 0 0 2 3
    0 1 2 4 3
    e
    e
    

    Heat map generated from a file only containing z values

  • 关于graph - Gnuplot:使用矩阵格式的 4d 颜色图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6524206/

    相关文章:

    tree - 这种有向无环图的名称是什么?

    charts - JFree 图表中的注释/注释

    python - 在 Python 中绘制具有比例 X 轴的图表

    plot - 用连接线绘制数据点,但留有空隙

    c++ - 将基于递归 DFS 的拓扑排序转化为非递归算法(不丢失循环检测)

    algorithm - 图中最长的圆

    javascript - chart.js 线图 : Fill area above line as opposed to below and to the right

    gnuplot 多图布局不会被设置原点覆盖,定位子图的方法

    plot - 在 gnuplot smooth 中包含数据点

    python - 将 Cassandra 数据加载到 Titan/Neo4J 中