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.

Using pgfplots, it's possible to turn on or off printing of axis lines and ticks using axis lines for all axes or axis x line (etc.) for only selected axes. However, sometimes it is desirable to print the ticks and labels but not the axis lines themselves. This is a style not dissimilar to those recommended by Edward Tufte (see also Is there a package that provides graphing in the style of Ed Tufte?), but it's useful even if that's not the key concern, for example for making very small plots for abstracts or similar. What is the best way to achieve this?

share|improve this question
    
Related: There's an article in the upcoming TUGboat about implementing Tufte's "range frames" (axis lines drawn only over the range of the data) and "dash-dot plot" (tick marks used to show the marginal distribution of the data). –  Jake Jul 31 '13 at 13:08

1 Answer 1

up vote 5 down vote accepted

There are a couple of steps required to remove the lines and then 'tidy up' the ticks. The lines are removed using the axis line style option

axis line style = { draw = none }

which unlike setting axis lines = none still prints the ticks and labels. However, on its own this prints the tick marks on both the axis with the labels and the one without them: these look a bit strange, so you probably also want to set tick pos = left (pgfplots uses left for both axes!). You may then want to adjust the number of ticks in use: the Tufte style is to have only the tick marks at the edges of the printed range, but that is optional.

A short example:

\documentclass{standalone}

\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
     \begin{axis}
       [
         axis line style = { draw = none },
         xtick           = {-5,5}         ,
         ytick           = {-5,5}         ,
         tick pos        = left           ,
       ]
     \addplot[only marks, color = black] {x};
     \end{axis}
\end{tikzpicture}
\end{document} 

gives the output

enter image description here

For very small-scale plots, missing out one of the axes may be sensible: the easies way to do this is to set the ticks to \empty, e.g. ytick = \empty. With no ticks set, the axis then doesn't show up at all.

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.