0

I'm trying to plot a 1D heatmap using two columns of data (x value and y value) in gnuplot. The linegraph plotted using my data is like this:

Linegraph: enter image description here

However after some trying I can only achieve this:

What I've got: enter image description here

And what I want to get is something like this. (Only example)

What I want:

enter image description here

The gnuplot script that I use is as follows:

set view map
set size ratio 0.2
unset ytics
unset key
splot 'test.dat' u 1:(1):2 palette

Could anyone help please?

2 Answers 2

1

So you want to use the y axis as a fake dimension in order to increase the width of your second line plot? Sure, this is e.g. possible with boxxyerror with explicit ymin and ymax errors that fill the yrange.

set xr [-10:10]
set yr [0:1]
xspacing = 0.1
plot '+' u 1:(0.5):($1-xspacing):($1+xspacing):(0):(1):(sin($1)) w boxxyerror lc palette

In your case replace the sin(x) with the respective column of your data. With the special file '+' the x-width has no effect, but in your case you might need to play around with a proper xspacing in order to avoid white gaps between the points.

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you very much, this method works well and I could adjust xspacing for a better look.
@ShanJ Glad to hear it was helpful! On SO, "thank you" is expressed as accepting the answer and/or upvoting.
Sorry for my late reply. I'm a beginner of stackoverflow and still don't have permission to vote. (I'll come back later to do this). And I found that the other answer fits better my need. (Sure your solution is very helpful)
0

I would do it like this:

unset key
set xrange noextend
set offset 0,0,graph .05,graph .05
set palette cubehelix negative

plot 'foo.dat' using 0:3 with lines lc "black", \
     'foo.dat' using 0:(70):3 with lines lc palette lw 10

enter image description here

3 Comments

Thank you very much! That is actually what I want.
I'm glad that solves your problem. Please mark the answer as "accepted" so that the next person with a similar issue can find it more easily.
Sorry I'm a beginner of stackoverflow and I accept your answer. However, I still don't have a permission to vote yet. Sorry for that...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.