如何使用 TikZ 数据可视化重新绘制图表?

如何使用 TikZ 数据可视化重新绘制图表?

原图:

原来的

我的尝试:

\documentclass{scrartcl}
\usepackage{
            tikz,
            amsmath
           }

\usetikzlibrary{datavisualization.formats.functions}

\begin{document}

  \begin{tikzpicture}

    \datavisualization[
                       scientific axes = {clean,
                                          standard labels
                                         },
                       x axis = {
                                 include value = {
                                                  0.35,
                                                  2.15
                                                 },
                                 grid = {minor = {at = {
                                                        1,
                                                        1.5
                                                       }}},
                                 label = $t$
                                },
                       y axis = {
                                 include value = {
                                                  -.25,
                                                  1
                                                 },
                                 label = Schadstoffkonzentration
                                },
                       data/format = function,
                       visualize as smooth line/.list = {
                                                         HC,
                                                         CO,
                                                         NO_x
                                                        },
                       style sheet = vary dashing,
                       HC = {label in legend = {text = HC}},
                       CO = {label in legend = {text = CO}},
                       NO_x = {label in legend = {text = NO$_{\text x}$}}
                      ]
    data[set = HC] {
                    var x : interval[.5:2];
                    func y = exp(-3 * \value x) + .15;
                   }
    data[set = CO] {
                    var x : interval[.5:2];
                    func y = exp(-\value x) + .15;}
    data[set = NO_x] {
                      var x : interval[.75:2];
                      func y = ln(\value x) + .15;
                     }
    info {
          \draw
            (visualization cs: x = 1.25, y = .8) node {schadstoffarme Verbrennung};
         };

  \end{tikzpicture}

\end{document}

给出:

结果 任务:

  1. 彻底清除蜱虫。
  2. 完善信息。
  3. 也许对整个代码进行一些优化。

像这样:

希望

也欢迎解决整个任务的完全不同的解决方案!

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

答案1

好的,第一个任务很简单,只需添加ticks=none。对于其他任务,我有一些简单的建议,但我很乐意回复反馈。你应该和@CarLaTeX 谈谈,他有一个真的高效的汽车。;-)

\documentclass{scrartcl}
\usepackage{
            tikz,
            amsmath
           }

\usetikzlibrary{datavisualization.formats.functions}

\begin{document}

  \begin{tikzpicture}

    \datavisualization[
                       scientific axes = {clean,
                                          standard labels
                                         },
                       x axis = {
                                 include value = {
                                                  0.35,
                                                  2.15
                                                 },
                                 grid = {minor = {at = {
                                                        1,
                                                        1.5
                                                       }}},
                                 label = $t$,
                                 ticks=none %<-added
                                },
                       y axis = {
                                 include value = {
                                                  -.25,
                                                  1
                                                 },
                                 label = Schadstoffkonzentration,
                                 ticks=none %<-added
                                },
                       data/format = function,
                       visualize as smooth line/.list = {
                                                         HC,
                                                         CO,
                                                         NO_x
                                                        },
                       style sheet = vary dashing,
                       HC = {label in legend = {text = HC}},
                       CO = {label in legend = {text = CO}},
                       NO_x = {label in legend = {text = NO$_{\text x}$}}
                      ]
    data[set = HC] {
                    var x : interval[.5:2];
                    func y = exp(-3 * \value x) + .15;
                   }
    data[set = CO] {
                    var x : interval[.5:2];
                    func y = exp(-\value x) + .15;}
    data[set = NO_x] {
                      var x : interval[.75:2];
                      func y = ln(\value x) + .15;
                     }
    info {
          \draw
            (visualization cs: x = 1.25, y = 1.1) node[font=\small] {schadstoffarme Verbrennung};
         };

  \end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容