TransWikia.com

PGFPlots: semilogxaxis and y axis tick marks

TeX - LaTeX Asked on July 30, 2021

I am trying to set up a semilogxaxis in pgfplots. The image I am trying to generate is
enter image description here
but my code below is generating
enter image description here

documentclass[tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat = 1.9}

begin{document}
begin{tikzpicture}
  begin{semilogxaxis}[
    ylabel = Gain db,
    xlabel = Frequency Hz,
    ytick = {0, 100},
    xtickten = {2, 3, 4, 5, 6}]
  end{semilogxaxis}
end{tikzpicture}
end{document}

One Answer

Is it this, what you are looking for?

Disclaimer: I'm a newbie with pgfplots.

documentclass[tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat = 1.9}
begin{document}
begin{tikzpicture}
    begin{semilogxaxis}[
            axis x line=center,
            axis y line=left,
            xmajorgrids=true,
            xlabel style={below=3ex},
            enlarge x limits,
            ymax = 150,
            ytick = {100},
            ylabel = Gain db,
            xlabel = Frequency Hz,
        ]
        addplot coordinates {(1e2,100) (1e3,100) (1e4,80) (1e5,20) (1e6,0)};
        node[above] at (axis cs:5e3,90) {$-6$};
        node[above] at (axis cs:5e4,50) {$-12$};
        node[above] at (axis cs:5e5,10) {$-6$};
    end{semilogxaxis}
end{tikzpicture}
end{document}

enter image description here

Correct answer by Henri Menke on July 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP