0

Normally when one wishes to to plot some data from a file (.txt, .csv or the like), one would do something like

\documentclass[border=5mm]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
    \begin{axis}
        \addplot table {data.txt};
    \end{axis}
\end{tikzpicture}
\end{document}

and get something like enter image description here

Now, if instead my data was in a hdf5 file (say data.h5) with the x and y data in the fields /xdata and /ydata respectivly, is there any way for me to get the data out from LaTeX, or do i need a third party thing (like a script) to repackage the data?

Here data.txt was:

1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
  • A.h5 could hypothetically be anywhere in the real or unreal universe, it is a structure that is reputedly best accessed through h5py which states "You’ll need HDF5 installed, which can be a pain". IS there a reason you need some h5 output that is not in CSV or other two column export / expert ? format. – KJO Jan 10 at 15:20
  • Simply opening a.H5 could as with any portable document format like PDF contain any thing from textual columns or a a graph through media etc here starts an image.h5 ‰HDF ÿÿmÿÿˆ¨ˆ¨TREEÿÿÿÿ0HEAPX0Èimage8bitpaletteimage24bitpixel( (,,xXÀÔ™sN (CLASSIMAGE 0IMAGE_VERSION1.2SNOD ( ÐàH 8IMAGE_SUBCLASSIMAGE_INDEXED( Ý™sN (CLASSPALETTE 0 PAL_VERSION1.2 (PALETTEÐ 8•ã•ã}l˜ à]Œ™sN (CLASSIMAGE 0IMAGE_VERSION1.2 – KJO Jan 10 at 15:36
  • 2
    There is a Lua-library for reading HDF5 (colberg.org/lua-hdf5), perhaps you could use that with LuaTeX to access the data. – Torbjørn T. Jan 10 at 17:03
  • @KJO, The only reason is to skip conversion between the formats (so lazyness). And because it would be cool ;-) – Thorbjørn E. K. Christensen Jan 10 at 17:10
  • @TorbjørnT. Cool sstuff ;-) – Thorbjørn E. K. Christensen Jan 10 at 17:11

Your Answer

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

Browse other questions tagged or ask your own question.