1

I have a set of data with small variations that I am trying to plot using pfgplots. I am currently using

\begin{tikzpicture}
\begin{axis}[
    xlabel={$x$},
    ylabel={$y$}
    ]
\addplot table {
    0 1.0000018
    1 1.0000056
    2 1.0000020
    3 1.0000071
};
\end{tikzpicture}

I would like the amplitude of the variation to be visible.

I have seen this question, but I would rather not have to rescale the calculation or set the minimal and maximal values "by hand", since I have several such plots with different ranges and different amplitudes.

The Python matplotlib.pyplot.plot function does this automatically and indicates +1.0e0 at the top of the y axis. Is there a way of getting a similar result with pgf?

1

Unfortunately this seems to be beyond (La)TeX's numeric capabilities. But if you are willing to use LuaLaTeX you could do ...

% used PGFPlots v1.14
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
    \pgfplotsset{
        % use this `compat' level or higher
        % AND use LuaLaTeX to use PGFPlots lua capabilities
        compat=1.12,
    }
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        xlabel={$x$},
        ylabel={$y$},
        % ---------------------------------------------------------------------
        % either show more digits of the numbers ...
        yticklabel style={
            /pgf/number format/.cd,
                fixed,
                fixed zerofill,
                precision=7,
        },
        % ---------------------------------------------------------------------
%        % ... and/or shift the values by using the "scale" feature
%        scaled y ticks=manual:{$+1$}{%
%            \pgfmathparse{#1-1}%
%        },
        % ---------------------------------------------------------------------
    ]
        \addplot table {
            0 1.0000018
            1 1.0000056
            2 1.0000020
            3 1.0000071
        };
    \end{axis}
\end{tikzpicture}
\end{document}

image showing the result of above code

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.