4

The datavisualization library in PGF/TikZ has many capabilities, but one thing I cannot find is how to remove ticks labels, keeping ticks themselves.

The scientific axes use such style (by default) for top and right axis.


For example, I would like to keep ticks, but remove labels in the following plot:

\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{datavisualization}
\begin{document}
\begin{tikzpicture}
 \datavisualization 
  [scientific axes,visualize as line]
  data {
    x, y
    0, 7
    3, 6
    7, 0
  };
\end{tikzpicture}
\end{document}

https://www.overleaf.com/read/dztjfngnczmf


A similar question, but for pgfplots library Hide tick numbers in a TikZ/PGF axis environment.

2
  • Could you post a compilable sample of an image where you'd want to have this illustrated? Then we don't have to write up our own if we want to test a solution before posting it
    – sheß
    May 19, 2016 at 22:47
  • 1
    @sheß: I hope this example helps May 19, 2016 at 23:25

1 Answer 1

5

One somewhat hacky version, simply not typesetting the labels:

\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{datavisualization}
\begin{document}
 \begin{tikzpicture}
  \datavisualization 
  [scientific axes,visualize as line, all axes={ticks={tick typesetter/.code=}}]
  data {
    x, y
    0, 7
    3, 6
    7, 0
  };
 \end{tikzpicture}
\end{document}

An alternative solution that instead of using major ticks uses only minor ticks, which do not have labels:

\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{datavisualization}
\begin{document}

\begin{tikzpicture}
 \datavisualization 
  [scientific axes,visualize as line, all axes={ticks={major={at={}}, minor={at={0,1, 2, 3, 4, 5,6,7}}}}]
  data {
    x, y
    0, 7
    3, 6
    7, 0
  };
\end{tikzpicture}
\end{document}

You might find more inspiration in section 77 of the PGF manual http://ctan.space-pro.be/tex-archive/graphics/pgf/base/doc/pgfmanual.pdf

1
  • I was hoping I could simply put no tick text somewhere, but it looks like it is good only for suppressing labels for extraordinary ticks... May 20, 2016 at 17:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .