I want to create discontinuous color bars in gnuplot

Asked 2 years ago, Updated 2 years ago, 116 views

I'd like to create a discontinuous color bar with gnuplot at the end of the page below, but I don't know how to do it, so please let me know.

Create Discontinuous Color Bar (Python)

I know how to create a color map and range the color bar memory, but I don't know how to create a discontinuous color bar.Thank you for your cooperation.

gnuplot version 5.4

gnuplot > set pm3d map
gnuplot > set cbrange [-2:2]
gnuplot>set cbtics (-2,-1.9, -1,1,2)# I want to make the intervals between -2,-1.9, -1,1,2 equal.
gnuplot>slot [-2:2] sin(x*y)

(Additional)
I'm sorry, but the way I asked the question was bad.
What I want to create is a color bar that is discontinuous as a value, but equal as an interval between axis display, as shown in the image below.I'd like to do something about the color bar display.
In the first example I showed you, there is -1.9 just above -2, and then -1 a little further away, but I want to keep the interval between these displays constant.

src=

gnuplot

2022-09-29 21:31

1 Answers

There are two ways to display the color hierarchy of a graph as discrete (?) instead of gradation.

set palette maxcolors8

Specify maxcolors as shown above and

set palette defined (-2 "black", \
                     -1 "black", \
                     -1 "red", \
                     0 "red", \
                     0 "orange", \
                     1 "orange", \
                     1 "yellow", \
                     2 "yellow")

As shown above, you can specify the same color for the starting point color and the ending point color.
(-1 and 0 have the same color "red" and the interval is drawn in a uniform color.)

sample code

$gnuplot
Version 5.4 patchlevel 2

set pm3d map
set cbrange [-2:2]
set cbtics (-2, -1.9, -1, 1, 2)
set palette maxcolors 8
split [-2:2] sin(x*y)# 1st time
set palette defined (-2 "black", \
                     -1 "black", \
                     -1 "red", \
                     0 "red", \
                     0 "orange", \
                     1 "orange", \
                     1 "yellow", \
                     2 "yellow")
split[-2:2]sin(x*y)#Second time

Run Results

1st

First Result

Second time

Second Result

References


2022-09-29 21:31

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.