admin管理员组文章数量:1026181
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 |1 Answer
Reset to default 1You 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
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
1 Answer
Reset to default 1You 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
本文标签: Rainbow line in gnuplot ()Stack Overflow
版权声明:本文标题:Rainbow line in gnuplot (?) - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745624600a2159785.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
set cbrange [*:*]
? – Ethan Commented Nov 18, 2024 at 17:17