3

I have this code:

\begin{tikzpicture}[declare function={unipdf(\x,\xl,\xu)= (\x>\xl)*(\x<\xu)*1/(\xu-\xl);}]
    \begin{axis}[
        samples=100,
        const plot mark mid,
        scaled ticks = false,
        ymin=0,ymax=0.5,
        xmin=-3,xmax=3,
        xtick={-2,2},
        xticklabels={-$\frac{LSB}{2}$,$\frac{LSB}{2}$}],
        ytick={0.25},
        yticklabels={$\frac{1}{LSB}$}]
        \addplot [very thick, orange] {unipdf(x,-2,2)};
    \end{axis}
\end{tikzpicture}

Now this works all fine except that the y-label is not positioned correctly (always at 0) and that there is several other y-ticks:

error probability density function

Is there a particular reason for this behavior or is it just a bug?

I use the following packages:

\documentclass[10pt,landscape]{article}
\usepackage{multicol}
\usepackage{calc}
\usepackage{ifthen}
\usepackage[landscape]{geometry}
\usepackage{hyperref}

\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{arrows}
\usepackage{float}
\usetikzlibrary{shapes}
\usetikzlibrary{intersections}
\usepackage{circuitikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\usepackage{graphicx}
  • 1
    You have an extra ] after the xticklabels, so the options regarding the yticks are not considered. – Torbjørn T. Feb 22 '17 at 20:16
  • ohwow thank you very much! It didn't complain about the syntax so I would have never thought that there could be a syntax related issue :S – Yatekii Feb 22 '17 at 20:26
1

Torbjørn T. answered this pretty quick:

You have an extra ] after the xticklabels, so the options regarding the yticks are not considered.

Sadly pdflatex didn't complain about that issue so I would have never suspected a syntax issue ...

|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.