Strange behavior with extra tick style












2















The extra y ticks at y = 6000 and y = 5400 and the extra x ticks at x = 24 and x = 20.4 are not drawn.



    documentclass[border=10pt]{standalone}
usepackage{pgfplots}
usetikzlibrary{intersections}
usepgfplotslibrary{fillbetween}
pgfplotsset{major grid style={thick,darkgray}}
pgfplotsset{minor grid style={lightgray}}
begin{document}
begin{tikzpicture}[
extended line/.style={shorten >=-#1,shorten <=-#1},
/pgf/declare function={f(x)= 1000*(x +5)*exp(-0.2*x);}]
begin{axis}[
restrict x to domain=0:22, xmax=22, xmin=0,
restrict y to domain=0:6000, ymax=6000, ymin=0,
x=0.6cm,
y=0.0012cm,
axis x line=bottom,
axis y line=left,
major tick style=black,
axis line style = ultra thick,
tick align=outside,
tickwidth=0.14cm,
tick style=thick,
minor x tick num=4,
minor y tick num=4,
grid=both,
xtick={0,2,...,20},
ytick={0,1000,...,5000},
y tick label style={/pgf/number format/1000 sep={}},
extra x ticks={20.4,20.8,21.2,21.6,22},
extra x tick label={null},
extra y ticks={5200,5400,5600,5800,6000},
extra y tick label={null},
extra x tick style={grid=minor,tick style={draw=none}},
extra y tick style={grid=minor,tick style={draw=none}},
xlabel=$x$,ylabel=$f(x)$,
every axis x label/.style={
at={(ticklabel* cs:1.01)},anchor=west},
every axis y label/.style={
at={(ticklabel* cs:1.01)}, anchor=south},
samples=3000,
axis on top=false,
>=stealth,
]
addplot [ultra thick,domain=0:20] {f(x)};
end{axis}
end{tikzpicture}
end{document}


enter image description here










share|improve this question























  • hm, you declared, that they should not be shown: extra x tick style={grid=minor,tick style={draw=none}. if you like to see them, remove tick style={draw=none}.

    – Zarko
    Mar 31 at 10:05


















2















The extra y ticks at y = 6000 and y = 5400 and the extra x ticks at x = 24 and x = 20.4 are not drawn.



    documentclass[border=10pt]{standalone}
usepackage{pgfplots}
usetikzlibrary{intersections}
usepgfplotslibrary{fillbetween}
pgfplotsset{major grid style={thick,darkgray}}
pgfplotsset{minor grid style={lightgray}}
begin{document}
begin{tikzpicture}[
extended line/.style={shorten >=-#1,shorten <=-#1},
/pgf/declare function={f(x)= 1000*(x +5)*exp(-0.2*x);}]
begin{axis}[
restrict x to domain=0:22, xmax=22, xmin=0,
restrict y to domain=0:6000, ymax=6000, ymin=0,
x=0.6cm,
y=0.0012cm,
axis x line=bottom,
axis y line=left,
major tick style=black,
axis line style = ultra thick,
tick align=outside,
tickwidth=0.14cm,
tick style=thick,
minor x tick num=4,
minor y tick num=4,
grid=both,
xtick={0,2,...,20},
ytick={0,1000,...,5000},
y tick label style={/pgf/number format/1000 sep={}},
extra x ticks={20.4,20.8,21.2,21.6,22},
extra x tick label={null},
extra y ticks={5200,5400,5600,5800,6000},
extra y tick label={null},
extra x tick style={grid=minor,tick style={draw=none}},
extra y tick style={grid=minor,tick style={draw=none}},
xlabel=$x$,ylabel=$f(x)$,
every axis x label/.style={
at={(ticklabel* cs:1.01)},anchor=west},
every axis y label/.style={
at={(ticklabel* cs:1.01)}, anchor=south},
samples=3000,
axis on top=false,
>=stealth,
]
addplot [ultra thick,domain=0:20] {f(x)};
end{axis}
end{tikzpicture}
end{document}


enter image description here










share|improve this question























  • hm, you declared, that they should not be shown: extra x tick style={grid=minor,tick style={draw=none}. if you like to see them, remove tick style={draw=none}.

    – Zarko
    Mar 31 at 10:05
















2












2








2








The extra y ticks at y = 6000 and y = 5400 and the extra x ticks at x = 24 and x = 20.4 are not drawn.



    documentclass[border=10pt]{standalone}
usepackage{pgfplots}
usetikzlibrary{intersections}
usepgfplotslibrary{fillbetween}
pgfplotsset{major grid style={thick,darkgray}}
pgfplotsset{minor grid style={lightgray}}
begin{document}
begin{tikzpicture}[
extended line/.style={shorten >=-#1,shorten <=-#1},
/pgf/declare function={f(x)= 1000*(x +5)*exp(-0.2*x);}]
begin{axis}[
restrict x to domain=0:22, xmax=22, xmin=0,
restrict y to domain=0:6000, ymax=6000, ymin=0,
x=0.6cm,
y=0.0012cm,
axis x line=bottom,
axis y line=left,
major tick style=black,
axis line style = ultra thick,
tick align=outside,
tickwidth=0.14cm,
tick style=thick,
minor x tick num=4,
minor y tick num=4,
grid=both,
xtick={0,2,...,20},
ytick={0,1000,...,5000},
y tick label style={/pgf/number format/1000 sep={}},
extra x ticks={20.4,20.8,21.2,21.6,22},
extra x tick label={null},
extra y ticks={5200,5400,5600,5800,6000},
extra y tick label={null},
extra x tick style={grid=minor,tick style={draw=none}},
extra y tick style={grid=minor,tick style={draw=none}},
xlabel=$x$,ylabel=$f(x)$,
every axis x label/.style={
at={(ticklabel* cs:1.01)},anchor=west},
every axis y label/.style={
at={(ticklabel* cs:1.01)}, anchor=south},
samples=3000,
axis on top=false,
>=stealth,
]
addplot [ultra thick,domain=0:20] {f(x)};
end{axis}
end{tikzpicture}
end{document}


enter image description here










share|improve this question














The extra y ticks at y = 6000 and y = 5400 and the extra x ticks at x = 24 and x = 20.4 are not drawn.



    documentclass[border=10pt]{standalone}
usepackage{pgfplots}
usetikzlibrary{intersections}
usepgfplotslibrary{fillbetween}
pgfplotsset{major grid style={thick,darkgray}}
pgfplotsset{minor grid style={lightgray}}
begin{document}
begin{tikzpicture}[
extended line/.style={shorten >=-#1,shorten <=-#1},
/pgf/declare function={f(x)= 1000*(x +5)*exp(-0.2*x);}]
begin{axis}[
restrict x to domain=0:22, xmax=22, xmin=0,
restrict y to domain=0:6000, ymax=6000, ymin=0,
x=0.6cm,
y=0.0012cm,
axis x line=bottom,
axis y line=left,
major tick style=black,
axis line style = ultra thick,
tick align=outside,
tickwidth=0.14cm,
tick style=thick,
minor x tick num=4,
minor y tick num=4,
grid=both,
xtick={0,2,...,20},
ytick={0,1000,...,5000},
y tick label style={/pgf/number format/1000 sep={}},
extra x ticks={20.4,20.8,21.2,21.6,22},
extra x tick label={null},
extra y ticks={5200,5400,5600,5800,6000},
extra y tick label={null},
extra x tick style={grid=minor,tick style={draw=none}},
extra y tick style={grid=minor,tick style={draw=none}},
xlabel=$x$,ylabel=$f(x)$,
every axis x label/.style={
at={(ticklabel* cs:1.01)},anchor=west},
every axis y label/.style={
at={(ticklabel* cs:1.01)}, anchor=south},
samples=3000,
axis on top=false,
>=stealth,
]
addplot [ultra thick,domain=0:20] {f(x)};
end{axis}
end{tikzpicture}
end{document}


enter image description here







pgfplots






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 31 at 9:40









FabriceFabrice

1,4391922




1,4391922













  • hm, you declared, that they should not be shown: extra x tick style={grid=minor,tick style={draw=none}. if you like to see them, remove tick style={draw=none}.

    – Zarko
    Mar 31 at 10:05





















  • hm, you declared, that they should not be shown: extra x tick style={grid=minor,tick style={draw=none}. if you like to see them, remove tick style={draw=none}.

    – Zarko
    Mar 31 at 10:05



















hm, you declared, that they should not be shown: extra x tick style={grid=minor,tick style={draw=none}. if you like to see them, remove tick style={draw=none}.

– Zarko
Mar 31 at 10:05







hm, you declared, that they should not be shown: extra x tick style={grid=minor,tick style={draw=none}. if you like to see them, remove tick style={draw=none}.

– Zarko
Mar 31 at 10:05












2 Answers
2






active

oldest

votes


















2














if i understood correctly what you like to achieve, than you not need extra ticks. you only need to define tick labels accordingly:



documentclass[border=10pt]{standalone}
usepackage{pgfplots}
usetikzlibrary{intersections}
usepgfplotslibrary{fillbetween}

pgfplotsset{major grid style={thick,darkgray}}
pgfplotsset{minor grid style={lightgray}}
begin{document}
begin{tikzpicture}[
extended line/.style={shorten >=-#1,shorten <=-#1},
/pgf/declare function={f(x)= 1000*(x +5)*exp(-0.2*x);}]
begin{axis}[
xmax=22, xmin=0,
ymax=6000, ymin=0,
x=0.6cm,
y=0.0012cm,
axis x line=bottom,
axis y line=left,
major tick style=black,
axis line style = ultra thick,
tick align=outside,
tickwidth=0.14cm,
tick style=thick,
minor x tick num=4,
xtick={0,2,...,22},
xticklabels = {0,2,...,20,}, % <----
ytick={0,1000,...,6000},
yticklabels={0,1000,2000,...,5000,}, % <----
xlabel=$x$,ylabel=$f(x)$,
minor y tick num=4,
grid,
samples=40,
>=stealth,
]
addplot [ultra thick,domain=0:20] {f(x)};
end{axis}
end{tikzpicture}
end{document}


enter image description here






share|improve this answer
























  • @ Zarko Thank you for your suggestion, it's almost the expected result. In fact, the starting code was intended not to draw the last graduation (near the arrow) on each axis.

    – Fabrice
    Apr 1 at 16:42



















2














xtick={0,2,...,22},
ytick={0,1000,...,6000}
should allow what you need



unrelated to your question add also pgfplotsset{compt=1.15} int the preamble



documentclass[border=10pt]{standalone}
usepackage{pgfplots}
usetikzlibrary{intersections}
usepgfplotslibrary{fillbetween}
pgfplotsset{compt=1.15} % <-------
pgfplotsset{major grid style={thick,darkgray}}
pgfplotsset{minor grid style={lightgray}}
begin{document}
begin{tikzpicture}[
extended line/.style={shorten >=-#1,shorten <=-#1},
/pgf/declare function={f(x)= 1000*(x +5)*exp(-0.2*x);}]
begin{axis}[
restrict x to domain=0:22, xmax=22, xmin=0,
restrict y to domain=0:6000, ymax=6000, ymin=0,
x=0.6cm,
y=0.0012cm,
axis x line=bottom,
axis y line=left,
major tick style=black,
axis line style = ultra thick,
tick align=outside,
tickwidth=0.14cm,
tick style=thick,
minor x tick num=4,
minor y tick num=4,
grid=both,
xtick={0,2,...,22}, % <--------
ytick={0,1000,...,6000}, % <-----------
y tick label style={/pgf/number format/1000 sep={}},
extra x ticks={20.4,20.8,21.2,21.6,22},
extra x tick label={null},
extra y ticks={5200,5400,5600,5800,6000},
extra y tick label={null},
extra x tick style={grid=minor,tick style={draw=none}},
extra y tick style={grid=minor,tick style={draw=none}},
xlabel=$x$,ylabel=$f(x)$,
every axis x label/.style={
at={(ticklabel* cs:1.01)},anchor=west},
every axis y label/.style={
at={(ticklabel* cs:1.01)}, anchor=south},
samples=3000,
axis on top=false,
>=stealth,
]
addplot [ultra thick,domain=0:20] {f(x)};
end{axis}
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%2f482391%2fstrange-behavior-with-extra-tick-style%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









    2














    if i understood correctly what you like to achieve, than you not need extra ticks. you only need to define tick labels accordingly:



    documentclass[border=10pt]{standalone}
    usepackage{pgfplots}
    usetikzlibrary{intersections}
    usepgfplotslibrary{fillbetween}

    pgfplotsset{major grid style={thick,darkgray}}
    pgfplotsset{minor grid style={lightgray}}
    begin{document}
    begin{tikzpicture}[
    extended line/.style={shorten >=-#1,shorten <=-#1},
    /pgf/declare function={f(x)= 1000*(x +5)*exp(-0.2*x);}]
    begin{axis}[
    xmax=22, xmin=0,
    ymax=6000, ymin=0,
    x=0.6cm,
    y=0.0012cm,
    axis x line=bottom,
    axis y line=left,
    major tick style=black,
    axis line style = ultra thick,
    tick align=outside,
    tickwidth=0.14cm,
    tick style=thick,
    minor x tick num=4,
    xtick={0,2,...,22},
    xticklabels = {0,2,...,20,}, % <----
    ytick={0,1000,...,6000},
    yticklabels={0,1000,2000,...,5000,}, % <----
    xlabel=$x$,ylabel=$f(x)$,
    minor y tick num=4,
    grid,
    samples=40,
    >=stealth,
    ]
    addplot [ultra thick,domain=0:20] {f(x)};
    end{axis}
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer
























    • @ Zarko Thank you for your suggestion, it's almost the expected result. In fact, the starting code was intended not to draw the last graduation (near the arrow) on each axis.

      – Fabrice
      Apr 1 at 16:42
















    2














    if i understood correctly what you like to achieve, than you not need extra ticks. you only need to define tick labels accordingly:



    documentclass[border=10pt]{standalone}
    usepackage{pgfplots}
    usetikzlibrary{intersections}
    usepgfplotslibrary{fillbetween}

    pgfplotsset{major grid style={thick,darkgray}}
    pgfplotsset{minor grid style={lightgray}}
    begin{document}
    begin{tikzpicture}[
    extended line/.style={shorten >=-#1,shorten <=-#1},
    /pgf/declare function={f(x)= 1000*(x +5)*exp(-0.2*x);}]
    begin{axis}[
    xmax=22, xmin=0,
    ymax=6000, ymin=0,
    x=0.6cm,
    y=0.0012cm,
    axis x line=bottom,
    axis y line=left,
    major tick style=black,
    axis line style = ultra thick,
    tick align=outside,
    tickwidth=0.14cm,
    tick style=thick,
    minor x tick num=4,
    xtick={0,2,...,22},
    xticklabels = {0,2,...,20,}, % <----
    ytick={0,1000,...,6000},
    yticklabels={0,1000,2000,...,5000,}, % <----
    xlabel=$x$,ylabel=$f(x)$,
    minor y tick num=4,
    grid,
    samples=40,
    >=stealth,
    ]
    addplot [ultra thick,domain=0:20] {f(x)};
    end{axis}
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer
























    • @ Zarko Thank you for your suggestion, it's almost the expected result. In fact, the starting code was intended not to draw the last graduation (near the arrow) on each axis.

      – Fabrice
      Apr 1 at 16:42














    2












    2








    2







    if i understood correctly what you like to achieve, than you not need extra ticks. you only need to define tick labels accordingly:



    documentclass[border=10pt]{standalone}
    usepackage{pgfplots}
    usetikzlibrary{intersections}
    usepgfplotslibrary{fillbetween}

    pgfplotsset{major grid style={thick,darkgray}}
    pgfplotsset{minor grid style={lightgray}}
    begin{document}
    begin{tikzpicture}[
    extended line/.style={shorten >=-#1,shorten <=-#1},
    /pgf/declare function={f(x)= 1000*(x +5)*exp(-0.2*x);}]
    begin{axis}[
    xmax=22, xmin=0,
    ymax=6000, ymin=0,
    x=0.6cm,
    y=0.0012cm,
    axis x line=bottom,
    axis y line=left,
    major tick style=black,
    axis line style = ultra thick,
    tick align=outside,
    tickwidth=0.14cm,
    tick style=thick,
    minor x tick num=4,
    xtick={0,2,...,22},
    xticklabels = {0,2,...,20,}, % <----
    ytick={0,1000,...,6000},
    yticklabels={0,1000,2000,...,5000,}, % <----
    xlabel=$x$,ylabel=$f(x)$,
    minor y tick num=4,
    grid,
    samples=40,
    >=stealth,
    ]
    addplot [ultra thick,domain=0:20] {f(x)};
    end{axis}
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer













    if i understood correctly what you like to achieve, than you not need extra ticks. you only need to define tick labels accordingly:



    documentclass[border=10pt]{standalone}
    usepackage{pgfplots}
    usetikzlibrary{intersections}
    usepgfplotslibrary{fillbetween}

    pgfplotsset{major grid style={thick,darkgray}}
    pgfplotsset{minor grid style={lightgray}}
    begin{document}
    begin{tikzpicture}[
    extended line/.style={shorten >=-#1,shorten <=-#1},
    /pgf/declare function={f(x)= 1000*(x +5)*exp(-0.2*x);}]
    begin{axis}[
    xmax=22, xmin=0,
    ymax=6000, ymin=0,
    x=0.6cm,
    y=0.0012cm,
    axis x line=bottom,
    axis y line=left,
    major tick style=black,
    axis line style = ultra thick,
    tick align=outside,
    tickwidth=0.14cm,
    tick style=thick,
    minor x tick num=4,
    xtick={0,2,...,22},
    xticklabels = {0,2,...,20,}, % <----
    ytick={0,1000,...,6000},
    yticklabels={0,1000,2000,...,5000,}, % <----
    xlabel=$x$,ylabel=$f(x)$,
    minor y tick num=4,
    grid,
    samples=40,
    >=stealth,
    ]
    addplot [ultra thick,domain=0:20] {f(x)};
    end{axis}
    end{tikzpicture}
    end{document}


    enter image description here







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 31 at 12:04









    ZarkoZarko

    129k868169




    129k868169













    • @ Zarko Thank you for your suggestion, it's almost the expected result. In fact, the starting code was intended not to draw the last graduation (near the arrow) on each axis.

      – Fabrice
      Apr 1 at 16:42



















    • @ Zarko Thank you for your suggestion, it's almost the expected result. In fact, the starting code was intended not to draw the last graduation (near the arrow) on each axis.

      – Fabrice
      Apr 1 at 16:42

















    @ Zarko Thank you for your suggestion, it's almost the expected result. In fact, the starting code was intended not to draw the last graduation (near the arrow) on each axis.

    – Fabrice
    Apr 1 at 16:42





    @ Zarko Thank you for your suggestion, it's almost the expected result. In fact, the starting code was intended not to draw the last graduation (near the arrow) on each axis.

    – Fabrice
    Apr 1 at 16:42











    2














    xtick={0,2,...,22},
    ytick={0,1000,...,6000}
    should allow what you need



    unrelated to your question add also pgfplotsset{compt=1.15} int the preamble



    documentclass[border=10pt]{standalone}
    usepackage{pgfplots}
    usetikzlibrary{intersections}
    usepgfplotslibrary{fillbetween}
    pgfplotsset{compt=1.15} % <-------
    pgfplotsset{major grid style={thick,darkgray}}
    pgfplotsset{minor grid style={lightgray}}
    begin{document}
    begin{tikzpicture}[
    extended line/.style={shorten >=-#1,shorten <=-#1},
    /pgf/declare function={f(x)= 1000*(x +5)*exp(-0.2*x);}]
    begin{axis}[
    restrict x to domain=0:22, xmax=22, xmin=0,
    restrict y to domain=0:6000, ymax=6000, ymin=0,
    x=0.6cm,
    y=0.0012cm,
    axis x line=bottom,
    axis y line=left,
    major tick style=black,
    axis line style = ultra thick,
    tick align=outside,
    tickwidth=0.14cm,
    tick style=thick,
    minor x tick num=4,
    minor y tick num=4,
    grid=both,
    xtick={0,2,...,22}, % <--------
    ytick={0,1000,...,6000}, % <-----------
    y tick label style={/pgf/number format/1000 sep={}},
    extra x ticks={20.4,20.8,21.2,21.6,22},
    extra x tick label={null},
    extra y ticks={5200,5400,5600,5800,6000},
    extra y tick label={null},
    extra x tick style={grid=minor,tick style={draw=none}},
    extra y tick style={grid=minor,tick style={draw=none}},
    xlabel=$x$,ylabel=$f(x)$,
    every axis x label/.style={
    at={(ticklabel* cs:1.01)},anchor=west},
    every axis y label/.style={
    at={(ticklabel* cs:1.01)}, anchor=south},
    samples=3000,
    axis on top=false,
    >=stealth,
    ]
    addplot [ultra thick,domain=0:20] {f(x)};
    end{axis}
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer






























      2














      xtick={0,2,...,22},
      ytick={0,1000,...,6000}
      should allow what you need



      unrelated to your question add also pgfplotsset{compt=1.15} int the preamble



      documentclass[border=10pt]{standalone}
      usepackage{pgfplots}
      usetikzlibrary{intersections}
      usepgfplotslibrary{fillbetween}
      pgfplotsset{compt=1.15} % <-------
      pgfplotsset{major grid style={thick,darkgray}}
      pgfplotsset{minor grid style={lightgray}}
      begin{document}
      begin{tikzpicture}[
      extended line/.style={shorten >=-#1,shorten <=-#1},
      /pgf/declare function={f(x)= 1000*(x +5)*exp(-0.2*x);}]
      begin{axis}[
      restrict x to domain=0:22, xmax=22, xmin=0,
      restrict y to domain=0:6000, ymax=6000, ymin=0,
      x=0.6cm,
      y=0.0012cm,
      axis x line=bottom,
      axis y line=left,
      major tick style=black,
      axis line style = ultra thick,
      tick align=outside,
      tickwidth=0.14cm,
      tick style=thick,
      minor x tick num=4,
      minor y tick num=4,
      grid=both,
      xtick={0,2,...,22}, % <--------
      ytick={0,1000,...,6000}, % <-----------
      y tick label style={/pgf/number format/1000 sep={}},
      extra x ticks={20.4,20.8,21.2,21.6,22},
      extra x tick label={null},
      extra y ticks={5200,5400,5600,5800,6000},
      extra y tick label={null},
      extra x tick style={grid=minor,tick style={draw=none}},
      extra y tick style={grid=minor,tick style={draw=none}},
      xlabel=$x$,ylabel=$f(x)$,
      every axis x label/.style={
      at={(ticklabel* cs:1.01)},anchor=west},
      every axis y label/.style={
      at={(ticklabel* cs:1.01)}, anchor=south},
      samples=3000,
      axis on top=false,
      >=stealth,
      ]
      addplot [ultra thick,domain=0:20] {f(x)};
      end{axis}
      end{tikzpicture}
      end{document}


      enter image description here






      share|improve this answer




























        2












        2








        2







        xtick={0,2,...,22},
        ytick={0,1000,...,6000}
        should allow what you need



        unrelated to your question add also pgfplotsset{compt=1.15} int the preamble



        documentclass[border=10pt]{standalone}
        usepackage{pgfplots}
        usetikzlibrary{intersections}
        usepgfplotslibrary{fillbetween}
        pgfplotsset{compt=1.15} % <-------
        pgfplotsset{major grid style={thick,darkgray}}
        pgfplotsset{minor grid style={lightgray}}
        begin{document}
        begin{tikzpicture}[
        extended line/.style={shorten >=-#1,shorten <=-#1},
        /pgf/declare function={f(x)= 1000*(x +5)*exp(-0.2*x);}]
        begin{axis}[
        restrict x to domain=0:22, xmax=22, xmin=0,
        restrict y to domain=0:6000, ymax=6000, ymin=0,
        x=0.6cm,
        y=0.0012cm,
        axis x line=bottom,
        axis y line=left,
        major tick style=black,
        axis line style = ultra thick,
        tick align=outside,
        tickwidth=0.14cm,
        tick style=thick,
        minor x tick num=4,
        minor y tick num=4,
        grid=both,
        xtick={0,2,...,22}, % <--------
        ytick={0,1000,...,6000}, % <-----------
        y tick label style={/pgf/number format/1000 sep={}},
        extra x ticks={20.4,20.8,21.2,21.6,22},
        extra x tick label={null},
        extra y ticks={5200,5400,5600,5800,6000},
        extra y tick label={null},
        extra x tick style={grid=minor,tick style={draw=none}},
        extra y tick style={grid=minor,tick style={draw=none}},
        xlabel=$x$,ylabel=$f(x)$,
        every axis x label/.style={
        at={(ticklabel* cs:1.01)},anchor=west},
        every axis y label/.style={
        at={(ticklabel* cs:1.01)}, anchor=south},
        samples=3000,
        axis on top=false,
        >=stealth,
        ]
        addplot [ultra thick,domain=0:20] {f(x)};
        end{axis}
        end{tikzpicture}
        end{document}


        enter image description here






        share|improve this answer















        xtick={0,2,...,22},
        ytick={0,1000,...,6000}
        should allow what you need



        unrelated to your question add also pgfplotsset{compt=1.15} int the preamble



        documentclass[border=10pt]{standalone}
        usepackage{pgfplots}
        usetikzlibrary{intersections}
        usepgfplotslibrary{fillbetween}
        pgfplotsset{compt=1.15} % <-------
        pgfplotsset{major grid style={thick,darkgray}}
        pgfplotsset{minor grid style={lightgray}}
        begin{document}
        begin{tikzpicture}[
        extended line/.style={shorten >=-#1,shorten <=-#1},
        /pgf/declare function={f(x)= 1000*(x +5)*exp(-0.2*x);}]
        begin{axis}[
        restrict x to domain=0:22, xmax=22, xmin=0,
        restrict y to domain=0:6000, ymax=6000, ymin=0,
        x=0.6cm,
        y=0.0012cm,
        axis x line=bottom,
        axis y line=left,
        major tick style=black,
        axis line style = ultra thick,
        tick align=outside,
        tickwidth=0.14cm,
        tick style=thick,
        minor x tick num=4,
        minor y tick num=4,
        grid=both,
        xtick={0,2,...,22}, % <--------
        ytick={0,1000,...,6000}, % <-----------
        y tick label style={/pgf/number format/1000 sep={}},
        extra x ticks={20.4,20.8,21.2,21.6,22},
        extra x tick label={null},
        extra y ticks={5200,5400,5600,5800,6000},
        extra y tick label={null},
        extra x tick style={grid=minor,tick style={draw=none}},
        extra y tick style={grid=minor,tick style={draw=none}},
        xlabel=$x$,ylabel=$f(x)$,
        every axis x label/.style={
        at={(ticklabel* cs:1.01)},anchor=west},
        every axis y label/.style={
        at={(ticklabel* cs:1.01)}, anchor=south},
        samples=3000,
        axis on top=false,
        >=stealth,
        ]
        addplot [ultra thick,domain=0:20] {f(x)};
        end{axis}
        end{tikzpicture}
        end{document}


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 31 at 12:24

























        answered Mar 31 at 12:08









        Hafid BoukhouldaHafid Boukhoulda

        4,7791625




        4,7791625






























            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%2f482391%2fstrange-behavior-with-extra-tick-style%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

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents