Log color ramp is off in plot

DataGraph Forums Technical Support Support Desk Log color ramp is off in plot

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9945
    mark engle
    Participant

      There may be a problem in which logarithmic color ramps are being applied.  Here I am plotting some synthetic data for days versus temperature.  Day spans the range of 1 to 1000.  I created a color ramp on a log basis which goes from 1 to1000 (lower left) and am coloring the points using that ramp using the Day variable as the fill.  I also added a color ramp legend using the same color ramp.  What you can see is that the dots in the plot are shown as red by day 10 but in the color ramp legend they should not be red until after several hundred days.  Thus, the fill colors are somehow off or shifted from what they should be.  This apparent error does not appear when using a linear color ramp – only logarithmic.

      Screen Shot 2022-12-09 at 3.18.40 PM

      #9974
      mark engle
      Participant

        In case anyone ever finds this, there definitely appears to be a bug when using logarithmic scales in color ramps but I found a workaround.  Here are the steps:

        1) Using the range of the variable of interest (say, it’s 1 to 1000) create a color ramp going from 1 to 1000 and set the “Transition” to logarithmic.  This first color ramp will only be used for creating the color ramp legend.

        2) In your data, create a function that is the log10 of the variable of interest. In our example of a variable ranging from 1 to 1000, it will be logarithmically re-scaled to a new range of 0 to 3.

        3) Create another color scale which has the same colors as the scale in step but, make it linear and have the range span than of the log10 variable created in step to (in this case, 0 to 3).

        4) In your plot, set the symbol fill to the log10 version of your variable, created in step 2. Select the “scheme” you created in step 3 (the linear scheme).

        5) Add your color ramp legend using the original color ramp (step 1) as the “source”.

        Fixed figure (compare with image above):

        Screen Shot 2023-01-08 at 3.13.39 PM

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.

      DataGraph Forums Technical Support Support Desk Log color ramp is off in plot