DataPlotly icon indicating copy to clipboard operation
DataPlotly copied to clipboard

Can't reverse colour schema

Open iboates opened this issue 5 years ago • 1 comments

Not sure if I am just not doing this right, but using array_reverse() in the marker colour definition doesn't seem to work. I want to reverse the direction of the colour gradient.

Example:

array_foreach(
        generate_series(0, 24445),
        ramp_color( 'RdYlGn', @element/50)
)

produces:

image

But this:

array_reverse(array_foreach(
        generate_series(0, 24445),
        ramp_color( 'RdYlGn', @element/50)
))

produces:

image

Is there another way to flip the colour ramp?

If it helps, the reason I am trying to do this is actually to force the midpoint of the colour ramp to be at a specific value, by merging two colour ramps together like so:

string_to_array(

concat(

array_to_string(
array_reverse(
    array_foreach(
        generate_series(0, 12223 ),
        ramp_color( 'YlGn', @element/25)
    )
),
	delimiter:=';'
)
,
';'
,
array_to_string(
    array_foreach(
        generate_series(12223 , 24445),
        ramp_color( 'YlOrRd', @element/25)
    ),
	delimiter:=';'
)

),
delimiter:=';'

)

But this doesn't work at all and just produces a fully green graph. Can you advise on how to do this? I want to make it so the medium of the data will have to switch from the red->yellow to the yellow->green colour ramp.

iboates avatar Nov 18 '20 17:11 iboates

is this issue still valid?

ghtmtt avatar Apr 13 '22 08:04 ghtmtt