在 TikZ 数据可视化中自定义单个刻度

在 TikZ 数据可视化中自定义单个刻度

这个问题是我其他问题

梅威瑟:

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{datavisualization.formats.functions}
\begin{document}

  \begin{tikzpicture}
    \datavisualization[
                       scientific axes = {clean},
                       x axis = {
                                 include value = 0,
                                 ticks={
                                        step = 500,
                                        minor steps between steps = 4,
                                        stack
                                       }
                                },
                       y axis = {
                                 include value = .2,
                                 ticks = {
                                          step = .02,
                                          minor steps between steps = 1,
                                          style = {
                                                   /pgf/number format/fixed, % rounds the number to ''precision''
                                                   /pgf/number format/fixed zerofill, % fills the number up to ''precision''
                                                   /pgf/number format/precision = 2
                                                  }
                                         }
                                },
                       visualize as smooth line
                      ]
    data[format = function] {
                             var x : interval[100 : 3500];
                             func y = .2 * ( 1 - exp( - (\value x - 100) / 606) );
                            };
  \end{tikzpicture}

\end{document}

结果:

结果

希望的结果:

希望

修改后的刻度应该具有相同的字体大小,并且不应该是粗体(图片有点不清楚)。

提前感谢您的帮助和努力!

答案1

您只需要删除/pgf/number format/fixed zerofill。如果您希望刻度像屏幕截图中那样左对齐,您可以添加node style={align=left,text width=6mm}

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{datavisualization.formats.functions}
\begin{document}

  \begin{tikzpicture}
    \datavisualization[
                       scientific axes = {clean},
                       x axis = {
                                 include value = 0,
                                 ticks={
                                        step = 500,
                                        minor steps between steps = 4,
                                        stack
                                       }
                                },
                       y axis = {
                                 include value = .2,
                                 ticks = {
                                          step = .02,
                                          minor steps between steps = 1,
                                          style = {
                                                   /pgf/number format/fixed, % rounds the number to ''precision''
                                                   %/pgf/number format/fixed zerofill, % fills the number up to ''precision''
                                                   /pgf/number format/precision=2,
                                                  },
                                         node style={align=left,text width=6mm}
                                         }
                                },
                       visualize as smooth line
                      ]
    data[format = function] {
                             var x : interval[100 : 3500];
                             func y = .2 * ( 1 - exp( - (\value x - 100) / 606) );
                            };
  \end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容