How can I plot inequality solutions in one axis with selected ticks?












3















I would like to plot in one axis the solutions of the following inequality 1< x < 4.
How can I do this by using tikz and show only the ticks of the numbers 1 and 4?



I tried this :



documentclass[a4paper,11pt]{article}
usepackage{amssymb}
usepackage{amsmath}
usepackage{pgfplots,tikz}
usepackage{tkz-euclide,tkz-fct}
begin{document}
begin{tikzpicture}
tkzInit[xmin=-2,xmax=5,xstep=1]
tkzDrawX
tkzLabelX[label options={text=black,below = 3pt}]
tkzDefPoint(1,0){A}
tkzDefPoint(4,0){B}
tkzDrawSegment[line width=1mm](A,B)
end{tikzpicture}
end{document}









share|improve this question





























    3















    I would like to plot in one axis the solutions of the following inequality 1< x < 4.
    How can I do this by using tikz and show only the ticks of the numbers 1 and 4?



    I tried this :



    documentclass[a4paper,11pt]{article}
    usepackage{amssymb}
    usepackage{amsmath}
    usepackage{pgfplots,tikz}
    usepackage{tkz-euclide,tkz-fct}
    begin{document}
    begin{tikzpicture}
    tkzInit[xmin=-2,xmax=5,xstep=1]
    tkzDrawX
    tkzLabelX[label options={text=black,below = 3pt}]
    tkzDefPoint(1,0){A}
    tkzDefPoint(4,0){B}
    tkzDrawSegment[line width=1mm](A,B)
    end{tikzpicture}
    end{document}









    share|improve this question



























      3












      3








      3


      1






      I would like to plot in one axis the solutions of the following inequality 1< x < 4.
      How can I do this by using tikz and show only the ticks of the numbers 1 and 4?



      I tried this :



      documentclass[a4paper,11pt]{article}
      usepackage{amssymb}
      usepackage{amsmath}
      usepackage{pgfplots,tikz}
      usepackage{tkz-euclide,tkz-fct}
      begin{document}
      begin{tikzpicture}
      tkzInit[xmin=-2,xmax=5,xstep=1]
      tkzDrawX
      tkzLabelX[label options={text=black,below = 3pt}]
      tkzDefPoint(1,0){A}
      tkzDefPoint(4,0){B}
      tkzDrawSegment[line width=1mm](A,B)
      end{tikzpicture}
      end{document}









      share|improve this question
















      I would like to plot in one axis the solutions of the following inequality 1< x < 4.
      How can I do this by using tikz and show only the ticks of the numbers 1 and 4?



      I tried this :



      documentclass[a4paper,11pt]{article}
      usepackage{amssymb}
      usepackage{amsmath}
      usepackage{pgfplots,tikz}
      usepackage{tkz-euclide,tkz-fct}
      begin{document}
      begin{tikzpicture}
      tkzInit[xmin=-2,xmax=5,xstep=1]
      tkzDrawX
      tkzLabelX[label options={text=black,below = 3pt}]
      tkzDefPoint(1,0){A}
      tkzDefPoint(4,0){B}
      tkzDrawSegment[line width=1mm](A,B)
      end{tikzpicture}
      end{document}






      tikz-pgf






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 31 '14 at 17:33







      mac

















      asked May 31 '14 at 16:37









      macmac

      695716




      695716






















          2 Answers
          2






          active

          oldest

          votes


















          4














          Something like this?



          documentclass[a4paper,11pt]{article}
          usepackage{amssymb}
          usepackage{amsmath}
          usepackage{pgfplots,tikz}
          usepackage{tkz-euclide,tkz-fct}
          begin{document}
          begin{tikzpicture}
          tkzInit[xmin=-2,xmax=5,xstep=1]
          tkzDrawX
          %tkzLabelX[label options={text=black,below = 3pt}]
          tkzDefPoint(1,0){A}
          tkzDefPoint(4,0){B}
          tkzDrawSegment[line width=1mm](A,B)
          node at (1,0) [below=1mm] {$1$};
          node at (4,0) [below=1mm] {$4$};
          end{tikzpicture}
          end{document}


          enter image description here



          Or only use TiKz:



          documentclass[a4paper,11pt]{article}
          usepackage{amssymb}
          usepackage{amsmath}
          usepackage{pgfplots,tikz}
          pgfplotsset{compat=1.9}
          begin{document}
          begin{tikzpicture}
          draw[-latex] (-2,0) -- (5.5,0)node[below]{$x$};
          draw [line width=0.75mm] (1,0)--(4,0);
          foreach x in {1,4}
          draw (x,3pt) -- (x,-3pt)
          node[anchor=north] {x};
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer


























          • My mistake. What I want is to show not only the numbers 1 and 4 but also the ticks only in those positions.

            – mac
            May 31 '14 at 17:32











          • Use my second code.

            – ferahfeza
            May 31 '14 at 17:53



















          2














          I had the same problem today. So I started from the code of @ferahfeza (thanks a lot ;) ) and I modified a bit his code.



          documentclass[a4paper,11pt]{article}
          usepackage{amssymb}
          usepackage{amsmath}
          usepackage{pgfplots,tikz}
          pgfplotsset{compat=1.9}
          begin{document}
          begin{tikzpicture}
          %x coordinate of start and end point of interval interval 1
          def Xa {1}
          def Xb {4}



          def XStart {-2}
          def XEnd {5.5}

          %coordinates of start and end point of interval
          coordinate (A) at (Xa,0);
          coordinate (B) at (Xb,0);

          %coordinates of start and end point of x-axis
          coordinate (START) at (XStart,0);
          coordinate (END) at (XEnd,0);

          draw[-latex,line width=0.25mm] (START) -- (END)node[below]{$x$};
          %draw interval
          draw [line width=0.95mm] (A)--(B);
          foreach x in {Xa,Xb}
          draw (x,4pt) -- (x,-4pt)
          node[anchor=north] {x};
          %open dot in A
          draw [color=black,line width=0.25mm,fill=white,fill opacity=1.0] (Xa,0) circle (0.15cm);
          %open dot in B
          draw [color=black,line width=0.25mm,fill=white,fill opacity=1.0] (Xb,0) circle (0.15cm);


          draw node[above left] at (XEnd,-2) {$1 < x < 4$};
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "85"
            };
            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%2ftex.stackexchange.com%2fquestions%2f182459%2fhow-can-i-plot-inequality-solutions-in-one-axis-with-selected-ticks%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














            Something like this?



            documentclass[a4paper,11pt]{article}
            usepackage{amssymb}
            usepackage{amsmath}
            usepackage{pgfplots,tikz}
            usepackage{tkz-euclide,tkz-fct}
            begin{document}
            begin{tikzpicture}
            tkzInit[xmin=-2,xmax=5,xstep=1]
            tkzDrawX
            %tkzLabelX[label options={text=black,below = 3pt}]
            tkzDefPoint(1,0){A}
            tkzDefPoint(4,0){B}
            tkzDrawSegment[line width=1mm](A,B)
            node at (1,0) [below=1mm] {$1$};
            node at (4,0) [below=1mm] {$4$};
            end{tikzpicture}
            end{document}


            enter image description here



            Or only use TiKz:



            documentclass[a4paper,11pt]{article}
            usepackage{amssymb}
            usepackage{amsmath}
            usepackage{pgfplots,tikz}
            pgfplotsset{compat=1.9}
            begin{document}
            begin{tikzpicture}
            draw[-latex] (-2,0) -- (5.5,0)node[below]{$x$};
            draw [line width=0.75mm] (1,0)--(4,0);
            foreach x in {1,4}
            draw (x,3pt) -- (x,-3pt)
            node[anchor=north] {x};
            end{tikzpicture}
            end{document}


            enter image description here






            share|improve this answer


























            • My mistake. What I want is to show not only the numbers 1 and 4 but also the ticks only in those positions.

              – mac
              May 31 '14 at 17:32











            • Use my second code.

              – ferahfeza
              May 31 '14 at 17:53
















            4














            Something like this?



            documentclass[a4paper,11pt]{article}
            usepackage{amssymb}
            usepackage{amsmath}
            usepackage{pgfplots,tikz}
            usepackage{tkz-euclide,tkz-fct}
            begin{document}
            begin{tikzpicture}
            tkzInit[xmin=-2,xmax=5,xstep=1]
            tkzDrawX
            %tkzLabelX[label options={text=black,below = 3pt}]
            tkzDefPoint(1,0){A}
            tkzDefPoint(4,0){B}
            tkzDrawSegment[line width=1mm](A,B)
            node at (1,0) [below=1mm] {$1$};
            node at (4,0) [below=1mm] {$4$};
            end{tikzpicture}
            end{document}


            enter image description here



            Or only use TiKz:



            documentclass[a4paper,11pt]{article}
            usepackage{amssymb}
            usepackage{amsmath}
            usepackage{pgfplots,tikz}
            pgfplotsset{compat=1.9}
            begin{document}
            begin{tikzpicture}
            draw[-latex] (-2,0) -- (5.5,0)node[below]{$x$};
            draw [line width=0.75mm] (1,0)--(4,0);
            foreach x in {1,4}
            draw (x,3pt) -- (x,-3pt)
            node[anchor=north] {x};
            end{tikzpicture}
            end{document}


            enter image description here






            share|improve this answer


























            • My mistake. What I want is to show not only the numbers 1 and 4 but also the ticks only in those positions.

              – mac
              May 31 '14 at 17:32











            • Use my second code.

              – ferahfeza
              May 31 '14 at 17:53














            4












            4








            4







            Something like this?



            documentclass[a4paper,11pt]{article}
            usepackage{amssymb}
            usepackage{amsmath}
            usepackage{pgfplots,tikz}
            usepackage{tkz-euclide,tkz-fct}
            begin{document}
            begin{tikzpicture}
            tkzInit[xmin=-2,xmax=5,xstep=1]
            tkzDrawX
            %tkzLabelX[label options={text=black,below = 3pt}]
            tkzDefPoint(1,0){A}
            tkzDefPoint(4,0){B}
            tkzDrawSegment[line width=1mm](A,B)
            node at (1,0) [below=1mm] {$1$};
            node at (4,0) [below=1mm] {$4$};
            end{tikzpicture}
            end{document}


            enter image description here



            Or only use TiKz:



            documentclass[a4paper,11pt]{article}
            usepackage{amssymb}
            usepackage{amsmath}
            usepackage{pgfplots,tikz}
            pgfplotsset{compat=1.9}
            begin{document}
            begin{tikzpicture}
            draw[-latex] (-2,0) -- (5.5,0)node[below]{$x$};
            draw [line width=0.75mm] (1,0)--(4,0);
            foreach x in {1,4}
            draw (x,3pt) -- (x,-3pt)
            node[anchor=north] {x};
            end{tikzpicture}
            end{document}


            enter image description here






            share|improve this answer















            Something like this?



            documentclass[a4paper,11pt]{article}
            usepackage{amssymb}
            usepackage{amsmath}
            usepackage{pgfplots,tikz}
            usepackage{tkz-euclide,tkz-fct}
            begin{document}
            begin{tikzpicture}
            tkzInit[xmin=-2,xmax=5,xstep=1]
            tkzDrawX
            %tkzLabelX[label options={text=black,below = 3pt}]
            tkzDefPoint(1,0){A}
            tkzDefPoint(4,0){B}
            tkzDrawSegment[line width=1mm](A,B)
            node at (1,0) [below=1mm] {$1$};
            node at (4,0) [below=1mm] {$4$};
            end{tikzpicture}
            end{document}


            enter image description here



            Or only use TiKz:



            documentclass[a4paper,11pt]{article}
            usepackage{amssymb}
            usepackage{amsmath}
            usepackage{pgfplots,tikz}
            pgfplotsset{compat=1.9}
            begin{document}
            begin{tikzpicture}
            draw[-latex] (-2,0) -- (5.5,0)node[below]{$x$};
            draw [line width=0.75mm] (1,0)--(4,0);
            foreach x in {1,4}
            draw (x,3pt) -- (x,-3pt)
            node[anchor=north] {x};
            end{tikzpicture}
            end{document}


            enter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 31 '14 at 18:00

























            answered May 31 '14 at 17:27









            ferahfezaferahfeza

            5,35411830




            5,35411830













            • My mistake. What I want is to show not only the numbers 1 and 4 but also the ticks only in those positions.

              – mac
              May 31 '14 at 17:32











            • Use my second code.

              – ferahfeza
              May 31 '14 at 17:53



















            • My mistake. What I want is to show not only the numbers 1 and 4 but also the ticks only in those positions.

              – mac
              May 31 '14 at 17:32











            • Use my second code.

              – ferahfeza
              May 31 '14 at 17:53

















            My mistake. What I want is to show not only the numbers 1 and 4 but also the ticks only in those positions.

            – mac
            May 31 '14 at 17:32





            My mistake. What I want is to show not only the numbers 1 and 4 but also the ticks only in those positions.

            – mac
            May 31 '14 at 17:32













            Use my second code.

            – ferahfeza
            May 31 '14 at 17:53





            Use my second code.

            – ferahfeza
            May 31 '14 at 17:53











            2














            I had the same problem today. So I started from the code of @ferahfeza (thanks a lot ;) ) and I modified a bit his code.



            documentclass[a4paper,11pt]{article}
            usepackage{amssymb}
            usepackage{amsmath}
            usepackage{pgfplots,tikz}
            pgfplotsset{compat=1.9}
            begin{document}
            begin{tikzpicture}
            %x coordinate of start and end point of interval interval 1
            def Xa {1}
            def Xb {4}



            def XStart {-2}
            def XEnd {5.5}

            %coordinates of start and end point of interval
            coordinate (A) at (Xa,0);
            coordinate (B) at (Xb,0);

            %coordinates of start and end point of x-axis
            coordinate (START) at (XStart,0);
            coordinate (END) at (XEnd,0);

            draw[-latex,line width=0.25mm] (START) -- (END)node[below]{$x$};
            %draw interval
            draw [line width=0.95mm] (A)--(B);
            foreach x in {Xa,Xb}
            draw (x,4pt) -- (x,-4pt)
            node[anchor=north] {x};
            %open dot in A
            draw [color=black,line width=0.25mm,fill=white,fill opacity=1.0] (Xa,0) circle (0.15cm);
            %open dot in B
            draw [color=black,line width=0.25mm,fill=white,fill opacity=1.0] (Xb,0) circle (0.15cm);


            draw node[above left] at (XEnd,-2) {$1 < x < 4$};
            end{tikzpicture}
            end{document}


            enter image description here






            share|improve this answer




























              2














              I had the same problem today. So I started from the code of @ferahfeza (thanks a lot ;) ) and I modified a bit his code.



              documentclass[a4paper,11pt]{article}
              usepackage{amssymb}
              usepackage{amsmath}
              usepackage{pgfplots,tikz}
              pgfplotsset{compat=1.9}
              begin{document}
              begin{tikzpicture}
              %x coordinate of start and end point of interval interval 1
              def Xa {1}
              def Xb {4}



              def XStart {-2}
              def XEnd {5.5}

              %coordinates of start and end point of interval
              coordinate (A) at (Xa,0);
              coordinate (B) at (Xb,0);

              %coordinates of start and end point of x-axis
              coordinate (START) at (XStart,0);
              coordinate (END) at (XEnd,0);

              draw[-latex,line width=0.25mm] (START) -- (END)node[below]{$x$};
              %draw interval
              draw [line width=0.95mm] (A)--(B);
              foreach x in {Xa,Xb}
              draw (x,4pt) -- (x,-4pt)
              node[anchor=north] {x};
              %open dot in A
              draw [color=black,line width=0.25mm,fill=white,fill opacity=1.0] (Xa,0) circle (0.15cm);
              %open dot in B
              draw [color=black,line width=0.25mm,fill=white,fill opacity=1.0] (Xb,0) circle (0.15cm);


              draw node[above left] at (XEnd,-2) {$1 < x < 4$};
              end{tikzpicture}
              end{document}


              enter image description here






              share|improve this answer


























                2












                2








                2







                I had the same problem today. So I started from the code of @ferahfeza (thanks a lot ;) ) and I modified a bit his code.



                documentclass[a4paper,11pt]{article}
                usepackage{amssymb}
                usepackage{amsmath}
                usepackage{pgfplots,tikz}
                pgfplotsset{compat=1.9}
                begin{document}
                begin{tikzpicture}
                %x coordinate of start and end point of interval interval 1
                def Xa {1}
                def Xb {4}



                def XStart {-2}
                def XEnd {5.5}

                %coordinates of start and end point of interval
                coordinate (A) at (Xa,0);
                coordinate (B) at (Xb,0);

                %coordinates of start and end point of x-axis
                coordinate (START) at (XStart,0);
                coordinate (END) at (XEnd,0);

                draw[-latex,line width=0.25mm] (START) -- (END)node[below]{$x$};
                %draw interval
                draw [line width=0.95mm] (A)--(B);
                foreach x in {Xa,Xb}
                draw (x,4pt) -- (x,-4pt)
                node[anchor=north] {x};
                %open dot in A
                draw [color=black,line width=0.25mm,fill=white,fill opacity=1.0] (Xa,0) circle (0.15cm);
                %open dot in B
                draw [color=black,line width=0.25mm,fill=white,fill opacity=1.0] (Xb,0) circle (0.15cm);


                draw node[above left] at (XEnd,-2) {$1 < x < 4$};
                end{tikzpicture}
                end{document}


                enter image description here






                share|improve this answer













                I had the same problem today. So I started from the code of @ferahfeza (thanks a lot ;) ) and I modified a bit his code.



                documentclass[a4paper,11pt]{article}
                usepackage{amssymb}
                usepackage{amsmath}
                usepackage{pgfplots,tikz}
                pgfplotsset{compat=1.9}
                begin{document}
                begin{tikzpicture}
                %x coordinate of start and end point of interval interval 1
                def Xa {1}
                def Xb {4}



                def XStart {-2}
                def XEnd {5.5}

                %coordinates of start and end point of interval
                coordinate (A) at (Xa,0);
                coordinate (B) at (Xb,0);

                %coordinates of start and end point of x-axis
                coordinate (START) at (XStart,0);
                coordinate (END) at (XEnd,0);

                draw[-latex,line width=0.25mm] (START) -- (END)node[below]{$x$};
                %draw interval
                draw [line width=0.95mm] (A)--(B);
                foreach x in {Xa,Xb}
                draw (x,4pt) -- (x,-4pt)
                node[anchor=north] {x};
                %open dot in A
                draw [color=black,line width=0.25mm,fill=white,fill opacity=1.0] (Xa,0) circle (0.15cm);
                %open dot in B
                draw [color=black,line width=0.25mm,fill=white,fill opacity=1.0] (Xb,0) circle (0.15cm);


                draw node[above left] at (XEnd,-2) {$1 < x < 4$};
                end{tikzpicture}
                end{document}


                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 3 at 23:51









                ryukryuk

                1,090720




                1,090720






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to TeX - LaTeX 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.


                    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%2ftex.stackexchange.com%2fquestions%2f182459%2fhow-can-i-plot-inequality-solutions-in-one-axis-with-selected-ticks%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

                    Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                    ComboBox Display Member on multiple fields

                    Is it possible to collect Nectar points via Trainline?