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.

How can I achieve something similar to the "dropped spines" example below using pgfplots?

from matplotlib.sourceforge.com

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

I don't think pgfplots has an option for this out of the box, but you can relatively easily achieve this using the various styles that control axis lines, tick marks and tick labels:

\documentclass{minimal}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[clip=false, % don't clip the graph at the "virtual edge" of the plot
ymin=-1, ymax=1,
xmin=-3.141,xmax=3.141,
ticklabel shift=0.5cm, % shift all tick labels 0.5cm outwards
%
axis y line*=left, % only one y axis on the left, * switches off the arrow tip
y axis line style={xshift=-0.5cm}, % shift y axis 0.5 cm to the left
ytick style={xshift=-0.5cm}, % shift y axis tick marks 0.5 cm to the left
%
axis x line*=bottom,
x axis line style={yshift=-0.5cm},
xtick style={yshift=-0.5cm},
]
\addplot +[domain={-pi:pi},no marks,smooth,thick] {sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
Excellent, thank you! –  0sh Feb 15 '11 at 10:59
add comment

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.