gnuplot:在 GIF 终端中带有 3D 圆圈的视角相关颜色 [英] gnuplot: viewing angle dependent colors with 3D circles in GIF terminal

查看:31
本文介绍了gnuplot:在 GIF 终端中带有 3D 圆圈的视角相关颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 gnuplot 5.4 (Win7),我尝试在 3D 中制作圆圈动画,基本上是

结果 2:(使用 term pngcairo 导出单个 PNG 帧时的随机设置不同,并使用其他软件将它们组合为动画 GIF.)

解决方案

我认为解决方法是不使用优化"选项.它依赖于上游支持(在 libgd 中),如果多年来没有彻底破坏,这种支持一直不可靠.也许我们应该弃用 gnuplot 选项或将其完全删除.

如果您删除该关键字,您展示的示例可以正常工作,对吗?

With gnuplot 5.4 (Win7), I tried to animate circles in 3D, basically the animated version of this.

The test data $Data contains random x,y,z coordinates, random sizes and random colors from 0x0000000 to 0xffffff. When the animated GIF is created, the circles are changing the color depending on the viewing angle.

As far as I know, GIF is limited to 256 colors, so it is clear that not all colors from 0x0000000 to 0xffffff can be displayed. I expected gnuplot to take somehow the nearest color and stick with it. However, I didn't expect at all that the color of the circles would change depending on the angle.

Why is this? How to work around this?

Code:

### animated plot with circles in 3D (only for gnuplot >=5.4)
reset session

set term gif size 400,400 animate delay 30 optimize
set output "WithCircles3D.gif"

# create some test data
set print $Data
    do for [i=1:100] {
        print sprintf("%g %g %g %g %g", rand(0), rand(0), rand(0), rand(0)*0.02+0.02, int(rand(0)*0xffffff))
    }
set print

set view equal xyz
set xyplane at 0
set border 4095
set xtics 0.2
set ytics 0.2
set ztics 0.2
set style fill solid 1.0

do for [a=5:360:10] {
    set view 60,a,1.25
    splot $Data u 1:2:3:4:5 w circles lc rgb var notitle
}
set output
### end of code

Result:

Result 2: (different random set when exporting single PNG frames with term pngcairo and put them together as animated GIF with some other software.)

解决方案

I think the work-around is to not use the "optimize" option. It relies on upstream support (in libgd) that has been unreliable if not outright broken for years now. Probably we should deprecate the gnuplot option or remove it altogether.

The example you show works correctly if you remove that keyword, right?

这篇关于gnuplot:在 GIF 终端中带有 3D 圆圈的视角相关颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆