Rainbow line in gnuplot (?) - Stack Overflow

I want to have a single line on the plot, that changes colors in given range.I tried something like th

I want to have a single line on the plot, that changes colors in given range. I tried something like this:

set palette defined (0.0 '#01748D', 0.1 '#22D6CC', 0.2 '#68DEFF', 0.3 '#2E5DD1', \
                     0.4 '#2E5DD1', 0.5 '#611EBA', 0.6 '#9349DF', 0.7 '#611EBA', \
                     0.8 '#BF1E90', 0.9 '#FA6FD3')
set cbrange [100:350]
set colorbox horiz user origin 0.22,0.65 size 0.335,0.04
set cbtics 100 offset 0,2.3
set format cb '\scriptsize{$%1.0f$}'
set palette maxcolor 40

set style data lines
plot 'dane.dat' using 1:2:(($1-100)/(350-100)) with lines lc palette lw 3 notitle

but it didn't work. I tried ChatGPT tricks, but nothing worked, so at this point I think it's impossible. But some of you are smarter, so please, let me know!

I want to have a single line on the plot, that changes colors in given range. I tried something like this:

set palette defined (0.0 '#01748D', 0.1 '#22D6CC', 0.2 '#68DEFF', 0.3 '#2E5DD1', \
                     0.4 '#2E5DD1', 0.5 '#611EBA', 0.6 '#9349DF', 0.7 '#611EBA', \
                     0.8 '#BF1E90', 0.9 '#FA6FD3')
set cbrange [100:350]
set colorbox horiz user origin 0.22,0.65 size 0.335,0.04
set cbtics 100 offset 0,2.3
set format cb '\scriptsize{$%1.0f$}'
set palette maxcolor 40

set style data lines
plot 'dane.dat' using 1:2:(($1-100)/(350-100)) with lines lc palette lw 3 notitle

but it didn't work. I tried ChatGPT tricks, but nothing worked, so at this point I think it's impossible. But some of you are smarter, so please, let me know!

Share Improve this question asked Nov 18, 2024 at 10:51 Lilla_muLilla_mu 114 bronze badges 2
  • What does "didn't work" mean? How does your data look like? What is the x-range of your data? How does your output graph look like and how should it look like? Check this: minimal repdroducible example – theozh Commented Nov 18, 2024 at 11:13
  • Are you sure you have that color range correctly set? What if you try set cbrange [*:*]? – Ethan Commented Nov 18, 2024 at 17:17
Add a comment  | 

1 Answer 1

Reset to default 1

You are on the right track. I am guessing that you are not setting the cbrange correctly to match the actual 3rd column values. Here is a simple example the uses plot '+' to dummy up a data file consisting of 100 evenly space data points between 1 and 10.

set palette rgbformulae 33,13,10
set sample 100
set xrange [0:10]
plot '+' using ($1) : (sin($1)/$1) : ($1) with lines lw 3 lc palette notitle

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745624602a4636730.html

相关推荐

  • Rainbow line in gnuplot (?) - Stack Overflow

    I want to have a single line on the plot, that changes colors in given range.I tried something like th

    6小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信