Setting axes limits and ticks of a histogram in TikZHow can I create new commands in TikZ?plotting two time...

Multi tool use
Multi tool use

How much mayhem could I cause as a fish?

Can 5 Aarakocra PCs summon an Air Elemental?

I have trouble understanding this fallacy: "If A, then B. Therefore if not-B, then not-A."

"Starve to death" Vs. "Starve to the point of death"

Eww, those bytes are gross

Why maximum length of IP, TCP, UDP packet is not suit?

Why avoid shared user accounts?

Why zero tolerance on nudity in space?

Can you tell from a blurry photo if focus was too close or too far?

Could an Apollo mission be possible if Moon would be Earth like?

The No-Straight Maze

Definition of "atomic object"

Cryptic with some cross words

Does diversity provide anything that meritocracy does not?

How can 若い時 and ずっと work in this sentence?

Does the ditching switch allow an A320 to float indefinitely?

False written accusations not made public - is there law to cover this?

How would an AI self awareness kill switch work?

Removing whitespace between consecutive numbers

Does Skippy chunky peanut butter contain trans fat?

Why don't key signatures indicate the tonic?

Has Britain negotiated with any other countries outside the EU in preparation for the exit?

Sprint is 2 week and 40-stories

What essential properties make us human?



Setting axes limits and ticks of a histogram in TikZ


How can I create new commands in TikZ?plotting two time series with boundsGrouped bar chartHow do i get the x axis on top but keep a line on the bottomHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?How to hide empty (value 0) ybars with pgfplots?Show mark labels near marks and not centered in ybar interaval graphpgfplots: percentage in matrix plotCenter the axes in the coordinate originHistogram Excel-like













0















I have the following code that plots a histogram based on a data-file:



documentclass{article}
usepackage{filecontents}

begin{filecontents*}{data.dat}
subject,f1,f2,f3
-19,0.19,0.04165,0.00016547
-10,0.019,0.04165,0.00016547
-5,0.03034,0.02161,0.000267
0,0.05128,0.0648,0.000327
5,0.052,0.0328,0.000206
10,0.0364,0.06355,0.000379
15,0.02856,0.081253,0.00019
end{filecontents*}

usepackage{pgfplots,pgfplotstable}
pgfplotstableread[col sep=comma]{data.dat}mydata

begin{document}
begin{tikzpicture}
begin{axis}[width=10cm, height=5cm,
legend style={legend columns=-1},
legend to name={thelegend},
name={theaxis},
xlabel=ages,
ylabel=values,
ybar,
ymin=0,ymax=0.1,
xmax=20,
xmin=-20,
xtick={-10,0,10},
ytick={0,0.04,0.08},
yticklabel style={
/pgf/number format/fixed,
/pgf/number format/precision=2
}]
addplot [color=blue,fill] table [x expr=coordindex, y={f1}] mydata;
addplot [color=green,fill] table [x expr=coordindex, y={f2}] mydata;
addplot [color=red,fill] table [x expr=coordindex, y={f3}] mydata;
legend{f1,f2,f3}
end{axis}
node [below] at (theaxis.below south) {ref{thelegend}};
end{tikzpicture}
end{document}


enter image description here



I only want the following values to be shown on the x-axis: -10, 0, 10 and I want to fix the max/min x-value to be 20 and -20, respectively. However, as you can see, something is wrong with the x-axis, because it isn't displaying the data-point at x=-19 nor x=-10 correctly? Is there a way to remedy this?










share|improve this question





























    0















    I have the following code that plots a histogram based on a data-file:



    documentclass{article}
    usepackage{filecontents}

    begin{filecontents*}{data.dat}
    subject,f1,f2,f3
    -19,0.19,0.04165,0.00016547
    -10,0.019,0.04165,0.00016547
    -5,0.03034,0.02161,0.000267
    0,0.05128,0.0648,0.000327
    5,0.052,0.0328,0.000206
    10,0.0364,0.06355,0.000379
    15,0.02856,0.081253,0.00019
    end{filecontents*}

    usepackage{pgfplots,pgfplotstable}
    pgfplotstableread[col sep=comma]{data.dat}mydata

    begin{document}
    begin{tikzpicture}
    begin{axis}[width=10cm, height=5cm,
    legend style={legend columns=-1},
    legend to name={thelegend},
    name={theaxis},
    xlabel=ages,
    ylabel=values,
    ybar,
    ymin=0,ymax=0.1,
    xmax=20,
    xmin=-20,
    xtick={-10,0,10},
    ytick={0,0.04,0.08},
    yticklabel style={
    /pgf/number format/fixed,
    /pgf/number format/precision=2
    }]
    addplot [color=blue,fill] table [x expr=coordindex, y={f1}] mydata;
    addplot [color=green,fill] table [x expr=coordindex, y={f2}] mydata;
    addplot [color=red,fill] table [x expr=coordindex, y={f3}] mydata;
    legend{f1,f2,f3}
    end{axis}
    node [below] at (theaxis.below south) {ref{thelegend}};
    end{tikzpicture}
    end{document}


    enter image description here



    I only want the following values to be shown on the x-axis: -10, 0, 10 and I want to fix the max/min x-value to be 20 and -20, respectively. However, as you can see, something is wrong with the x-axis, because it isn't displaying the data-point at x=-19 nor x=-10 correctly? Is there a way to remedy this?










    share|improve this question



























      0












      0








      0








      I have the following code that plots a histogram based on a data-file:



      documentclass{article}
      usepackage{filecontents}

      begin{filecontents*}{data.dat}
      subject,f1,f2,f3
      -19,0.19,0.04165,0.00016547
      -10,0.019,0.04165,0.00016547
      -5,0.03034,0.02161,0.000267
      0,0.05128,0.0648,0.000327
      5,0.052,0.0328,0.000206
      10,0.0364,0.06355,0.000379
      15,0.02856,0.081253,0.00019
      end{filecontents*}

      usepackage{pgfplots,pgfplotstable}
      pgfplotstableread[col sep=comma]{data.dat}mydata

      begin{document}
      begin{tikzpicture}
      begin{axis}[width=10cm, height=5cm,
      legend style={legend columns=-1},
      legend to name={thelegend},
      name={theaxis},
      xlabel=ages,
      ylabel=values,
      ybar,
      ymin=0,ymax=0.1,
      xmax=20,
      xmin=-20,
      xtick={-10,0,10},
      ytick={0,0.04,0.08},
      yticklabel style={
      /pgf/number format/fixed,
      /pgf/number format/precision=2
      }]
      addplot [color=blue,fill] table [x expr=coordindex, y={f1}] mydata;
      addplot [color=green,fill] table [x expr=coordindex, y={f2}] mydata;
      addplot [color=red,fill] table [x expr=coordindex, y={f3}] mydata;
      legend{f1,f2,f3}
      end{axis}
      node [below] at (theaxis.below south) {ref{thelegend}};
      end{tikzpicture}
      end{document}


      enter image description here



      I only want the following values to be shown on the x-axis: -10, 0, 10 and I want to fix the max/min x-value to be 20 and -20, respectively. However, as you can see, something is wrong with the x-axis, because it isn't displaying the data-point at x=-19 nor x=-10 correctly? Is there a way to remedy this?










      share|improve this question
















      I have the following code that plots a histogram based on a data-file:



      documentclass{article}
      usepackage{filecontents}

      begin{filecontents*}{data.dat}
      subject,f1,f2,f3
      -19,0.19,0.04165,0.00016547
      -10,0.019,0.04165,0.00016547
      -5,0.03034,0.02161,0.000267
      0,0.05128,0.0648,0.000327
      5,0.052,0.0328,0.000206
      10,0.0364,0.06355,0.000379
      15,0.02856,0.081253,0.00019
      end{filecontents*}

      usepackage{pgfplots,pgfplotstable}
      pgfplotstableread[col sep=comma]{data.dat}mydata

      begin{document}
      begin{tikzpicture}
      begin{axis}[width=10cm, height=5cm,
      legend style={legend columns=-1},
      legend to name={thelegend},
      name={theaxis},
      xlabel=ages,
      ylabel=values,
      ybar,
      ymin=0,ymax=0.1,
      xmax=20,
      xmin=-20,
      xtick={-10,0,10},
      ytick={0,0.04,0.08},
      yticklabel style={
      /pgf/number format/fixed,
      /pgf/number format/precision=2
      }]
      addplot [color=blue,fill] table [x expr=coordindex, y={f1}] mydata;
      addplot [color=green,fill] table [x expr=coordindex, y={f2}] mydata;
      addplot [color=red,fill] table [x expr=coordindex, y={f3}] mydata;
      legend{f1,f2,f3}
      end{axis}
      node [below] at (theaxis.below south) {ref{thelegend}};
      end{tikzpicture}
      end{document}


      enter image description here



      I only want the following values to be shown on the x-axis: -10, 0, 10 and I want to fix the max/min x-value to be 20 and -20, respectively. However, as you can see, something is wrong with the x-axis, because it isn't displaying the data-point at x=-19 nor x=-10 correctly? Is there a way to remedy this?







      tikz-pgf pgfplots histogram






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 5 mins ago







      N08

















      asked 13 mins ago









      N08N08

      738




      738






















          0






          active

          oldest

          votes











          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%2f476791%2fsetting-axes-limits-and-ticks-of-a-histogram-in-tikz%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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%2f476791%2fsetting-axes-limits-and-ticks-of-a-histogram-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







          xtyK4y bAsirUOIuN0JrSaVYi,YPWECN
          jqj7bt1P3kJr4wT,3 nUlHnDpD SS4,I4riOU6XeSZKrMeP69mM 5kbzhO7 tQJTg V9Y,DY25DgNVoVwJ2zhNvJA5RxAd R7

          Popular posts from this blog

          IEEEtran - How to include ORCID in TeX/PDF with PdfLatexIs there a standard way to include ORCID in TeX /...

          Can't compile dgruyter and caption packagesLaTeX templates/packages for writing a patent specificationLatex...

          How to fix the “Sorry, but C:…miktex-pdftex.exe did not succeed. ” error? The 2019 Stack...