Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

2 Answers 2

up vote 15 down vote accepted

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

share|improve this answer
2  
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 '12 at 15:52
1  
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 at 11:21
1  
@sdaau Bah modern people.... :) I think it was v.1.3 when this thing was typed –  percusse Feb 18 at 11:45

I'm not sure if this is the best solution, but using the following sets the range of allowed xtick and ytick labels to the empty set. Effectively this turns the y and y ticks off

\begin{axis}[xtickmin=1,xtickmax=0,ytickmin=1,ytickmax=0, minor tick num=0, scaled ticks=false, xticklabel=\empty,yticklabel=\empty,axis x line=bottom,axis y line=left,xlabel{Volume}, ylabel={Pressure}]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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