gnuplot热图与SVG

发布于 2025-01-26 23:04:18 字数 783 浏览 1 评论 0原文

我正在尝试使用SVG端子使用GNUPLOT(5.2.8)绘制热图。 gnuplot插入了单元格的中心点之间的颜色。

当我使用PDF终端时,结果是预期的,细胞是清晰且均匀的面部。 如何关闭SVG终端的插值?

#set terminal svg size 600,600
set terminal pdf size 600,600
set style line 12 lc rgb '#ffffff' lt 1 lw 5
set border front 15 ls 12
set grid front ls 12

set datafile separator ','

percent_sample(sample) = sprintf("sample_%d/configuration.csv", sample)

set palette defined (0  '#c00000', 1 '#0000cc') model RGB
unset colorbox

#set cbrange[0:1]

set xrange [-0.5:9.5]
set yrange [-0.5:9.5]

unset key

set tics scale 0

unset xlabel
set xtics 0.5,1

unset ylabel
set ytics 0.5,1

set tmargin 0
set bmargin 0
set lmargin 0
set rmargin 0

#set view map


set output sprintf("sample_conf_%d.pdf", i)
plot percent_sample(i) matrix  with image

I am trying to plot a heatmap using gnuplot (5.2.8) with the SVG terminal.
Gnuplot interpolates the colors between the center points of the cells.

When I use the pdf terminal the result is as expected and the cells are clear and uniform faces.
How do I turn the interpolation for the SVG terminal off?

#set terminal svg size 600,600
set terminal pdf size 600,600
set style line 12 lc rgb '#ffffff' lt 1 lw 5
set border front 15 ls 12
set grid front ls 12

set datafile separator ','

percent_sample(sample) = sprintf("sample_%d/configuration.csv", sample)

set palette defined (0  '#c00000', 1 '#0000cc') model RGB
unset colorbox

#set cbrange[0:1]

set xrange [-0.5:9.5]
set yrange [-0.5:9.5]

unset key

set tics scale 0

unset xlabel
set xtics 0.5,1

unset ylabel
set ytics 0.5,1

set tmargin 0
set bmargin 0
set lmargin 0
set rmargin 0

#set view map


set output sprintf("sample_conf_%d.pdf", i)
plot percent_sample(i) matrix  with image

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我不是你的备胎 2025-02-02 23:04:18

进行插值不是GNUPLOT,而是SVG查看程序。撇开您如何说服观众不执行此操作的问题,您可以通过在gnuplot命令中使用关键字pixels来防止发生这种情况:

plot percent_sample(i) matrix with image pixels

这告诉程序在输出中描述每个像素图像作为单独的矩形而不是将它们合并到连续像素的流中。另请参阅:

heatmaps demo

It is not gnuplot that does the interpolation - it is the SVG viewing program. Leaving aside the question of how you might persuade the viewer not to do this, you can prevent it from happening by using the keyword pixels in the gnuplot command:

plot percent_sample(i) matrix with image pixels

This tells the program to describe each pixel in the output image as a separate rectangle rather than merging them into a stream of contiguous pixels. See also:

heatmaps demo

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文