How to scale down the size of tick on an axis of graph in Tikz












4















How to scale down the size of tick (j-1, j and j+1) of a graph in Tikz?



Moreover, as I don't have a lot of experience with Tikz, if there is a more standard/efficient way of writing the whole graph, I'm obviously glad to learn!



I obtained this graph by modifying a an example that I found on Texample.net



graph



documentclass[a4paper, 12pt]{book}
usepackage{pgfplots, tikz}
begin{document}
begin{tikzpicture}[scale = 0.7]
% Draw axes
draw [<->,thick] (0,5) node (yaxis) [above] {$y$}
|- (5,0) node (xaxis) [right] {$x$};

coordinate (c) at (2,2);
fill[red] (c) circle (3pt);
draw[dashed] (yaxis |- c) node[left] {$i$}
-| (xaxis -| c) node[below] {$j-1$};

coordinate (d) at (3,2);
fill[red] (d) circle (3pt);
draw[dashed] (yaxis |- d) node[left] {$i$}
-| (xaxis -| d) node[below] {$j$};

coordinate (d) at (3,3);
fill[red] (d) circle (3pt);
draw[dashed] (yaxis |- d) node[left] {$i+1$}
-| (xaxis -| d) node[below] {$j$};

coordinate (d) at (4,2);
fill[red] (d) circle (3pt);
draw[dashed] (yaxis |- d) node[left] {$i$}
-| (xaxis -| d) node[below] {$j+1$};

draw [thin, gray] (0,0) grid (5,5);
end{tikzpicture}
end{document}









share|improve this question





























    4















    How to scale down the size of tick (j-1, j and j+1) of a graph in Tikz?



    Moreover, as I don't have a lot of experience with Tikz, if there is a more standard/efficient way of writing the whole graph, I'm obviously glad to learn!



    I obtained this graph by modifying a an example that I found on Texample.net



    graph



    documentclass[a4paper, 12pt]{book}
    usepackage{pgfplots, tikz}
    begin{document}
    begin{tikzpicture}[scale = 0.7]
    % Draw axes
    draw [<->,thick] (0,5) node (yaxis) [above] {$y$}
    |- (5,0) node (xaxis) [right] {$x$};

    coordinate (c) at (2,2);
    fill[red] (c) circle (3pt);
    draw[dashed] (yaxis |- c) node[left] {$i$}
    -| (xaxis -| c) node[below] {$j-1$};

    coordinate (d) at (3,2);
    fill[red] (d) circle (3pt);
    draw[dashed] (yaxis |- d) node[left] {$i$}
    -| (xaxis -| d) node[below] {$j$};

    coordinate (d) at (3,3);
    fill[red] (d) circle (3pt);
    draw[dashed] (yaxis |- d) node[left] {$i+1$}
    -| (xaxis -| d) node[below] {$j$};

    coordinate (d) at (4,2);
    fill[red] (d) circle (3pt);
    draw[dashed] (yaxis |- d) node[left] {$i$}
    -| (xaxis -| d) node[below] {$j+1$};

    draw [thin, gray] (0,0) grid (5,5);
    end{tikzpicture}
    end{document}









    share|improve this question



























      4












      4








      4


      0






      How to scale down the size of tick (j-1, j and j+1) of a graph in Tikz?



      Moreover, as I don't have a lot of experience with Tikz, if there is a more standard/efficient way of writing the whole graph, I'm obviously glad to learn!



      I obtained this graph by modifying a an example that I found on Texample.net



      graph



      documentclass[a4paper, 12pt]{book}
      usepackage{pgfplots, tikz}
      begin{document}
      begin{tikzpicture}[scale = 0.7]
      % Draw axes
      draw [<->,thick] (0,5) node (yaxis) [above] {$y$}
      |- (5,0) node (xaxis) [right] {$x$};

      coordinate (c) at (2,2);
      fill[red] (c) circle (3pt);
      draw[dashed] (yaxis |- c) node[left] {$i$}
      -| (xaxis -| c) node[below] {$j-1$};

      coordinate (d) at (3,2);
      fill[red] (d) circle (3pt);
      draw[dashed] (yaxis |- d) node[left] {$i$}
      -| (xaxis -| d) node[below] {$j$};

      coordinate (d) at (3,3);
      fill[red] (d) circle (3pt);
      draw[dashed] (yaxis |- d) node[left] {$i+1$}
      -| (xaxis -| d) node[below] {$j$};

      coordinate (d) at (4,2);
      fill[red] (d) circle (3pt);
      draw[dashed] (yaxis |- d) node[left] {$i$}
      -| (xaxis -| d) node[below] {$j+1$};

      draw [thin, gray] (0,0) grid (5,5);
      end{tikzpicture}
      end{document}









      share|improve this question
















      How to scale down the size of tick (j-1, j and j+1) of a graph in Tikz?



      Moreover, as I don't have a lot of experience with Tikz, if there is a more standard/efficient way of writing the whole graph, I'm obviously glad to learn!



      I obtained this graph by modifying a an example that I found on Texample.net



      graph



      documentclass[a4paper, 12pt]{book}
      usepackage{pgfplots, tikz}
      begin{document}
      begin{tikzpicture}[scale = 0.7]
      % Draw axes
      draw [<->,thick] (0,5) node (yaxis) [above] {$y$}
      |- (5,0) node (xaxis) [right] {$x$};

      coordinate (c) at (2,2);
      fill[red] (c) circle (3pt);
      draw[dashed] (yaxis |- c) node[left] {$i$}
      -| (xaxis -| c) node[below] {$j-1$};

      coordinate (d) at (3,2);
      fill[red] (d) circle (3pt);
      draw[dashed] (yaxis |- d) node[left] {$i$}
      -| (xaxis -| d) node[below] {$j$};

      coordinate (d) at (3,3);
      fill[red] (d) circle (3pt);
      draw[dashed] (yaxis |- d) node[left] {$i+1$}
      -| (xaxis -| d) node[below] {$j$};

      coordinate (d) at (4,2);
      fill[red] (d) circle (3pt);
      draw[dashed] (yaxis |- d) node[left] {$i$}
      -| (xaxis -| d) node[below] {$j+1$};

      draw [thin, gray] (0,0) grid (5,5);
      end{tikzpicture}
      end{document}






      tikz-pgf graphics axis






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 1 at 12:26







      ecjb

















      asked Jan 1 at 12:20









      ecjbecjb

      3276




      3276






















          2 Answers
          2






          active

          oldest

          votes


















          4














          I put some opacity in the grid. In my opinion, they should also put the red dots in the foreground to hide the dotted lines that invade the dots. But I don't know if you want this.



          enter image description here



          documentclass[a4paper, 12pt]{book}
          usepackage{pgfplots, tikz}
          begin{document}
          begin{tikzpicture}[scale = 0.7]
          % Draw axes
          draw [<->,thick] (0,5) node (yaxis) [above] {$y$}
          |- (5,0) node (xaxis) [right] {$x$};

          coordinate (c) at (2,2);
          fill[red] (c) circle (3pt);
          draw[dashed] (yaxis |- c) node[left] {}
          -| (xaxis -| c) node[below] {$scriptstyle{j-1}$};

          coordinate (d) at (3,2);
          fill[red] (d) circle (3pt);
          draw[dashed] (yaxis |- d) node[left] {$scriptstyle{i}$}
          -| (xaxis -| d) node[below] {};

          coordinate (d) at (3,3);
          fill[red] (d) circle (3pt);
          draw[dashed] (yaxis |- d) node[left] {$scriptstyle{i+1}$}
          -| (xaxis -| d) node[below] {$scriptstyle{j}$};

          coordinate (d) at (4,2);
          fill[red] (d) circle (3pt);
          draw[dashed] (yaxis |- d) node[left] {}
          -| (xaxis -| d) node[below] {$scriptstyle{j+1}$};

          draw [thin, gray] (0,0) grid (5,5);
          end{tikzpicture}
          end{document}





          share|improve this answer





















          • 3





            Hi Sebastiano, happy new year! You could also add every node/.style={scale = 0.7} to scale down all nodes at once

            – caverac
            Jan 1 at 13:07











          • @caverac Hi to you and a happy new year full of joy and serenity for you and your loved ones. You can make all the changes you want, I don't understand English very much :( especially in the questions without figures.

            – Sebastiano
            Jan 1 at 13:11








          • 1





            Happy new year! thanks to Sebastiano and @caverac. Where in the code should every node/.style={scale = 0.7} be written?

            – ecjb
            Jan 1 at 13:11








          • 2





            @ecjb It would be at the same location where you specify the scale, it would be something like begin{tikzpicture}[scale = 0.7, every node/.style={scale = 0.7}]. I think your answer is spot on Sebastiano, just wanted to give you another option :)

            – caverac
            Jan 1 at 13:14













          • Please note that scriptstyle is a switch (just like tiny or small) and does not take an argument.

            – samcarter
            Jan 1 at 13:37





















          2














          Scaling elements that contain text is not a good idea, it will result in a suboptimal choice of letter shapes, see Why not scale elements that contain text for more information. Instead of scaling the tick labels, better choose an appropriate font size, e.g. scriptsize. In case you want specific elements, like x and y to remain in normal size, you can add normalsize in their nodes.



          Some other comments:




          • you print the labels for i and j three times above each other, depending on the rendering precision of your pdf viewer this can cause the font to look awkward, better only print it one time.


          • It would also be better, if you would choose unique names for your coordinates instead of re-using d for 3 of them. This has the big advantage, that you can easily control the order in which you draw things. For example you can first draw the grid in the background, then the axis, the dashed lines and the red dots at the end.


          • To avoid the problem that several dashed with different dash positions are overprinted you could either restrict the drawing range (as done in the example below) or invert the drawing direction to ensure that they all have the same starting point.





          documentclass[a4paper, 12pt]{book}
          usepackage{pgfplots, tikz}
          begin{document}

          begingroup
          scriptsize
          begin{tikzpicture}[scale=0.7]

          % grid
          draw [thin, gray!30] (0,0) grid (5,5);

          % Draw axes
          draw [<->,thick] (0,5) node (yaxis) [above] {normalsize $y$} |- (5,0) node (xaxis) [right] {normalsize $x$};

          % Coordinates
          coordinate (a) at (2,2);
          coordinate (b) at (3,2);
          coordinate (c) at (3,3);
          coordinate (d) at (4,2);

          % Dashed lines
          draw[dashed] (yaxis |- a) node[left] {$i$} -| (xaxis -| a) node[below] {$j-1$};
          draw[dashed] (a |- b) -| (xaxis -| b) node[below] {$j$};
          draw[dashed] (yaxis |- c) node[left] {$i+1$} -| (b -| c);
          draw[dashed] (b |- d) -| (xaxis -| d) node[below] {$j+1$};

          % red dots
          fill[red] (a) circle (3pt);
          fill[red] (b) circle (3pt);
          fill[red] (c) circle (3pt);
          fill[red] (d) circle (3pt);

          end{tikzpicture}
          endgroup
          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%2f468114%2fhow-to-scale-down-the-size-of-tick-on-an-axis-of-graph-in-tikz%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














            I put some opacity in the grid. In my opinion, they should also put the red dots in the foreground to hide the dotted lines that invade the dots. But I don't know if you want this.



            enter image description here



            documentclass[a4paper, 12pt]{book}
            usepackage{pgfplots, tikz}
            begin{document}
            begin{tikzpicture}[scale = 0.7]
            % Draw axes
            draw [<->,thick] (0,5) node (yaxis) [above] {$y$}
            |- (5,0) node (xaxis) [right] {$x$};

            coordinate (c) at (2,2);
            fill[red] (c) circle (3pt);
            draw[dashed] (yaxis |- c) node[left] {}
            -| (xaxis -| c) node[below] {$scriptstyle{j-1}$};

            coordinate (d) at (3,2);
            fill[red] (d) circle (3pt);
            draw[dashed] (yaxis |- d) node[left] {$scriptstyle{i}$}
            -| (xaxis -| d) node[below] {};

            coordinate (d) at (3,3);
            fill[red] (d) circle (3pt);
            draw[dashed] (yaxis |- d) node[left] {$scriptstyle{i+1}$}
            -| (xaxis -| d) node[below] {$scriptstyle{j}$};

            coordinate (d) at (4,2);
            fill[red] (d) circle (3pt);
            draw[dashed] (yaxis |- d) node[left] {}
            -| (xaxis -| d) node[below] {$scriptstyle{j+1}$};

            draw [thin, gray] (0,0) grid (5,5);
            end{tikzpicture}
            end{document}





            share|improve this answer





















            • 3





              Hi Sebastiano, happy new year! You could also add every node/.style={scale = 0.7} to scale down all nodes at once

              – caverac
              Jan 1 at 13:07











            • @caverac Hi to you and a happy new year full of joy and serenity for you and your loved ones. You can make all the changes you want, I don't understand English very much :( especially in the questions without figures.

              – Sebastiano
              Jan 1 at 13:11








            • 1





              Happy new year! thanks to Sebastiano and @caverac. Where in the code should every node/.style={scale = 0.7} be written?

              – ecjb
              Jan 1 at 13:11








            • 2





              @ecjb It would be at the same location where you specify the scale, it would be something like begin{tikzpicture}[scale = 0.7, every node/.style={scale = 0.7}]. I think your answer is spot on Sebastiano, just wanted to give you another option :)

              – caverac
              Jan 1 at 13:14













            • Please note that scriptstyle is a switch (just like tiny or small) and does not take an argument.

              – samcarter
              Jan 1 at 13:37


















            4














            I put some opacity in the grid. In my opinion, they should also put the red dots in the foreground to hide the dotted lines that invade the dots. But I don't know if you want this.



            enter image description here



            documentclass[a4paper, 12pt]{book}
            usepackage{pgfplots, tikz}
            begin{document}
            begin{tikzpicture}[scale = 0.7]
            % Draw axes
            draw [<->,thick] (0,5) node (yaxis) [above] {$y$}
            |- (5,0) node (xaxis) [right] {$x$};

            coordinate (c) at (2,2);
            fill[red] (c) circle (3pt);
            draw[dashed] (yaxis |- c) node[left] {}
            -| (xaxis -| c) node[below] {$scriptstyle{j-1}$};

            coordinate (d) at (3,2);
            fill[red] (d) circle (3pt);
            draw[dashed] (yaxis |- d) node[left] {$scriptstyle{i}$}
            -| (xaxis -| d) node[below] {};

            coordinate (d) at (3,3);
            fill[red] (d) circle (3pt);
            draw[dashed] (yaxis |- d) node[left] {$scriptstyle{i+1}$}
            -| (xaxis -| d) node[below] {$scriptstyle{j}$};

            coordinate (d) at (4,2);
            fill[red] (d) circle (3pt);
            draw[dashed] (yaxis |- d) node[left] {}
            -| (xaxis -| d) node[below] {$scriptstyle{j+1}$};

            draw [thin, gray] (0,0) grid (5,5);
            end{tikzpicture}
            end{document}





            share|improve this answer





















            • 3





              Hi Sebastiano, happy new year! You could also add every node/.style={scale = 0.7} to scale down all nodes at once

              – caverac
              Jan 1 at 13:07











            • @caverac Hi to you and a happy new year full of joy and serenity for you and your loved ones. You can make all the changes you want, I don't understand English very much :( especially in the questions without figures.

              – Sebastiano
              Jan 1 at 13:11








            • 1





              Happy new year! thanks to Sebastiano and @caverac. Where in the code should every node/.style={scale = 0.7} be written?

              – ecjb
              Jan 1 at 13:11








            • 2





              @ecjb It would be at the same location where you specify the scale, it would be something like begin{tikzpicture}[scale = 0.7, every node/.style={scale = 0.7}]. I think your answer is spot on Sebastiano, just wanted to give you another option :)

              – caverac
              Jan 1 at 13:14













            • Please note that scriptstyle is a switch (just like tiny or small) and does not take an argument.

              – samcarter
              Jan 1 at 13:37
















            4












            4








            4







            I put some opacity in the grid. In my opinion, they should also put the red dots in the foreground to hide the dotted lines that invade the dots. But I don't know if you want this.



            enter image description here



            documentclass[a4paper, 12pt]{book}
            usepackage{pgfplots, tikz}
            begin{document}
            begin{tikzpicture}[scale = 0.7]
            % Draw axes
            draw [<->,thick] (0,5) node (yaxis) [above] {$y$}
            |- (5,0) node (xaxis) [right] {$x$};

            coordinate (c) at (2,2);
            fill[red] (c) circle (3pt);
            draw[dashed] (yaxis |- c) node[left] {}
            -| (xaxis -| c) node[below] {$scriptstyle{j-1}$};

            coordinate (d) at (3,2);
            fill[red] (d) circle (3pt);
            draw[dashed] (yaxis |- d) node[left] {$scriptstyle{i}$}
            -| (xaxis -| d) node[below] {};

            coordinate (d) at (3,3);
            fill[red] (d) circle (3pt);
            draw[dashed] (yaxis |- d) node[left] {$scriptstyle{i+1}$}
            -| (xaxis -| d) node[below] {$scriptstyle{j}$};

            coordinate (d) at (4,2);
            fill[red] (d) circle (3pt);
            draw[dashed] (yaxis |- d) node[left] {}
            -| (xaxis -| d) node[below] {$scriptstyle{j+1}$};

            draw [thin, gray] (0,0) grid (5,5);
            end{tikzpicture}
            end{document}





            share|improve this answer















            I put some opacity in the grid. In my opinion, they should also put the red dots in the foreground to hide the dotted lines that invade the dots. But I don't know if you want this.



            enter image description here



            documentclass[a4paper, 12pt]{book}
            usepackage{pgfplots, tikz}
            begin{document}
            begin{tikzpicture}[scale = 0.7]
            % Draw axes
            draw [<->,thick] (0,5) node (yaxis) [above] {$y$}
            |- (5,0) node (xaxis) [right] {$x$};

            coordinate (c) at (2,2);
            fill[red] (c) circle (3pt);
            draw[dashed] (yaxis |- c) node[left] {}
            -| (xaxis -| c) node[below] {$scriptstyle{j-1}$};

            coordinate (d) at (3,2);
            fill[red] (d) circle (3pt);
            draw[dashed] (yaxis |- d) node[left] {$scriptstyle{i}$}
            -| (xaxis -| d) node[below] {};

            coordinate (d) at (3,3);
            fill[red] (d) circle (3pt);
            draw[dashed] (yaxis |- d) node[left] {$scriptstyle{i+1}$}
            -| (xaxis -| d) node[below] {$scriptstyle{j}$};

            coordinate (d) at (4,2);
            fill[red] (d) circle (3pt);
            draw[dashed] (yaxis |- d) node[left] {}
            -| (xaxis -| d) node[below] {$scriptstyle{j+1}$};

            draw [thin, gray] (0,0) grid (5,5);
            end{tikzpicture}
            end{document}






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 1 at 13:09

























            answered Jan 1 at 12:52









            SebastianoSebastiano

            11.2k42164




            11.2k42164








            • 3





              Hi Sebastiano, happy new year! You could also add every node/.style={scale = 0.7} to scale down all nodes at once

              – caverac
              Jan 1 at 13:07











            • @caverac Hi to you and a happy new year full of joy and serenity for you and your loved ones. You can make all the changes you want, I don't understand English very much :( especially in the questions without figures.

              – Sebastiano
              Jan 1 at 13:11








            • 1





              Happy new year! thanks to Sebastiano and @caverac. Where in the code should every node/.style={scale = 0.7} be written?

              – ecjb
              Jan 1 at 13:11








            • 2





              @ecjb It would be at the same location where you specify the scale, it would be something like begin{tikzpicture}[scale = 0.7, every node/.style={scale = 0.7}]. I think your answer is spot on Sebastiano, just wanted to give you another option :)

              – caverac
              Jan 1 at 13:14













            • Please note that scriptstyle is a switch (just like tiny or small) and does not take an argument.

              – samcarter
              Jan 1 at 13:37
















            • 3





              Hi Sebastiano, happy new year! You could also add every node/.style={scale = 0.7} to scale down all nodes at once

              – caverac
              Jan 1 at 13:07











            • @caverac Hi to you and a happy new year full of joy and serenity for you and your loved ones. You can make all the changes you want, I don't understand English very much :( especially in the questions without figures.

              – Sebastiano
              Jan 1 at 13:11








            • 1





              Happy new year! thanks to Sebastiano and @caverac. Where in the code should every node/.style={scale = 0.7} be written?

              – ecjb
              Jan 1 at 13:11








            • 2





              @ecjb It would be at the same location where you specify the scale, it would be something like begin{tikzpicture}[scale = 0.7, every node/.style={scale = 0.7}]. I think your answer is spot on Sebastiano, just wanted to give you another option :)

              – caverac
              Jan 1 at 13:14













            • Please note that scriptstyle is a switch (just like tiny or small) and does not take an argument.

              – samcarter
              Jan 1 at 13:37










            3




            3





            Hi Sebastiano, happy new year! You could also add every node/.style={scale = 0.7} to scale down all nodes at once

            – caverac
            Jan 1 at 13:07





            Hi Sebastiano, happy new year! You could also add every node/.style={scale = 0.7} to scale down all nodes at once

            – caverac
            Jan 1 at 13:07













            @caverac Hi to you and a happy new year full of joy and serenity for you and your loved ones. You can make all the changes you want, I don't understand English very much :( especially in the questions without figures.

            – Sebastiano
            Jan 1 at 13:11







            @caverac Hi to you and a happy new year full of joy and serenity for you and your loved ones. You can make all the changes you want, I don't understand English very much :( especially in the questions without figures.

            – Sebastiano
            Jan 1 at 13:11






            1




            1





            Happy new year! thanks to Sebastiano and @caverac. Where in the code should every node/.style={scale = 0.7} be written?

            – ecjb
            Jan 1 at 13:11







            Happy new year! thanks to Sebastiano and @caverac. Where in the code should every node/.style={scale = 0.7} be written?

            – ecjb
            Jan 1 at 13:11






            2




            2





            @ecjb It would be at the same location where you specify the scale, it would be something like begin{tikzpicture}[scale = 0.7, every node/.style={scale = 0.7}]. I think your answer is spot on Sebastiano, just wanted to give you another option :)

            – caverac
            Jan 1 at 13:14







            @ecjb It would be at the same location where you specify the scale, it would be something like begin{tikzpicture}[scale = 0.7, every node/.style={scale = 0.7}]. I think your answer is spot on Sebastiano, just wanted to give you another option :)

            – caverac
            Jan 1 at 13:14















            Please note that scriptstyle is a switch (just like tiny or small) and does not take an argument.

            – samcarter
            Jan 1 at 13:37







            Please note that scriptstyle is a switch (just like tiny or small) and does not take an argument.

            – samcarter
            Jan 1 at 13:37













            2














            Scaling elements that contain text is not a good idea, it will result in a suboptimal choice of letter shapes, see Why not scale elements that contain text for more information. Instead of scaling the tick labels, better choose an appropriate font size, e.g. scriptsize. In case you want specific elements, like x and y to remain in normal size, you can add normalsize in their nodes.



            Some other comments:




            • you print the labels for i and j three times above each other, depending on the rendering precision of your pdf viewer this can cause the font to look awkward, better only print it one time.


            • It would also be better, if you would choose unique names for your coordinates instead of re-using d for 3 of them. This has the big advantage, that you can easily control the order in which you draw things. For example you can first draw the grid in the background, then the axis, the dashed lines and the red dots at the end.


            • To avoid the problem that several dashed with different dash positions are overprinted you could either restrict the drawing range (as done in the example below) or invert the drawing direction to ensure that they all have the same starting point.





            documentclass[a4paper, 12pt]{book}
            usepackage{pgfplots, tikz}
            begin{document}

            begingroup
            scriptsize
            begin{tikzpicture}[scale=0.7]

            % grid
            draw [thin, gray!30] (0,0) grid (5,5);

            % Draw axes
            draw [<->,thick] (0,5) node (yaxis) [above] {normalsize $y$} |- (5,0) node (xaxis) [right] {normalsize $x$};

            % Coordinates
            coordinate (a) at (2,2);
            coordinate (b) at (3,2);
            coordinate (c) at (3,3);
            coordinate (d) at (4,2);

            % Dashed lines
            draw[dashed] (yaxis |- a) node[left] {$i$} -| (xaxis -| a) node[below] {$j-1$};
            draw[dashed] (a |- b) -| (xaxis -| b) node[below] {$j$};
            draw[dashed] (yaxis |- c) node[left] {$i+1$} -| (b -| c);
            draw[dashed] (b |- d) -| (xaxis -| d) node[below] {$j+1$};

            % red dots
            fill[red] (a) circle (3pt);
            fill[red] (b) circle (3pt);
            fill[red] (c) circle (3pt);
            fill[red] (d) circle (3pt);

            end{tikzpicture}
            endgroup
            end{document}


            enter image description here






            share|improve this answer






























              2














              Scaling elements that contain text is not a good idea, it will result in a suboptimal choice of letter shapes, see Why not scale elements that contain text for more information. Instead of scaling the tick labels, better choose an appropriate font size, e.g. scriptsize. In case you want specific elements, like x and y to remain in normal size, you can add normalsize in their nodes.



              Some other comments:




              • you print the labels for i and j three times above each other, depending on the rendering precision of your pdf viewer this can cause the font to look awkward, better only print it one time.


              • It would also be better, if you would choose unique names for your coordinates instead of re-using d for 3 of them. This has the big advantage, that you can easily control the order in which you draw things. For example you can first draw the grid in the background, then the axis, the dashed lines and the red dots at the end.


              • To avoid the problem that several dashed with different dash positions are overprinted you could either restrict the drawing range (as done in the example below) or invert the drawing direction to ensure that they all have the same starting point.





              documentclass[a4paper, 12pt]{book}
              usepackage{pgfplots, tikz}
              begin{document}

              begingroup
              scriptsize
              begin{tikzpicture}[scale=0.7]

              % grid
              draw [thin, gray!30] (0,0) grid (5,5);

              % Draw axes
              draw [<->,thick] (0,5) node (yaxis) [above] {normalsize $y$} |- (5,0) node (xaxis) [right] {normalsize $x$};

              % Coordinates
              coordinate (a) at (2,2);
              coordinate (b) at (3,2);
              coordinate (c) at (3,3);
              coordinate (d) at (4,2);

              % Dashed lines
              draw[dashed] (yaxis |- a) node[left] {$i$} -| (xaxis -| a) node[below] {$j-1$};
              draw[dashed] (a |- b) -| (xaxis -| b) node[below] {$j$};
              draw[dashed] (yaxis |- c) node[left] {$i+1$} -| (b -| c);
              draw[dashed] (b |- d) -| (xaxis -| d) node[below] {$j+1$};

              % red dots
              fill[red] (a) circle (3pt);
              fill[red] (b) circle (3pt);
              fill[red] (c) circle (3pt);
              fill[red] (d) circle (3pt);

              end{tikzpicture}
              endgroup
              end{document}


              enter image description here






              share|improve this answer




























                2












                2








                2







                Scaling elements that contain text is not a good idea, it will result in a suboptimal choice of letter shapes, see Why not scale elements that contain text for more information. Instead of scaling the tick labels, better choose an appropriate font size, e.g. scriptsize. In case you want specific elements, like x and y to remain in normal size, you can add normalsize in their nodes.



                Some other comments:




                • you print the labels for i and j three times above each other, depending on the rendering precision of your pdf viewer this can cause the font to look awkward, better only print it one time.


                • It would also be better, if you would choose unique names for your coordinates instead of re-using d for 3 of them. This has the big advantage, that you can easily control the order in which you draw things. For example you can first draw the grid in the background, then the axis, the dashed lines and the red dots at the end.


                • To avoid the problem that several dashed with different dash positions are overprinted you could either restrict the drawing range (as done in the example below) or invert the drawing direction to ensure that they all have the same starting point.





                documentclass[a4paper, 12pt]{book}
                usepackage{pgfplots, tikz}
                begin{document}

                begingroup
                scriptsize
                begin{tikzpicture}[scale=0.7]

                % grid
                draw [thin, gray!30] (0,0) grid (5,5);

                % Draw axes
                draw [<->,thick] (0,5) node (yaxis) [above] {normalsize $y$} |- (5,0) node (xaxis) [right] {normalsize $x$};

                % Coordinates
                coordinate (a) at (2,2);
                coordinate (b) at (3,2);
                coordinate (c) at (3,3);
                coordinate (d) at (4,2);

                % Dashed lines
                draw[dashed] (yaxis |- a) node[left] {$i$} -| (xaxis -| a) node[below] {$j-1$};
                draw[dashed] (a |- b) -| (xaxis -| b) node[below] {$j$};
                draw[dashed] (yaxis |- c) node[left] {$i+1$} -| (b -| c);
                draw[dashed] (b |- d) -| (xaxis -| d) node[below] {$j+1$};

                % red dots
                fill[red] (a) circle (3pt);
                fill[red] (b) circle (3pt);
                fill[red] (c) circle (3pt);
                fill[red] (d) circle (3pt);

                end{tikzpicture}
                endgroup
                end{document}


                enter image description here






                share|improve this answer















                Scaling elements that contain text is not a good idea, it will result in a suboptimal choice of letter shapes, see Why not scale elements that contain text for more information. Instead of scaling the tick labels, better choose an appropriate font size, e.g. scriptsize. In case you want specific elements, like x and y to remain in normal size, you can add normalsize in their nodes.



                Some other comments:




                • you print the labels for i and j three times above each other, depending on the rendering precision of your pdf viewer this can cause the font to look awkward, better only print it one time.


                • It would also be better, if you would choose unique names for your coordinates instead of re-using d for 3 of them. This has the big advantage, that you can easily control the order in which you draw things. For example you can first draw the grid in the background, then the axis, the dashed lines and the red dots at the end.


                • To avoid the problem that several dashed with different dash positions are overprinted you could either restrict the drawing range (as done in the example below) or invert the drawing direction to ensure that they all have the same starting point.





                documentclass[a4paper, 12pt]{book}
                usepackage{pgfplots, tikz}
                begin{document}

                begingroup
                scriptsize
                begin{tikzpicture}[scale=0.7]

                % grid
                draw [thin, gray!30] (0,0) grid (5,5);

                % Draw axes
                draw [<->,thick] (0,5) node (yaxis) [above] {normalsize $y$} |- (5,0) node (xaxis) [right] {normalsize $x$};

                % Coordinates
                coordinate (a) at (2,2);
                coordinate (b) at (3,2);
                coordinate (c) at (3,3);
                coordinate (d) at (4,2);

                % Dashed lines
                draw[dashed] (yaxis |- a) node[left] {$i$} -| (xaxis -| a) node[below] {$j-1$};
                draw[dashed] (a |- b) -| (xaxis -| b) node[below] {$j$};
                draw[dashed] (yaxis |- c) node[left] {$i+1$} -| (b -| c);
                draw[dashed] (b |- d) -| (xaxis -| d) node[below] {$j+1$};

                % red dots
                fill[red] (a) circle (3pt);
                fill[red] (b) circle (3pt);
                fill[red] (c) circle (3pt);
                fill[red] (d) circle (3pt);

                end{tikzpicture}
                endgroup
                end{document}


                enter image description here







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 2 at 12:45

























                answered Jan 1 at 13:26









                samcartersamcarter

                93k7105301




                93k7105301






























                    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%2f468114%2fhow-to-scale-down-the-size-of-tick-on-an-axis-of-graph-in-tikz%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

                    To store a contact into the json file from server.js file using a class in NodeJS

                    Redirect URL with Chrome Remote Debugging Android Devices

                    Dieringhausen