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.

Similar to this question: How to make pgfplots vertical labels have proper hyperref erence box? Except, that I am trying to get hyperref working with angled rotated x-axis labels: plot plot2

Got it working, thanks to @Jake.

fin

Update: Got it sorted with href. Thanks.

\newcommand{\nenameref}[1]{\noexpand\nameref{{#1}}}
\newcommand{\nehref}[1]{\noexpand\href{{#1}}}
\begin{tikzpicture}
\def\labellist{{"\nehref{www.google.com}{google}","\nenameref{testtwo}","reallylonglabel"}},
share|improve this question
    
There was a similar post with hyperref rotation stuff, perhaps this is of use how-to-make-pgfplots-vertical-labels-have-proper-hyperref-erence-box –  Christian Feuersänger Jun 6 '11 at 1:24

1 Answer 1

up vote 1 down vote accepted

You can wrap all the tick labels in a rotatebox by using the \ticklabel key (instead of \ticklabels) and defining the references in a list with \noexpand so they survive all the processing. You should use an anchor that is equivalent to the rotation of the labels, to avoid getting an offset:

\documentclass{article}
\usepackage{hyperref}
\usepackage{rotating}
\usepackage{pgfplots}
\usepackage{nameref}
\usepackage{graphicx}
\begin{document}
\section{the beginning}
This is a test.\label{test} \\
This is \nameref{test}. 
\section{second section}
Test two \label{testtwo}

\newcommand{\nenameref}[1]{\noexpand\nameref{{#1}}}
\begin{tikzpicture}
\def\labellist{{"\nenameref{test}","\nenameref{testtwo}","reallylonglabel"}},
\begin{axis}[xtick={1,...,3},
  xticklabel={\pgfmathparse{\labellist[\tick-1]}\rotatebox{65}{\pgfmathresult}},
  x tick label style={anchor=65}]
\addplot+[only marks,
  error bars/.cd,
    y dir=both,
    y explicit,
    error bar style={line width=2pt},
    error mark options={
      rotate=90,
      red,
      mark size=8pt,
      line width=2pt}
]
coordinates {
(3,1) +- (0,0.35665)
(2,1) +- (0,-0.35048)
(1,1) +- (0,0.150255)
};
\end{axis}
\end{tikzpicture}
\end{document}

pgfplots with rotate tick labels

share|improve this answer
    
oooo that looks good. I will get right on it. Many thanks. As always. –  Frank_Zafka Jun 6 '11 at 8:18

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.