How can I make a NumberLineLogPlot'?












4












$begingroup$


I have a piecewise function that is defined in logarithmic intervals, i.e., the different pieces are defined on



{{1. <= x <= 10}, {10 <= x <= 100}, {100 <= x <= 1000}}


I'd like to visualize the different domains on a number line.
NumberLinePlot, of course, works, but it looks clumsy as the plot is fully dominated by the last domain an the first one is barely visible:



NumberLinePlot[{{1. <= x <= 10}, {10 <= x <= 100}, {100 <= x <= 1000}}, {x, 1, 1000}]


enter image description here



So I can use something along the lines of



NumberLinePlot[
{{Log[10, 1] <= x <= Log[10, 10]},
{Log[10, 10] <= x <= Log[10, 100]},
{Log[10, 100] <= x <= Log[10, 1000]}},
{x, Log[10, 1], Log[10, 1000]}]


which results in a much more pleasantly balanced plot:



enter image description here



However, now the number line ticks show the exponents — so in essence I'd like something like NumberLineLogPlot, but that doesn't exist.



I tried to recreate something like that by abusing LogLogPlot



Show[
MapThread[
LogLogPlot[#1, #2, PlotStyle -> #3] &,
{{1, 2, 4}, {x, #[[1, 1]], #[[1, 3]]} & /@ dx , {Red, Green, Blue}}],
PlotRange -> Automatic, Frame -> {{False, False}, {True, False}}]


Which leads to something like



enter image description here



which is better in terms of the logarithmic x-axis but is quite clumsy in other ways.



Any ideas how to implement a NumberLineLogPlot nicely?










share|improve this question











$endgroup$

















    4












    $begingroup$


    I have a piecewise function that is defined in logarithmic intervals, i.e., the different pieces are defined on



    {{1. <= x <= 10}, {10 <= x <= 100}, {100 <= x <= 1000}}


    I'd like to visualize the different domains on a number line.
    NumberLinePlot, of course, works, but it looks clumsy as the plot is fully dominated by the last domain an the first one is barely visible:



    NumberLinePlot[{{1. <= x <= 10}, {10 <= x <= 100}, {100 <= x <= 1000}}, {x, 1, 1000}]


    enter image description here



    So I can use something along the lines of



    NumberLinePlot[
    {{Log[10, 1] <= x <= Log[10, 10]},
    {Log[10, 10] <= x <= Log[10, 100]},
    {Log[10, 100] <= x <= Log[10, 1000]}},
    {x, Log[10, 1], Log[10, 1000]}]


    which results in a much more pleasantly balanced plot:



    enter image description here



    However, now the number line ticks show the exponents — so in essence I'd like something like NumberLineLogPlot, but that doesn't exist.



    I tried to recreate something like that by abusing LogLogPlot



    Show[
    MapThread[
    LogLogPlot[#1, #2, PlotStyle -> #3] &,
    {{1, 2, 4}, {x, #[[1, 1]], #[[1, 3]]} & /@ dx , {Red, Green, Blue}}],
    PlotRange -> Automatic, Frame -> {{False, False}, {True, False}}]


    Which leads to something like



    enter image description here



    which is better in terms of the logarithmic x-axis but is quite clumsy in other ways.



    Any ideas how to implement a NumberLineLogPlot nicely?










    share|improve this question











    $endgroup$















      4












      4








      4





      $begingroup$


      I have a piecewise function that is defined in logarithmic intervals, i.e., the different pieces are defined on



      {{1. <= x <= 10}, {10 <= x <= 100}, {100 <= x <= 1000}}


      I'd like to visualize the different domains on a number line.
      NumberLinePlot, of course, works, but it looks clumsy as the plot is fully dominated by the last domain an the first one is barely visible:



      NumberLinePlot[{{1. <= x <= 10}, {10 <= x <= 100}, {100 <= x <= 1000}}, {x, 1, 1000}]


      enter image description here



      So I can use something along the lines of



      NumberLinePlot[
      {{Log[10, 1] <= x <= Log[10, 10]},
      {Log[10, 10] <= x <= Log[10, 100]},
      {Log[10, 100] <= x <= Log[10, 1000]}},
      {x, Log[10, 1], Log[10, 1000]}]


      which results in a much more pleasantly balanced plot:



      enter image description here



      However, now the number line ticks show the exponents — so in essence I'd like something like NumberLineLogPlot, but that doesn't exist.



      I tried to recreate something like that by abusing LogLogPlot



      Show[
      MapThread[
      LogLogPlot[#1, #2, PlotStyle -> #3] &,
      {{1, 2, 4}, {x, #[[1, 1]], #[[1, 3]]} & /@ dx , {Red, Green, Blue}}],
      PlotRange -> Automatic, Frame -> {{False, False}, {True, False}}]


      Which leads to something like



      enter image description here



      which is better in terms of the logarithmic x-axis but is quite clumsy in other ways.



      Any ideas how to implement a NumberLineLogPlot nicely?










      share|improve this question











      $endgroup$




      I have a piecewise function that is defined in logarithmic intervals, i.e., the different pieces are defined on



      {{1. <= x <= 10}, {10 <= x <= 100}, {100 <= x <= 1000}}


      I'd like to visualize the different domains on a number line.
      NumberLinePlot, of course, works, but it looks clumsy as the plot is fully dominated by the last domain an the first one is barely visible:



      NumberLinePlot[{{1. <= x <= 10}, {10 <= x <= 100}, {100 <= x <= 1000}}, {x, 1, 1000}]


      enter image description here



      So I can use something along the lines of



      NumberLinePlot[
      {{Log[10, 1] <= x <= Log[10, 10]},
      {Log[10, 10] <= x <= Log[10, 100]},
      {Log[10, 100] <= x <= Log[10, 1000]}},
      {x, Log[10, 1], Log[10, 1000]}]


      which results in a much more pleasantly balanced plot:



      enter image description here



      However, now the number line ticks show the exponents — so in essence I'd like something like NumberLineLogPlot, but that doesn't exist.



      I tried to recreate something like that by abusing LogLogPlot



      Show[
      MapThread[
      LogLogPlot[#1, #2, PlotStyle -> #3] &,
      {{1, 2, 4}, {x, #[[1, 1]], #[[1, 3]]} & /@ dx , {Red, Green, Blue}}],
      PlotRange -> Automatic, Frame -> {{False, False}, {True, False}}]


      Which leads to something like



      enter image description here



      which is better in terms of the logarithmic x-axis but is quite clumsy in other ways.



      Any ideas how to implement a NumberLineLogPlot nicely?







      piecewise ticks numberlineplot loglogplot






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 3 at 15:13









      m_goldberg

      87.7k872198




      87.7k872198










      asked Feb 3 at 13:00









      Oliver JennrichOliver Jennrich

      887411




      887411






















          2 Answers
          2






          active

          oldest

          votes


















          4












          $begingroup$

          Use the option Ticks



          intervals = {{1 <= x <= 10}, {10 <= x <= 100}, {100 <= x <= 1000}};

          logIntervals = intervals /. {n_?NumericQ :> Log10[n]}

          (* {{0 <= x <= 1}, {1 <= x <= 2}, {2 <= x <= 3}} *)

          NumberLinePlot[logIntervals, {x, 0, 3},
          Ticks -> {({Log10[#], #} & /@
          {1, 2, 5, 10, 20, 50, 100, 200, 500, 1000}), None}]


          enter image description here






          share|improve this answer









          $endgroup$













          • $begingroup$
            Nice one! I particularly like the trick with the patternreplacement for the Log
            $endgroup$
            – Oliver Jennrich
            Feb 3 at 15:32



















          0












          $begingroup$

          You can also transform intervals into a list of lists and use ListLinePlot with the option ScalingFunctions:



          lst = MapIndexed[Thread[{#[[1]], #2[[1]]/2}] &, intervals /. LessEqual -> ({#, #3} &)]; 
          Show[ListLinePlot[lst, ScalingFunctions -> {{Log[10, #] &, 10^# &}, None},
          Joined -> #] & /@ {True, False}, AspectRatio -> 1/5, Axes -> {True, False}]


          enter image description here






          share|improve this answer









          $endgroup$













            Your Answer





            StackExchange.ifUsing("editor", function () {
            return StackExchange.using("mathjaxEditing", function () {
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            });
            });
            }, "mathjax-editing");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "387"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f190755%2fhow-can-i-make-a-numberlinelogplot%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4












            $begingroup$

            Use the option Ticks



            intervals = {{1 <= x <= 10}, {10 <= x <= 100}, {100 <= x <= 1000}};

            logIntervals = intervals /. {n_?NumericQ :> Log10[n]}

            (* {{0 <= x <= 1}, {1 <= x <= 2}, {2 <= x <= 3}} *)

            NumberLinePlot[logIntervals, {x, 0, 3},
            Ticks -> {({Log10[#], #} & /@
            {1, 2, 5, 10, 20, 50, 100, 200, 500, 1000}), None}]


            enter image description here






            share|improve this answer









            $endgroup$













            • $begingroup$
              Nice one! I particularly like the trick with the patternreplacement for the Log
              $endgroup$
              – Oliver Jennrich
              Feb 3 at 15:32
















            4












            $begingroup$

            Use the option Ticks



            intervals = {{1 <= x <= 10}, {10 <= x <= 100}, {100 <= x <= 1000}};

            logIntervals = intervals /. {n_?NumericQ :> Log10[n]}

            (* {{0 <= x <= 1}, {1 <= x <= 2}, {2 <= x <= 3}} *)

            NumberLinePlot[logIntervals, {x, 0, 3},
            Ticks -> {({Log10[#], #} & /@
            {1, 2, 5, 10, 20, 50, 100, 200, 500, 1000}), None}]


            enter image description here






            share|improve this answer









            $endgroup$













            • $begingroup$
              Nice one! I particularly like the trick with the patternreplacement for the Log
              $endgroup$
              – Oliver Jennrich
              Feb 3 at 15:32














            4












            4








            4





            $begingroup$

            Use the option Ticks



            intervals = {{1 <= x <= 10}, {10 <= x <= 100}, {100 <= x <= 1000}};

            logIntervals = intervals /. {n_?NumericQ :> Log10[n]}

            (* {{0 <= x <= 1}, {1 <= x <= 2}, {2 <= x <= 3}} *)

            NumberLinePlot[logIntervals, {x, 0, 3},
            Ticks -> {({Log10[#], #} & /@
            {1, 2, 5, 10, 20, 50, 100, 200, 500, 1000}), None}]


            enter image description here






            share|improve this answer









            $endgroup$



            Use the option Ticks



            intervals = {{1 <= x <= 10}, {10 <= x <= 100}, {100 <= x <= 1000}};

            logIntervals = intervals /. {n_?NumericQ :> Log10[n]}

            (* {{0 <= x <= 1}, {1 <= x <= 2}, {2 <= x <= 3}} *)

            NumberLinePlot[logIntervals, {x, 0, 3},
            Ticks -> {({Log10[#], #} & /@
            {1, 2, 5, 10, 20, 50, 100, 200, 500, 1000}), None}]


            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Feb 3 at 14:39









            Bob HanlonBob Hanlon

            60.8k33597




            60.8k33597












            • $begingroup$
              Nice one! I particularly like the trick with the patternreplacement for the Log
              $endgroup$
              – Oliver Jennrich
              Feb 3 at 15:32


















            • $begingroup$
              Nice one! I particularly like the trick with the patternreplacement for the Log
              $endgroup$
              – Oliver Jennrich
              Feb 3 at 15:32
















            $begingroup$
            Nice one! I particularly like the trick with the patternreplacement for the Log
            $endgroup$
            – Oliver Jennrich
            Feb 3 at 15:32




            $begingroup$
            Nice one! I particularly like the trick with the patternreplacement for the Log
            $endgroup$
            – Oliver Jennrich
            Feb 3 at 15:32











            0












            $begingroup$

            You can also transform intervals into a list of lists and use ListLinePlot with the option ScalingFunctions:



            lst = MapIndexed[Thread[{#[[1]], #2[[1]]/2}] &, intervals /. LessEqual -> ({#, #3} &)]; 
            Show[ListLinePlot[lst, ScalingFunctions -> {{Log[10, #] &, 10^# &}, None},
            Joined -> #] & /@ {True, False}, AspectRatio -> 1/5, Axes -> {True, False}]


            enter image description here






            share|improve this answer









            $endgroup$


















              0












              $begingroup$

              You can also transform intervals into a list of lists and use ListLinePlot with the option ScalingFunctions:



              lst = MapIndexed[Thread[{#[[1]], #2[[1]]/2}] &, intervals /. LessEqual -> ({#, #3} &)]; 
              Show[ListLinePlot[lst, ScalingFunctions -> {{Log[10, #] &, 10^# &}, None},
              Joined -> #] & /@ {True, False}, AspectRatio -> 1/5, Axes -> {True, False}]


              enter image description here






              share|improve this answer









              $endgroup$
















                0












                0








                0





                $begingroup$

                You can also transform intervals into a list of lists and use ListLinePlot with the option ScalingFunctions:



                lst = MapIndexed[Thread[{#[[1]], #2[[1]]/2}] &, intervals /. LessEqual -> ({#, #3} &)]; 
                Show[ListLinePlot[lst, ScalingFunctions -> {{Log[10, #] &, 10^# &}, None},
                Joined -> #] & /@ {True, False}, AspectRatio -> 1/5, Axes -> {True, False}]


                enter image description here






                share|improve this answer









                $endgroup$



                You can also transform intervals into a list of lists and use ListLinePlot with the option ScalingFunctions:



                lst = MapIndexed[Thread[{#[[1]], #2[[1]]/2}] &, intervals /. LessEqual -> ({#, #3} &)]; 
                Show[ListLinePlot[lst, ScalingFunctions -> {{Log[10, #] &, 10^# &}, None},
                Joined -> #] & /@ {True, False}, AspectRatio -> 1/5, Axes -> {True, False}]


                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 4 at 4:24









                kglrkglr

                189k10206424




                189k10206424






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Mathematica Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f190755%2fhow-can-i-make-a-numberlinelogplot%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Human spaceflight

                    Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                    張江高科駅