I want to get horizontal axis with annotations, like in attached picture. What package would be most suitable for such task?What I want to obtain

  • welcome to tex.se! what you try so far? – Zarko May 6 '19 at 17:56
  • Hello! I didn't try anything so far. I came here, because maybe someone had such case before. – Piotr Bródka May 6 '19 at 19:16
  • similar question are appears here, you need to search site. at least you should provide more information about your document (used packages, etc). otherwise this is do-it-for-me question, which likely be closed soon as "to broad" . – Zarko May 6 '19 at 19:20

Here is a starter with simple \put commands:




enter image description here

| improve this answer | |

Using TikZ will probably be the best approach. Here is a sample solution to your request. I did comment out the code to make it easier to understand. Sample Output

        % Horizontal line
        \draw[->] (0,0) -- (4.5,0)node[xshift = 0.25cm]{$x$};
            {"a", "d", "g", "j", "m"},  % Row 0
            {"b", "e", "h", "k", "n"},  % Row 1
            {"c", "f", "i", "l", "o"}   % Row 2
        % getting information from the 2D array
        \foreach \i in {0,...,2}{%rows
            \foreach \j in {0, ..., 4}{%columns
                % The \pgfmathparse gets what is inside the cell at (i,j).
                % \pgfmathresult will output the result obtained previously.
                \draw[] (\j,-0.5-\i/2)node[]{\pgfmathparse{\ourInfo[\i][\j]}\pgfmathresult};
        % Taking care of the numbers above the horizontal line.
        \foreach \i in {0, ..., 4}{
            \draw(\i,0) -- (\i,0.25)node[yshift = 0.25cm]{\i};
        % Define a 1D array and use a foreach loop to place what it has.
        \def\innerData{{"", "abc", "xyz", "uvw"}}
        \foreach \i in {0, ..., 3}{
            \draw(\i+0.5,0) node[yshift = 0.5cm]{\pgfmathparse{\innerData[\i]}\small\pgfmathresult};
| improve this answer | |

I'd recommend TikZ as it has means to change all aspects of the appearance (arrow heads, line widths, line style, color, opacity) and has \foreach loops that help avoiding repetition and works with all standard compilers.

 \draw[-stealth] (0,0) -- (5,0);
 \draw foreach \X in {0,...,4} {(\X,0) -- ++ (0,0.2) node[above]{\X} };
 \foreach \X in {0,...,14}
 \node at ({int(\X/3)},{-0.45*(1+mod(\X,3))}) {\alph{pft}};}
 \foreach \X [count=\Z] in {abc,xyz,uvw}
 {\node[text depth=0.5ex] at (1.5+\Z,0.45){\X};}

enter image description here

| improve this answer | |

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.