loglogaxis 和 semilogyaxis 中的 ytick 列表

loglogaxis 和 semilogyaxis 中的 ytick 列表

我如何指定刻度和刻度标签列表,loglogaxis或者semilogyaxis不明确写出所有列表,而是使用,...,表单?例如,我想更改以下代码

\nextgroupplot[ymin=1e-15,ymax=1e10,ytick={1e-15,1e-10,1e-5,1e0,1e5,1e10},ymode=log]
   \addplot table[x=x,y=y] {data.dat};

例如

\nextgroupplot[ymin=1e-15,ymax=1e0,ytick={1e-15,...,1e10},ymode=log]
   \addplot table[x=x,y=y] {data.dat};

是否可以?

希望以下 MWE 足够了。我没有替换 try,因为它不起作用。

\documentclass[a4paper,11pt]{book}

\usepackage{xcolor}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{geometry}
\usepackage{bm}
\usepackage[super]{nth}
\usepackage{calc}
\usepackage{tikz}
%\usepackage{pbox}
\usetikzlibrary{calc,decorations,patterns,shapes.arrows}
\usepackage{mathtools}
\usepackage{tikzscale}
\usepackage{pgfplots}
\pgfplotscreateplotcyclelist{rgblist}{%
{red,mark=*},
{green,mark=square*},
{blue,mark=triangle*}}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{groupplots}
%\pgfplotsset{compat=1.12,
             %width=0.5\textwidth-0*\tabcolsep, % <--- new,
             %height=0.5\textwidth-0*\tabcolsep%,% common for all tikz pictures
%every axis plot/.append style={line width=1pt}
            %}
\usepackage[font=small,
            format=hang,
            labelfont={sf,bf},
            tableposition=top,
            figureposition=bottom]{caption}

\newcommand{\mat}{\mathbf}
\renewcommand{\vec}{\bm}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert} % norma

\begin{document}

\begin{figure}[p]
%\rule{\textwidth}{1pt}\\[1ex]% only for show, that the images fit to width of text
    \centering
   \begin{tikzpicture}
      \pgfplotsset{every tick label/.append style={
                     /pgf/number format/precision=2,
                     /pgf/number format/fixed,
                     /pgf/number format/fixed zerofill
                  },
                  log plot exponent style/.style={
                     %/pgf/number format/sci zerofill,
                     /pgf/number format/precision=0
                  }}
      \begin{semilogyaxis}[title=Dissipation,
         xmin=.5,xmax=4.5,
         xtick={1,...,4},%xlabel=\empty,xticklabels=\empty,
         ymin=1e-15,ymax=1e0,ytick={1e-10,1e-5,1e0},ymode=log,
         %scaled y ticks={base 10:2},tick scale binop=\times,
         yticklabel pos=right,
         trim axis right]
            \addplot table[x=method,y=IV1im] {immagini/data/confronti.dat};
            \addplot table[x=method,y=IV2im] {immagini/data/confronti.dat};
            \addplot table[x=method,y=IV3im] {immagini/data/confronti.dat};
      \end{semilogyaxis}
   \end{tikzpicture}

    \caption{$\Re(w') = 1.5$ wavenumber $3.0$ modified wavenumber modified wavenumber modified wavenumber modified wavenumber modified wavenumber modified wavenumber modified wavenumber modified wavenumber}
    \label{fig:re-im_1-3}
\end{figure}


\end{document}

答案1

使用ytick和指数e符号时,您不能使用...快捷方式。但是,您可以使用ytickten,例如

         ytickten={-15,...,8},

这相当于指定ytick为列表1e-15,1e-14,...,1e+8

由于我没有您的数据表,我使用了一些随机坐标并稍微修改了示例的原始轴设置:

\documentclass[a4paper,11pt]{book}
\usepackage{pgfplots}

\pgfplotscreateplotcyclelist{rgblist}{%
{red,mark=*},
{green,mark=square*},
{blue,mark=triangle*}}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{groupplots}


\begin{document}

\begin{tikzpicture}
      \pgfplotsset{every tick label/.append style={
                     /pgf/number format/precision=2,
                     /pgf/number format/fixed,
                     /pgf/number format/fixed zerofill
                  },
                  log plot exponent style/.style={
                     %/pgf/number format/sci zerofill,
                     /pgf/number format/precision=0
                  }}
      \begin{semilogyaxis}[title=Dissipation,
         xmin=-.5,xmax=13.5,
         xtick=data,%xlabel=\empty,xticklabels=\empty,
         ytickten={-15,...,8},
         ymode=log,
         height=13cm,
         %scaled y ticks={base 10:2},tick scale binop=\times,
         yticklabel pos=right,
         trim axis right]
\addplot coordinates {(0,1e-15) (3,1e-12) (5,1e-9) (8,1e-5) (10,1e0) (12,1e5) (14,1e7)};
\end{semilogyaxis}
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容