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.

Is it possible to place a shadow/fill/opaque setting on text of a node pin? I know I can do that with the actual node, but I am using \node in pgfplots to mark some stuff on graphs, and it would be great if I could make a white filling in the text area to make it more clear. Of course, if you know a better way to achieve the same thing in pgf, let me know.

Code I've got so far is below. I tried putting something like [opaque=0.5] after pin, but it seems it has no such options, and I wasn't able to find anything relevant to pin text in pgf documentation.

\tikzset{small dot/.style={fill=black,
                           circle,scale=0.2}}

\node[small dot, pin=120:{$100\ k\Omega$}] at (axis description cs:0.5,0.61) {};
share|improve this question
    
Did you try opacity=0.5? –  Peter Grill Jan 11 '12 at 0:08

2 Answers 2

up vote 8 down vote accepted

To get a semi-transparent background for your pin (or any other node, for that matter), you first need to specify some fill colour. So to get a semi-opaque node background, you could set fill=white, fill opacity=0.5, text opacity=1. Note that the text opacity needs to be set separately, since fill opacity applies both to the background colour and the text.

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    xmin=0,xmax=1,ymin=0,ymax=1,
    grid=both, minor tick num=3, grid style=gray % Darker grid than normal to show the effect better
]
\node[pin={[fill=white, fill opacity=0.5, text opacity=1]120:$100\ k\Omega$}] at (axis description cs:0.5,0.6) {};
\end{axis}
\end{tikzpicture}
\end{document}
share|improve this answer

I have been using \tikzset{every pin/.style={draw=black,fill=yellow!10}} which yields:

enter image description here

Note:

Code:

\documentclass{standalone}
\usepackage{pgfplots}

\tikzset{small dot/.style={fill=black, circle,scale=0.2}}
\tikzset{every pin/.style={draw=black,fill=yellow!10}}


\begin{document}
\begin{tikzpicture}
\begin{axis}[xmin=0,xmax=1,ymin=0,ymax=1]
\node[small dot, pin=120:{$100\ k\omega$}] at (axis description cs:0.5,0.61) {};
\end{axis}
\end{tikzpicture}
\end{document}
share|improve this answer
    
This is a really great idea. –  henry Jun 7 at 11:48

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.