I'm trying to create a simple log-log plot with the following code:



        log basis x=10,
        log base 10 number format code/.code={$-10^{\pgfmathprintnumber{#1}}$},
        y dir=reverse,
        xmin=1e2, xmax=1e4,
%        xtick={1e2,1e3,1e4},
%        xticklabels={$10^2$, $10^3$, $n$},

\addplot [] table[x index=0,  y expr=-\thisrowno{1}, row sep=crcr]{%
260      -0.556631 \\
4110        -10.0369 \\

\addplot [] table[x index=0,  y expr=-\thisrowno{1}, row sep=crcr]{%
242    -1.76855 \\
3642        -11.456032992458257 \\


which produces the expected result:

enter image description here

The problem is that when I try to replace the right-most tick value of 10^4 with a symbol, all minor ticks disappear. I could use xlabel for this, but I would like to try this approach for consistency with other figures. Is there an alternative way to replace that right-most value with the symbol n?

  • You can use extra x ticks and extra x tick labels from tex.stackexchange.com/questions/123581/… together with xticklabels={,,} from tex.stackexchange.com/questions/6114/….
    – Marijn
    Jun 29, 2018 at 11:43
  • Do you mean left-most tick, or 10^4? Jun 29, 2018 at 11:46
  • Right-most... it's 10^4, I made a mistake.
    – aaragon
    Jun 29, 2018 at 11:47
  • 1
    Also simply removing log basis x=10 solves your problem. The root cause the trouble this line does is most likely an accuracy problem. When the distances between the ticks are not equidistant then the minor ticks are not drawn. Jul 2, 2018 at 19:06

1 Answer 1


The solution to my problem was finally to only use xticklabels={$10^2$, $10^3$, $n_d$}. For some reason, adding xtick interferes with the minor ticks in a log-log plot.

You must log in to answer this question.

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