0

Just want to solve this problem, don't need any fancy solution for now, just reducing the amount of ticks should be enough, but couldn't get any close after looking for a while in the PGF manual. There's any axis option that can be tweaked to change this? enter image description here

  %preamble \usepackage{pgfplots} \pgfplotsset{width=10cm,compat=1.18}
    \begin{tikzpicture}
        \begin{axis}[
            grid,
            color = black,
            axis y line = middle,
            axis x line = bottom,
            xlabel=$x$,
            ylabel=$y$,
        ]
            \addplot[
                domain = 0:0.15,
                color = blue!50,
                line width = 2pt,
            ]
            {0.5*(1-e^(-0.2))*e^((x-0.1)/0.1)};
        \end{axis}
        \end{tikzpicture}

  • Please, always post a complete compilable code, MWE. so people can quick copy and paste your code, not needing to edit or guess this or that package or command. x ticks and y ticks are a start point, see pgfplots manual. – FHZ May 02 '22 at 04:16

2 Answers2

0

Using xtick={<start value>,<next element>,...,<end value>},, same for ytick. The increment is automatically calculate. You may also specify all values: ytick={<y1>,<y2>,<y3>}, as I did as example for ytick.

A MWE follows:

\documentclass{article}
\usepackage{pgfplots} \pgfplotsset{width=10cm,compat=1.18}
\begin{document}

\begin{tikzpicture} \begin{axis}[ grid, color = black, axis y line = middle, axis x line = bottom, xlabel=$x$, ylabel=$y$, xtick={0,0.03,...,0.15}, ytick={0,0.03,0.05, 0.10,0.12,0.14} ] \addplot[ domain = 0:0.16, color = blue!50, line width = 2pt, ] {0.5(1-e^(-0.2))e^((x-0.1)/0.1)}; \end{axis} \end{tikzpicture} \end{document}

enter image description here

FHZ
  • 3,939
0

You can specify the distance between ticks with xtick distance:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{width=10cm,compat=1.18}
\begin{document}

\begin{tikzpicture} \begin{axis}[ grid, color = black, axis y line = middle, axis x line = bottom, xlabel=$x$, ylabel=$y$, xtick distance=0.03 ] \addplot[ domain = 0:0.15, color = blue!50, line width = 2pt, ] {0.5(1-e^(-0.2))e^((x-0.1)/0.1)}; \end{axis} \end{tikzpicture} \end{document}

enter image description here