3

I was wondering how to remove arrow from pgfplots pin option. I do not want any line and want only text.

Many Thanks in advance!


Edit: Added MWE:

enter image description here

I would like to remove the two arrows but want to keep the text only. I am also attaching the output.

\documentclass{standalone}
    \usepackage{amsmath, amssymb}
    \usepackage{pgfplots}
    \usepackage{tikz}
    \usepackage{lmodern}
    \usepackage[T1]{fontenc}
    \begin{document}
    \begin{tikzpicture}[every mark/.append style={mark size=1pt}]
    \begin{axis}[xmin=0, xmax=0.2, ymin=-0.01, ymax=1, width = 8cm, height = 7cm, xtick align =inside, ytick align =inside, ytick distance=0.2, xtick distance = 0.05, minor x tick num={1}, minor y tick num={1}, xlabel = Volume fraction , ylabel= {Area disorder (AD)}, legend style= {nodes={scale=0.5, transform shape}, legend pos= north east, legend cell align={left}}, y tick label style = {/pgf/number format/.cd,
            use comma,
            1000 sep={}, set decimal separator={.}, fixed,
                fixed zerofill,
                precision=1,
            /tikz/.cd}, x tick label style = {/pgf/number format/.cd,
            use comma,
            1000 sep={}, set decimal separator={.}, fixed,
                fixed zerofill,
                precision=2,
            /tikz/.cd}]

    \addplot [only marks, red, mark=square*,mark options={solid, scale=0.6}] coordinates{(0.056,0.3759)};%\addlegendentry{6 wt\% CTBN};
    \addplot [color= red, mark=square*,mark options={solid, scale=0.6}] coordinates{(0.097,0.4418)}; %\addlegendentry{9 wt\% CTBN};
    \begin{scope}[
      every pin edge/.style={<-,>=latex},
      pin distance=1.5 cm,
      every pin/.append style={font=\small}
    ]
    \node[coordinate, pin={[fill=white, pin distance = 5 mm, inner sep=2pt]90:{9R}}]
                at (axis cs:0.097,0.4418) {};
    \node[coordinate, pin={[fill=white, pin distance = 5 mm, inner sep=2pt]90:{6R}}]
                at (axis cs:0.056,0.3759) {};
    \end{scope}
    \end{axis}
    \end{tikzpicture}

    \end{document}
  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Stefan Pinnow Mar 6 '18 at 21:27
1

i don't understand why you use pin option if you actually like to have (simple) label. also you set some options which are default for pgfplots diagrams. shorter version with use of labels is:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\usepackage{lmodern}
\usepackage[T1]{fontenc}

\begin{document}
    \begin{tikzpicture}[
every label/.style={label distance=5mm, font=\small}
                   ]
\begin{axis}[
    width = 8cm, height = 7cm, 
    xmin=0, xmax=0.2, 
    ymin=-0.01, ymax=1, 
    minor tick num={1}, %minor y tick num={1}, 
    xlabel = Volume fraction ,
    ylabel= {Area disorder (AD)}, 
    legend pos= north east, 
    legend cell align=left, 
    y tick label style = {/pgf/number format/.cd, fixed,
                          fixed zerofill, precision=1}, 
    x tick label style = {/pgf/number format/.cd, fixed,
                           fixed zerofill,precision=2},
    mark size=1pt,
    mark=square*, 
                    ]
\addplot [only marks, red, ] coordinates{(0.056,0.3759)
                                         (0.097,0.4418)}; 
\coordinate[label=90:{9R}] (x) at (axis cs:0.097,0.4418);
\coordinate[label=90:{6R}] (x) at (axis cs:0.056,0.3759);
\end{axis}
    \end{tikzpicture}
\end{document}

which gives:

enter image description here

  • @Tasnuva, can you explain me, why you persist with use of pin if for this what you like to have is intend label? to my opinion you like to drill hole with square drill bit ... – Zarko Mar 8 '18 at 14:07
  • I didn't get you! – Tasnuva Mar 8 '18 at 14:09
1

Just put draw=none for every pin edge/.style:

\documentclass{standalone}
    \usepackage{amsmath, amssymb}
    \usepackage{pgfplots}
    \pgfplotsset{compat=1.14}
    \usepackage{tikz}
    \usepackage{lmodern}
    \usepackage[T1]{fontenc}
    \begin{document}
    \begin{tikzpicture}[every mark/.append style={mark size=1pt}]
    \begin{axis}[xmin=0, xmax=0.2, ymin=-0.01, ymax=1, width = 8cm, height = 7cm, xtick align =inside, ytick align =inside, ytick distance=0.2, xtick distance = 0.05, minor x tick num={1}, minor y tick num={1}, xlabel = Volume fraction , ylabel= {Area disorder (AD)}, legend style= {nodes={scale=0.5, transform shape}, legend pos= north east, legend cell align={left}}, y tick label style = {/pgf/number format/.cd,
            use comma,
            1000 sep={}, set decimal separator={.}, fixed,
                fixed zerofill,
                precision=1,
            /tikz/.cd}, x tick label style = {/pgf/number format/.cd,
            use comma,
            1000 sep={}, set decimal separator={.}, fixed,
                fixed zerofill,
                precision=2,
            /tikz/.cd}]

    \addplot [only marks, red, mark=square*,mark options={solid, scale=0.6}] coordinates{(0.056,0.3759)};%\addlegendentry{6 wt\% CTBN};
    \addplot [color= red, mark=square*,mark options={solid, scale=0.6}] coordinates{(0.097,0.4418)}; %\addlegendentry{9 wt\% CTBN};
    \begin{scope}[
      every pin edge/.style={draw=none}, % instead of ={<-,>=latex},
      pin distance=1.5 cm,
      every pin/.append style={font=\small}
    ]
    \node[coordinate, pin={[fill=white, pin distance = 5 mm, inner sep=2pt]90:{9R}}]
                at (axis cs:0.097,0.4418) {};
    \node[coordinate, pin={[fill=white, pin distance = 5 mm, inner sep=2pt]90:{6R}}]
                at (axis cs:0.056,0.3759) {};
    \end{scope}
    \end{axis}
    \end{tikzpicture}

    \end{document}

enter image description here

1

You can achieve the desired result in a much simpler way when you use the PGFPlots nodes near coords feature. For details please have a look at the comments in the code.

% used PGFPlots v1.15
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        xmin=0,
        xmax=0.2,
        ymin=-0.01,
        ymax=1,
        % -----
        % (removed a lot of key--values irrelevant to the question)
        % -----
        % moved common options here
        only marks,
        mark options={
            solid,
            scale=0.6,
        },
        %%% added stuff to achieve what you want using PGFPlots `nodes near coords' feature
        % just state that you want to use the feature
        nodes near coords,
        % by using the following key you can change the style of the nodes near coords
        nodes near coords style={
            font=\small,
            yshift=3mm,
            black,
        },
    ]
        % either you can use it using the `coordinates' syntax ...
        \addplot [
            red,
            mark=square*,
            % last you have to state the "type" of data you want to use
            % for the `nodes near coords'. Here you you don't want to
            % display numeric data, thus you have to use this value
            point meta=explicit symbolic,
        ] coordinates {
            (0.056,0.3759) [{6R}]
            (0.097,0.4418) [{9R}]
        };

        % or which is even simpler to write using the `table' syntax
        % (with the above explanations this here hopefully is pretty much
        %  self-explanatory)
        \addplot [
            blue,
            mark=square*,
            point meta=explicit symbolic,
        ] table [
            x=x,
            y=y,
            meta=meta,
        ] {
            x       y       meta
            0.076   0.3759  6R
            0.117   0.4418  9R
        };
    \end{axis}
\end{tikzpicture}
\end{document}

image showing the result of above code

  • If you like my answer and it was helpful, please consider upvoting (by clicking on the arrows next to the score). And if you think this is the most useful answer (to you), you could also consider marking it as the accepted answer. (You are able at any time to change the accepted answer.) – Stefan Pinnow Mar 8 '18 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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