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}
2
  • 1
    You have an extra ] after the xticklabels, so the options regarding the yticks are not considered. Commented Feb 22, 2017 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
    Commented Feb 22, 2017 at 20:26

1 Answer 1

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

You must log in to answer this question.

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