3

I want a grid that has no gridlines on the edges, hence I set the following code to have domains and ranges to be odd numbers. However, setting minor tick, you can see in the picture that the minor tick appears on the top and

\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{intersections}
\usetikzlibrary{patterns}
\usetikzlibrary{arrows}
\begin{document}


\begin{enumerate}
    \item Find the slope and $y$-intercept of this graph.\\
    \begin{tikzpicture}[E/.style={font=\small,text=black, sloped, pos=0.75}]
    \begin{axis}[axis line style=thin,
    axis x line=center,
    axis y line=center,
    ytick={-6,-4,...,6},
    xtick={-6,-4,...,6},
    ymin=-7, ymax=7, xmin=-7, xmax=7, xlabel=$x$, ylabel=$y$, grid=both,minor tick num=3, y post scale=1]
    \addplot[name path=A,domain=-7:7, samples=100, thick] { 3*x/4-3} node[E,above] {};
    %\addplot[name path global=line1, color=blue!50, thick, domain=-7:9]{5-3*x/5};
    \end{axis}
\end{tikzpicture}
\end{document}

Here is the image of my result.image1

1

I would enlarge the range for ytick to ytick={-8,-6,...,8} but then restrict their appearance using ytickmin=-6.9,ytickmax=6.9.

enter image description here

Code:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}% <- added, current version is 1.14
\usetikzlibrary{intersections}
%\usetikzlibrary{patterns}
%\usetikzlibrary{arrows}
\begin{document}
\begin{enumerate}
  \item Find the slope and $y$-intercept of this graph.\\
    \begin{tikzpicture}[E/.style={font=\small,text=black, sloped, pos=0.75}]
      \begin{axis}[
          axis line style=thin,
          axis lines=center,
          %%%
          ytick={-8,-6,...,8},
          ymin=-7, ymax=7,
          ytickmin=-6.9,ytickmax=6.9,
          xtick={-8,-6,...,8},
          xmin=-7, xmax=7,
          xtickmin=-6.9,xtickmax=6.9,
          %%%
          xlabel=$x$,
          ylabel=$y$,
          grid=both,
          minor tick num=3,
          y post scale=1
      ]
        \addplot[name path=A,domain=-7:7, samples=100, thick] { 3*x/4-3} node[E,above] {};
      \end{axis}
    \end{tikzpicture}
\end{enumerate}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.