Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

in the code below, two things should be modified:

  1. xlabels and xgrid should appear for x=10^-0.1, x=10^0 and x=10^0.1 only
  2. the grid along the x-axis should reflect the logarithmic scale (ie, not constant) with the major grid for the values listed above only

MWE:

\documentclass[12pt]{book}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.3,width=10cm}
\pgfkeys{/pgf/number format/.cd,set decimal separator={,}}
\begin{document}
\begin{tikzpicture}
\begin{semilogxaxis}[grid=both,enlarge x limits=false,scale only axis,width=8.5cm,height=6cm,ymin=1,ymax=1.5,tick style={draw=none}]
\addplot[color=black,mark=*,mark size=1pt]
coordinates{(0.666667,1.21982)(1.49206,1.19949)};
\end{semilogxaxis}
\end{tikzpicture}
\end{document}
share|improve this question

1 Answer 1

up vote 3 down vote accepted

I think the option xtickten={-0.1,0,0.1} does what you want for both, (1.) and (2.): it displays only the tick positions 10^-0.1, 10^0 and 10^0.1 and it only displays these grid lines.

Note that the grid should respect the logarithmic scale in any case (and it does so for -0.1, 0, and 0.1).

share|improve this answer
    
thanks it helps but it does not show the thin lines of the minor grid. How can I add them? –  pluton Aug 7 '11 at 4:22
    
By default, pgfplots generates minor logarithmic grids only if the major ticks are of type j*10^j. Try out the minor xtick={<positions>} feature to provide some manually (requires a recent version I believe). Providing only the exponents base ten (like xtickten) is not possible here, however. –  Christian Feuersänger Aug 7 '11 at 13:12
    
ok thanks. Will a new version of pfgplots handle logarithmic minor grid whatever the major scale is? –  pluton Aug 7 '11 at 14:11
    
Such a feature is not yet planned. –  Christian Feuersänger Aug 10 '11 at 17:42
    
alright. Maybe in a more long term future then. –  pluton Aug 10 '11 at 17:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.