58

I'm trying to disable the ticks from showing on this diagram: I've tried using x tick=empty as you can see, but it doesn't appear to change anything since I'm not actually plotting in the axis, only using it for easy construction. Any ideas?

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}[scale=0.9]
\begin{axis}[xtick=\empty, ytick=\empty, minor tick num=0, scaled ticks=false, xticklabel=\empty,yticklabel=\empty,axis x line=bottom,axis y line=left,xlabel={Volume}, ylabel={Pressure}]
\end{axis}
\draw [very thick][-latex](160pt,20pt)..controls(100pt,25pt) and (60pt,45pt)..(42pt,58pt);
\draw [very thick][-latex] (40pt,60pt)--(40pt,126pt);
\draw [very thick][-latex] (40pt,130pt)..controls(60pt,90pt) and (100pt,70pt)..(157pt,60pt);
\draw [very thick][-latex] (160pt,60pt)--(160pt,23pt);
\filldraw(40pt,60pt)circle(2pt) (40pt,130pt)circle (2pt)(160pt,60pt)circle(2pt)(160pt,20pt)circle(2pt);
\draw (160pt,20pt) node [below right] {$1$};
\draw (40pt,60pt) node [below left] {$2$};
\draw (40pt,130pt) node [left] {$3$};
\draw (160pt,60pt) node [above right] {$4$};
\end{tikzpicture}
\end{document}

1 Answer 1

74

I think pgfplots is a little bit of an overkill since it is only two lines to be drawn. However you can simplify a little bit using the ticks=none option.

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[scale=0.9]
\begin{axis}[ticks=none,axis x line=bottom,axis y line=left,xlabel={Volume}, ylabel={Pressure}]
\end{axis}
\draw [very thick][-latex](160pt,20pt)..controls(100pt,25pt) and (60pt,45pt)..(42pt,58pt);
\draw [very thick][-latex] (40pt,60pt)--(40pt,126pt);
\draw [very thick][-latex] (40pt,130pt)..controls(60pt,90pt) and (100pt,70pt)..(157pt,60pt);
\draw [very thick][-latex] (160pt,60pt)--(160pt,23pt);
\filldraw(40pt,60pt)circle(2pt) (40pt,130pt)circle (2pt)(160pt,60pt)circle(2pt)(160pt,20pt)circle(2pt);
\draw (160pt,20pt) node [below right] {$1$};
\draw (40pt,60pt) node [below left] {$2$};
\draw (40pt,130pt) node [left] {$3$};
\draw (160pt,60pt) node [above right] {$4$};
\end{tikzpicture}
\end{document}

enter image description here

4
  • 3
    Thanks @percusse. I agree, it is a little overkill, but to keep the formatting the same between this diagram and following graph which uses real data I opted to use pgfplot again for consistency.
    – Andy
    Feb 18, 2012 at 15:52
  • 56
    Just to note, if you want to apply something like ticks=none to individual axes, apparently the right commands are xmajorticks=false and ymajorticks=false etc...
    – sdaau
    Feb 18, 2014 at 11:21
  • 3
    @sdaau Bah modern people.... :) I think it was v.1.3 when this thing was typed
    – percusse
    Feb 18, 2014 at 11:45
  • 5
    @sdaau, thanks! This was driving me crazy. Top searches yield suggestions like using {}, \empty, draw=none or null, but nothing worked for me with ytick until I triedymajorticks=false. Eureka!
    – PatrickT
    Jun 8, 2017 at 16:47

You must log in to answer this question.

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