0

I'm currently trying to visualize some data, and I'm having a hard time finding a sensible visualization of it. Consider the following code:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.14}
\begin{document}

\pgfplotstableread{SM Hgg Azz
  1.41421353816986083984375 1.41421353816986083984375  0 
  1.41421353816986083984375 1.41421353816986083984375  4.98557376861572265625 
  1.41421353816986083984375 1.41421353816986083984375 -4.98557376861572265625
}\hzzsamplesGood
\pgfplotstableread{SM Hgg Azz
  1.41421353816986083984375 1.41421353816986083984375 7.07106781005859375
  1.41421353816986083984375 1.41421353816986083984375 14.1421356201171875
  1.41421353816986083984375 1.41421353816986083984375 21.21320343017578125
}\hzzsamplesBad
\pgfplotstableread{SM Hgg Azz
  1.436501979827880859375 1.39018142223358154296875 -1.83572733402252197265625
}\hzzsamplesVal

\begin{tikzpicture}
  \begin{axis}[%
      ymin=-10,ymax=25,%
    ]
    \addplot3[color=blue ,mark=*,draw=none] table[y=Azz,x=SM,z=Hgg] {\hzzsamplesGood};
    \addplot3[color=red  ,mark=*,draw=none] table[y=Azz,x=SM,z=Hgg] {\hzzsamplesBad};
    \addplot3[color=green,mark=*,draw=none] table[y=Azz,x=SM,z=Hgg] {\hzzsamplesVal};
  \end{axis}
\end{tikzpicture}
\end{document}

This yields the following plot

vanilla version

As you can see, the two data rows in blue (good) and in red (bad) are aligned in two of the three coordinates. In principle, this would call for a one-dimensional plot, showing only this coordinate (is there even such a thing in pgfplots?)

However, the third green "data row", which is just a single point (val), differs in all three coordinates from the two others.

I'm wondering how to visualize this best, as the default plot (seen above) does not guide the eye very well to this fact.

My first attempt was to shift the position of the y-axis such that it follows the two data rows - but I'm not aware of any way to position the axis at some specific coordinate. Is there an option for that?

I also tried drawing the axis myself, by using axis lines=none and adding

\addplot3[->,domain=-10:25,black] ({sqrt(2)},x,{sqrt(2)}) node[right] {$\kappa_{SM}=\kappa_{Hgg}=\sqrt{2}$};

which results in

ownaxis

As you can see, this is far from perfect:

  • The label gets cropped.
  • I don't know how to add ticks to my own, self-drawn axis.

On top of that, I don't know if this is even a sane strategy.

Can you teach me how to shift the axis to the coordinates where I want them, or draw something that looks like a real axis myself?

If you have other ideas how to visualize this data in a more meaningful way, please feel free to comment as well.

1

I have now come up with a solution that gives up on pgfplots entirely and instead uses the "1D" plot suggestion by Stefan.

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{decorations.markings,arrows}
\pgfplotsset{compat=1.14}
\begin{document}
\newcommand\SM{\textrm{SM}}
\tikzset{
  point/.style={draw,shape=circle,fill,minimum size=3pt,inner sep=0pt}
}
\begin{tikzpicture}[x=.4cm,y=4cm]
  \pgfmathsetmacro{\angleA}{-170}
  \pgfmathsetmacro{\angleB}{90}
  \pgfmathsetmacro{\yscale}{3}
  \pgfmathsetmacro{\zscale}{1.5}
  \pgfmathsetmacro{\ticklength}{0.02}
  \draw[->] (-6.5,0) -- (22,0) node[pos=0.6,above=.5em,scale=0.6] {$\kappa_{\SM}=\kappa_{Hgg}=\sqrt{2}$} node[pos=1.0,right] {$\kappa_{Azz}$};
  \foreach \kAzz in {-6,-3,...,21}{
    \draw (\kAzz,\ticklength) -- (\kAzz,-\ticklength) node [below,scale=0.7] {\kAzz};
  }
  \node at (0,0) [above=.5em,scale=0.6]{\SM};
  \foreach \kAzz in {4.98557376861572265625, 0, -4.98557376861572265625}{
    \coordinate[red,point] () at (\kAzz,0);
  }
  \foreach \kAzz in {7.07106781005859375,14.1421356201171875,21.21320343017578125}{
    \coordinate[blue,point] () at (\kAzz,0);
  }
  \coordinate (valx) at (-1.83572733402252197265625,0);
  \draw[dashed,->] (valx) -- ++(\angleA:0.3*\yscale) node[right,anchor=north west] {$\kappa_{\SM}$};
  \draw[dashed,postaction={decorate},decoration={markings,mark=at position .55 with {\arrow{<}}}] (valx) -- ++(\angleB:0.3*\zscale) node[above] {$\kappa_{Hgg}$};
  \draw (valx) -- ++(\angleA:\yscale*0.1575) --++ (\angleB:\zscale*0.17) coordinate [black,point] (val)
  node[above,anchor=south east,text width=3cm,align=right,scale=0.6] {$\kappa_{\SM}\nearrow 1.575\%$\\$\kappa_{Hgg}\searrow 1.700\%$}; 
\end{tikzpicture}
\end{document}

solution

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.