Symlog equivalent?

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #11695
    daspecht
    Participant

      Hi!

      I was wondering if anyone might know – what is the best way to show a 0 on a log plot in DG? In matplotlib, you would do this with ‘symlog,’ which does a hybrid log plot with a linear region about 0 – what would be the best way to do this in DG?

      Thank you so much.

      #11696
      dgteam
      Moderator

        Hi! Here is what we suggest:

        1 – Transform your x values using the following expression:

        mapx = sgn(x)*if(abs(x)<cut, abs(x), cut + log10(abs(x)/cut))

        where cut is a variable that you can modify.

        2 – Plot your y values versus mapx

        3 – Label your x values using the same mapping in the Axis settings.

         

        This approach will maintain a linear region when -cut < x < cut.  Outside of that range, the plot will become logarithmic. To demonstrate, we put a new file in the On-line Examples.  The file is called SYMMETRIC LOG SCALE.

        Compare

        We’re not sure if this is the same implementation in matplotlib, but the results are similar.

        What do you think? Does this help?

         

        #11712
        daspecht
        Participant

          Ah, this is amazing! I should be able to make this work for my data.

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