Issue with Graphing Points

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












So I have been trying to graph a function for my economics class. My problem is that the "axis" that are created do not match up with actual points; for example, the point (0,5) will not be on the y-axis, it is shifted over.



Here is the code for my graph:



documentclassarticle
usepackagepgfplots
begindocument

beginfigure[ht]
centering

begintikzpicture[scale=1.5,line width=1pt]

beginaxis[
color= black,
xmin=0,
xmax=19.5,
ymin=0,
ymax=19.5,
axis equal,
axis x line=left,
axis y line=left,
disabledatascaling,
xticklabels=,
yticklabels=,
font=scriptsize,
ticks=none,
extra x ticks=0,
extra y ticks=0,
]

draw (0,5) -- (10,0);

endaxis

endtikzpicture
endfigure
enddocument


My issue is not with creating a graph; I only put a simple line to demonstrate that the points are not lining up.



Does anyone know why this is happening? I cannot figure it out at all. Help would be much appreciated!







share|improve this question









New contributor




Aiden Kenny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 2




    axis y line=middle
    – Henri Menke
    Sep 6 at 4:01















up vote
3
down vote

favorite












So I have been trying to graph a function for my economics class. My problem is that the "axis" that are created do not match up with actual points; for example, the point (0,5) will not be on the y-axis, it is shifted over.



Here is the code for my graph:



documentclassarticle
usepackagepgfplots
begindocument

beginfigure[ht]
centering

begintikzpicture[scale=1.5,line width=1pt]

beginaxis[
color= black,
xmin=0,
xmax=19.5,
ymin=0,
ymax=19.5,
axis equal,
axis x line=left,
axis y line=left,
disabledatascaling,
xticklabels=,
yticklabels=,
font=scriptsize,
ticks=none,
extra x ticks=0,
extra y ticks=0,
]

draw (0,5) -- (10,0);

endaxis

endtikzpicture
endfigure
enddocument


My issue is not with creating a graph; I only put a simple line to demonstrate that the points are not lining up.



Does anyone know why this is happening? I cannot figure it out at all. Help would be much appreciated!







share|improve this question









New contributor




Aiden Kenny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 2




    axis y line=middle
    – Henri Menke
    Sep 6 at 4:01













up vote
3
down vote

favorite









up vote
3
down vote

favorite











So I have been trying to graph a function for my economics class. My problem is that the "axis" that are created do not match up with actual points; for example, the point (0,5) will not be on the y-axis, it is shifted over.



Here is the code for my graph:



documentclassarticle
usepackagepgfplots
begindocument

beginfigure[ht]
centering

begintikzpicture[scale=1.5,line width=1pt]

beginaxis[
color= black,
xmin=0,
xmax=19.5,
ymin=0,
ymax=19.5,
axis equal,
axis x line=left,
axis y line=left,
disabledatascaling,
xticklabels=,
yticklabels=,
font=scriptsize,
ticks=none,
extra x ticks=0,
extra y ticks=0,
]

draw (0,5) -- (10,0);

endaxis

endtikzpicture
endfigure
enddocument


My issue is not with creating a graph; I only put a simple line to demonstrate that the points are not lining up.



Does anyone know why this is happening? I cannot figure it out at all. Help would be much appreciated!







share|improve this question









New contributor




Aiden Kenny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










So I have been trying to graph a function for my economics class. My problem is that the "axis" that are created do not match up with actual points; for example, the point (0,5) will not be on the y-axis, it is shifted over.



Here is the code for my graph:



documentclassarticle
usepackagepgfplots
begindocument

beginfigure[ht]
centering

begintikzpicture[scale=1.5,line width=1pt]

beginaxis[
color= black,
xmin=0,
xmax=19.5,
ymin=0,
ymax=19.5,
axis equal,
axis x line=left,
axis y line=left,
disabledatascaling,
xticklabels=,
yticklabels=,
font=scriptsize,
ticks=none,
extra x ticks=0,
extra y ticks=0,
]

draw (0,5) -- (10,0);

endaxis

endtikzpicture
endfigure
enddocument


My issue is not with creating a graph; I only put a simple line to demonstrate that the points are not lining up.



Does anyone know why this is happening? I cannot figure it out at all. Help would be much appreciated!









share|improve this question









New contributor




Aiden Kenny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Sep 6 at 5:00









Stefan Pinnow

18.8k83172




18.8k83172






New contributor




Aiden Kenny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Sep 6 at 4:00









Aiden Kenny

161




161




New contributor




Aiden Kenny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Aiden Kenny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Aiden Kenny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 2




    axis y line=middle
    – Henri Menke
    Sep 6 at 4:01













  • 2




    axis y line=middle
    – Henri Menke
    Sep 6 at 4:01








2




2




axis y line=middle
– Henri Menke
Sep 6 at 4:01





axis y line=middle
– Henri Menke
Sep 6 at 4:01











2 Answers
2






active

oldest

votes

















up vote
3
down vote













The problem is with the axis equal line. axis equal changes the axis limits automatically in order to make the plot fit in the specified height and width. You can see that it's changing the x-axis by commenting out the ticks=none line - the 0 tick mark is not at the y axis.



I recommend removing the axis equal line.






share|improve this answer



























    up vote
    2
    down vote













    As David already pointed out in his answer this is because of the axis equal option which changes the axis limits to fit the specified width and height of the axis.



    Another alternative would be to use the axis equal image key, which changes either the width or the height.



    If you always want to be sure that the axis lines are drawn at the zero coordinates, you should use axis lines=middle instead of axis lines=left, as Henri Menke already stated in the comment below the question.



    (I also made some other comments to your code in my answer code, which you should have a look at. Just in case you weren't aware of this stuff.)



    % used PGFPlots v1.16
    documentclass[border=5pt]standalone
    usepackagepgfplots
    % % (use this `compat' level or higher so by default TikZ coordinates use
    % % `axis cs:'. See comments below for more details.)
    % pgfplotssetcompat=1.11
    begindocument
    begintikzpicture
    beginaxis[
    xmin=0,
    xmax=19.5,
    ymin=0,
    ymax=19.5,
    % ---------------------------------------------------------------------
    % replace `axis equal' with `axis equal image'
    % axis equal,
    axis equal image,
    % ---------------------------------------------------------------------
    % % (if you want to be sure that the axis lines are drawn at the
    % % zero coordinates, than you should use `axis lines=middle.
    % % Please note that than by default the zero ticklabels are not
    % % drawn, because in general these would be written on "the other"
    % % axis line. To make them appear nonetheless you could add
    % % `hide obscured x ticks=false' (and similar for the y axis), as
    % % are commented below the next commented option line.)
    axis lines=left,
    % axis lines=middle,
    % hide obscured x ticks=false,
    % hide obscured y ticks=false,
    % % (if you comment `disabledatascaling' you also don't get the desired
    % % result, because with the default `compat' level TikZ coordinates
    % % by default don't use the axis coordinate system (`axis cs:'), but
    % % the tikzpicture coordinate system (`cs:'). ...
    % disabledatascaling,
    ]
    % (... To overcome this issue you could either prepend all TikZ
    % coordinates by `axis cs:' or use a `compat' value of 1.11 or higher)
    draw [red,thick] ( 0,5) -- ( 10,0);
    draw [green] (axis cs:0,5) -- (axis cs:10,0);
    endaxis
    endtikzpicture
    enddocument


    image showing the result of above code






    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',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );






      Aiden Kenny is a new contributor. Be nice, and check out our Code of Conduct.









       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f449599%2fissue-with-graphing-points%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      3
      down vote













      The problem is with the axis equal line. axis equal changes the axis limits automatically in order to make the plot fit in the specified height and width. You can see that it's changing the x-axis by commenting out the ticks=none line - the 0 tick mark is not at the y axis.



      I recommend removing the axis equal line.






      share|improve this answer
























        up vote
        3
        down vote













        The problem is with the axis equal line. axis equal changes the axis limits automatically in order to make the plot fit in the specified height and width. You can see that it's changing the x-axis by commenting out the ticks=none line - the 0 tick mark is not at the y axis.



        I recommend removing the axis equal line.






        share|improve this answer






















          up vote
          3
          down vote










          up vote
          3
          down vote









          The problem is with the axis equal line. axis equal changes the axis limits automatically in order to make the plot fit in the specified height and width. You can see that it's changing the x-axis by commenting out the ticks=none line - the 0 tick mark is not at the y axis.



          I recommend removing the axis equal line.






          share|improve this answer












          The problem is with the axis equal line. axis equal changes the axis limits automatically in order to make the plot fit in the specified height and width. You can see that it's changing the x-axis by commenting out the ticks=none line - the 0 tick mark is not at the y axis.



          I recommend removing the axis equal line.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 6 at 4:06









          David Scott

          434




          434




















              up vote
              2
              down vote













              As David already pointed out in his answer this is because of the axis equal option which changes the axis limits to fit the specified width and height of the axis.



              Another alternative would be to use the axis equal image key, which changes either the width or the height.



              If you always want to be sure that the axis lines are drawn at the zero coordinates, you should use axis lines=middle instead of axis lines=left, as Henri Menke already stated in the comment below the question.



              (I also made some other comments to your code in my answer code, which you should have a look at. Just in case you weren't aware of this stuff.)



              % used PGFPlots v1.16
              documentclass[border=5pt]standalone
              usepackagepgfplots
              % % (use this `compat' level or higher so by default TikZ coordinates use
              % % `axis cs:'. See comments below for more details.)
              % pgfplotssetcompat=1.11
              begindocument
              begintikzpicture
              beginaxis[
              xmin=0,
              xmax=19.5,
              ymin=0,
              ymax=19.5,
              % ---------------------------------------------------------------------
              % replace `axis equal' with `axis equal image'
              % axis equal,
              axis equal image,
              % ---------------------------------------------------------------------
              % % (if you want to be sure that the axis lines are drawn at the
              % % zero coordinates, than you should use `axis lines=middle.
              % % Please note that than by default the zero ticklabels are not
              % % drawn, because in general these would be written on "the other"
              % % axis line. To make them appear nonetheless you could add
              % % `hide obscured x ticks=false' (and similar for the y axis), as
              % % are commented below the next commented option line.)
              axis lines=left,
              % axis lines=middle,
              % hide obscured x ticks=false,
              % hide obscured y ticks=false,
              % % (if you comment `disabledatascaling' you also don't get the desired
              % % result, because with the default `compat' level TikZ coordinates
              % % by default don't use the axis coordinate system (`axis cs:'), but
              % % the tikzpicture coordinate system (`cs:'). ...
              % disabledatascaling,
              ]
              % (... To overcome this issue you could either prepend all TikZ
              % coordinates by `axis cs:' or use a `compat' value of 1.11 or higher)
              draw [red,thick] ( 0,5) -- ( 10,0);
              draw [green] (axis cs:0,5) -- (axis cs:10,0);
              endaxis
              endtikzpicture
              enddocument


              image showing the result of above code






              share|improve this answer
























                up vote
                2
                down vote













                As David already pointed out in his answer this is because of the axis equal option which changes the axis limits to fit the specified width and height of the axis.



                Another alternative would be to use the axis equal image key, which changes either the width or the height.



                If you always want to be sure that the axis lines are drawn at the zero coordinates, you should use axis lines=middle instead of axis lines=left, as Henri Menke already stated in the comment below the question.



                (I also made some other comments to your code in my answer code, which you should have a look at. Just in case you weren't aware of this stuff.)



                % used PGFPlots v1.16
                documentclass[border=5pt]standalone
                usepackagepgfplots
                % % (use this `compat' level or higher so by default TikZ coordinates use
                % % `axis cs:'. See comments below for more details.)
                % pgfplotssetcompat=1.11
                begindocument
                begintikzpicture
                beginaxis[
                xmin=0,
                xmax=19.5,
                ymin=0,
                ymax=19.5,
                % ---------------------------------------------------------------------
                % replace `axis equal' with `axis equal image'
                % axis equal,
                axis equal image,
                % ---------------------------------------------------------------------
                % % (if you want to be sure that the axis lines are drawn at the
                % % zero coordinates, than you should use `axis lines=middle.
                % % Please note that than by default the zero ticklabels are not
                % % drawn, because in general these would be written on "the other"
                % % axis line. To make them appear nonetheless you could add
                % % `hide obscured x ticks=false' (and similar for the y axis), as
                % % are commented below the next commented option line.)
                axis lines=left,
                % axis lines=middle,
                % hide obscured x ticks=false,
                % hide obscured y ticks=false,
                % % (if you comment `disabledatascaling' you also don't get the desired
                % % result, because with the default `compat' level TikZ coordinates
                % % by default don't use the axis coordinate system (`axis cs:'), but
                % % the tikzpicture coordinate system (`cs:'). ...
                % disabledatascaling,
                ]
                % (... To overcome this issue you could either prepend all TikZ
                % coordinates by `axis cs:' or use a `compat' value of 1.11 or higher)
                draw [red,thick] ( 0,5) -- ( 10,0);
                draw [green] (axis cs:0,5) -- (axis cs:10,0);
                endaxis
                endtikzpicture
                enddocument


                image showing the result of above code






                share|improve this answer






















                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  As David already pointed out in his answer this is because of the axis equal option which changes the axis limits to fit the specified width and height of the axis.



                  Another alternative would be to use the axis equal image key, which changes either the width or the height.



                  If you always want to be sure that the axis lines are drawn at the zero coordinates, you should use axis lines=middle instead of axis lines=left, as Henri Menke already stated in the comment below the question.



                  (I also made some other comments to your code in my answer code, which you should have a look at. Just in case you weren't aware of this stuff.)



                  % used PGFPlots v1.16
                  documentclass[border=5pt]standalone
                  usepackagepgfplots
                  % % (use this `compat' level or higher so by default TikZ coordinates use
                  % % `axis cs:'. See comments below for more details.)
                  % pgfplotssetcompat=1.11
                  begindocument
                  begintikzpicture
                  beginaxis[
                  xmin=0,
                  xmax=19.5,
                  ymin=0,
                  ymax=19.5,
                  % ---------------------------------------------------------------------
                  % replace `axis equal' with `axis equal image'
                  % axis equal,
                  axis equal image,
                  % ---------------------------------------------------------------------
                  % % (if you want to be sure that the axis lines are drawn at the
                  % % zero coordinates, than you should use `axis lines=middle.
                  % % Please note that than by default the zero ticklabels are not
                  % % drawn, because in general these would be written on "the other"
                  % % axis line. To make them appear nonetheless you could add
                  % % `hide obscured x ticks=false' (and similar for the y axis), as
                  % % are commented below the next commented option line.)
                  axis lines=left,
                  % axis lines=middle,
                  % hide obscured x ticks=false,
                  % hide obscured y ticks=false,
                  % % (if you comment `disabledatascaling' you also don't get the desired
                  % % result, because with the default `compat' level TikZ coordinates
                  % % by default don't use the axis coordinate system (`axis cs:'), but
                  % % the tikzpicture coordinate system (`cs:'). ...
                  % disabledatascaling,
                  ]
                  % (... To overcome this issue you could either prepend all TikZ
                  % coordinates by `axis cs:' or use a `compat' value of 1.11 or higher)
                  draw [red,thick] ( 0,5) -- ( 10,0);
                  draw [green] (axis cs:0,5) -- (axis cs:10,0);
                  endaxis
                  endtikzpicture
                  enddocument


                  image showing the result of above code






                  share|improve this answer












                  As David already pointed out in his answer this is because of the axis equal option which changes the axis limits to fit the specified width and height of the axis.



                  Another alternative would be to use the axis equal image key, which changes either the width or the height.



                  If you always want to be sure that the axis lines are drawn at the zero coordinates, you should use axis lines=middle instead of axis lines=left, as Henri Menke already stated in the comment below the question.



                  (I also made some other comments to your code in my answer code, which you should have a look at. Just in case you weren't aware of this stuff.)



                  % used PGFPlots v1.16
                  documentclass[border=5pt]standalone
                  usepackagepgfplots
                  % % (use this `compat' level or higher so by default TikZ coordinates use
                  % % `axis cs:'. See comments below for more details.)
                  % pgfplotssetcompat=1.11
                  begindocument
                  begintikzpicture
                  beginaxis[
                  xmin=0,
                  xmax=19.5,
                  ymin=0,
                  ymax=19.5,
                  % ---------------------------------------------------------------------
                  % replace `axis equal' with `axis equal image'
                  % axis equal,
                  axis equal image,
                  % ---------------------------------------------------------------------
                  % % (if you want to be sure that the axis lines are drawn at the
                  % % zero coordinates, than you should use `axis lines=middle.
                  % % Please note that than by default the zero ticklabels are not
                  % % drawn, because in general these would be written on "the other"
                  % % axis line. To make them appear nonetheless you could add
                  % % `hide obscured x ticks=false' (and similar for the y axis), as
                  % % are commented below the next commented option line.)
                  axis lines=left,
                  % axis lines=middle,
                  % hide obscured x ticks=false,
                  % hide obscured y ticks=false,
                  % % (if you comment `disabledatascaling' you also don't get the desired
                  % % result, because with the default `compat' level TikZ coordinates
                  % % by default don't use the axis coordinate system (`axis cs:'), but
                  % % the tikzpicture coordinate system (`cs:'). ...
                  % disabledatascaling,
                  ]
                  % (... To overcome this issue you could either prepend all TikZ
                  % coordinates by `axis cs:' or use a `compat' value of 1.11 or higher)
                  draw [red,thick] ( 0,5) -- ( 10,0);
                  draw [green] (axis cs:0,5) -- (axis cs:10,0);
                  endaxis
                  endtikzpicture
                  enddocument


                  image showing the result of above code







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 6 at 7:25









                  Stefan Pinnow

                  18.8k83172




                  18.8k83172




















                      Aiden Kenny is a new contributor. Be nice, and check out our Code of Conduct.









                       

                      draft saved


                      draft discarded


















                      Aiden Kenny is a new contributor. Be nice, and check out our Code of Conduct.












                      Aiden Kenny is a new contributor. Be nice, and check out our Code of Conduct.











                      Aiden Kenny is a new contributor. Be nice, and check out our Code of Conduct.













                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f449599%2fissue-with-graphing-points%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      Long meetings (6-7 hours a day): Being “babysat” by supervisor

                      Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                      Confectionery