gnuplot - Gnuplot,具有不同调色板的多个splots
问题描述
我有两个 3d 表面。是否可以为每个带有 splot 的表面使用不同的调色板?我使用的脚本和生成的图表如下:
set title "Thermal efficiency versus turbine inlet temperature and degree of superheating diagram"
set termopt enhanced
set grid
set key top left
set xlabel "ΔT_{super} [^{o}C]"
set ylabel "T_{3} [^{o}C]"
set zlabel "n_{th} [-]"
#set datafile missing '0.000000000000000000e+00'
#set datafile missing '0.000000'
set hidden3d
set pm3d
set view 60,60
set palette rgb 7,5,15 #black-blue-red-yellow
splot "para_sub_dtsuper_iso_dtppreg_1.txt" using ($1):($2-273.15):($5) title "Conventional ORC" with lines lt 1 lw 1.5,\
"para_sub_dtsuper_iso_dtppreg_1.txt" using ($1):($2-273.15):($6) title "Regenerative ORC" with lines lt 1 lw 1.5,\
另一方面,我想知道是否可以产生如下图所示的网格颜色渐变表面:
先感谢您。
解决方案
这是theozh链接到的情节的修订版。它在同一个图中显示了两个表面,一个通过内置调色板机制使用颜色映射,另一个有效地显式地执行相同类型的颜色映射。gnuplot 的开发版本已自动执行此操作,因此您可以通过为每个调色板分配一个名称来构建和使用多个调色板。
#
# Demonstrate construction and use of a separate palette
#
# This method works in 5.2 but requires "lc rgb variable"
# rather than the more natural "fillcolor rgb variable".
# "set pm3d interpolate" breaks the color mapping of this method
#
# This creates a palette equivalent to
# set palette defined (0 "dark-blue", 1 "white")
#
array blues[256]
do for [i=1:256] {
blues[i] = int( (0x7f + (i-1)/(255.) * 0xffff80) );
}
#
# This is the equivalent of
# set cbrange [0:5]
blues_min = 0
blues_max = 5
#
# This function maps z onto a palette color
#
blues(z) = (z <= blues_min) ? blues[1] \
: (z >= blues_max) ? blues[256] \
: blues[ floor(255. * (z-blues_min)/(blues_max-blues_min)) + 1]
F1(x,y) = sqrt(x*y)
F2(x,y) = (x*y)**(1./3)
set samples 41; set isosamples 41
set cbrange [0:5]; set xrange [0:5]; set yrange [0:5]
set palette cubehelix negative
unset colorbox
# Needed for proper occlusion of hidden surface
set pm3d depthorder
# Place a thin border around each facet of the surfaces
set pm3d border lc "black" lw 0.5
set title "Top surface uses hand-constructed 'blues' palette via rgb variable\n".\
"Bottom surface uses 'set palette cubehelix negative'"
set title offset 0,1
splot '++' using 1:2:(F1($1,$2)):(blues(F1($1,$2))) with pm3d lc rgb variable \
title "F1(x,y) using 1:2:3:4 with pm3d lc rgb variable", \
'++' using 1:2:(F2($1,$2)) with pm3d \
title "F2(x,y) using 1:2:3 with pm3d"
推荐阅读
- sql - 尝试将 SQL getdate 转换为没有中间字符的 varchar
- python - 在迭代多个文件时创建与正则表达式模式匹配的字符串列表
- python - 使 isort 将来自 Django 应用程序的导入识别为第一方导入
- plsql - PLSQL-如何在分层记录流中获取单独流的值
- r - 如何将 data.frame 转换为 SpatialPolygonsDataFrame
- swift - Vapor 4 不区分大小写的查询
- c++ - 特征稀疏求解器错误结果
- ipmi - 如何使用一个命令更改 ipmi 用户
- shell - 从 jenkins 运行 .sh 文件 - 不允许操作
- r - plm 函数和异方差稳健的标准误