1

This may be similar to some other questions (for example: Axis tick numbers overlap in TikZ), but different enough that the solutions do not seem to work.

Here is a basic example of the issue:

\documentclass[11pt]{article}
  \usepackage{tikz,pgfplots}     %for graphics
   \pgfplotsset{compat = newest}     %to run newest version
  \begin{document} 
   \begin{tikzpicture}
   \begin{axis}[
     xmin=-10, xmax=42, ymin=-6000, ymax=46000,
     axis lines=middle, 
     xtick = {-8,-4,...,40},
     ytick = {-4000,0,...,44000},scaled y ticks = false,
     xlabel = \(x\),
     ylabel = \(y\)
   ]
   \addplot[
      domain=0:32,
      samples=20,]{32000-1000*x};
       \addlegendentry{\(32000-1000x\)}
   \end{axis}
   \end{tikzpicture}
   \end{document}

The bottom left numbers are overlapping and I can not seem to get them to stop. I want to avoid any significant rescaling as this is an example to help students understand graphing a function.

Thank you for any help!

7
  • Welcome to tex.sx. Aug 18, 2022 at 20:42
  • Hi, is the myaxis style necessary to demonstrate the problem? If yes, you need to provide that style :) If not, just as well remove it from the code. Aug 18, 2022 at 20:52
  • 1
    It was not and I removed. Sorry about that. I had just realized I left it in and was coming to fix it.
    – Gregory V.
    Aug 18, 2022 at 20:59
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Aug 18, 2022 at 22:06
  • How would you like the solution to look like? It is easy to remove one of the numbers. Aug 18, 2022 at 22:06

1 Answer 1

1

I want the labels of the tick marks there but not overlapping. I am not sure how else to describe it.

As you are not able to describe what you want, here is a solution, where you can change size and position as you want. No amount of adjustment will make it less than awful though.

\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}     
\pgfplotsset{compat=1.18}
\begin{document} 
\begin{tikzpicture}
\begin{axis}[
xmin=-10, xmax=42, ymin=-6000, ymax=46000,
axis lines=middle, 
xtick={4,8,...,40},
extra x ticks={-8,-4},
ytick={0,4000,...,44000}, scaled y ticks=false,
extra y ticks={-4000},
xlabel=\(x\), ylabel=\(y\),
extra x tick style={xticklabel style={yshift=2pt, font=\scriptsize}},
extra y tick style={yticklabel style={yshift=-1pt, font=\scriptsize}},
]
\addplot[
domain=0:32,
samples=20,]{32000-1000*x};
\addlegendentry{\(32000-1000x\)}
\end{axis}
\end{tikzpicture}
\end{document}

Graph where tick labels do not overlap

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .