并排添加 tikzpictures 并将形状添加到终端节点而不是文本

并排添加 tikzpictures 并将形状添加到终端节点而不是文本

我有这个散点图:

在此处输入图片描述

我想在它旁边添加一个有向图/小决策树,类似于下面的例子。

在此处输入图片描述

我还可以创建一棵决策树。

在此处输入图片描述

我想将它们并排添加,这样我就可以添加更多情节。

我不需要我的图与给出的示例完全匹配,只需要如何将它们加在一起,这样我就可以拥有iteration 1,,iteration 2......,iteration N并将形状添加到终端节点 - 只是不确定如何获得一个工作版本,我试过了,minipage但我知道它会是更好的将它们包含在一个中tikzpicture,使用\begin{groupplot}?。

乳胶

\documentclass[]{article}

\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{plotmarks}
\usepackage{graphicx}
\usepgfplotslibrary{groupplots}

\definecolor{babyblue}{rgb}{0.54, 0.81, 0.94}
\definecolor{bubblegum}{rgb}{0.99, 0.76, 0.8}


%%%% decision tree

\usepackage{array}
%\usepackage{subfig}
%\usepackage{tikz}

\usetikzlibrary{arrows,
                patterns,positioning,
                shadows,shapes,
                trees}
\definecolor{blue1}{HTML}{0081FF}
\definecolor{grey1}{HTML}{B0B0B0}

\begin{document}


% plot 1: base plot
\begin{tikzpicture}[scale=0.40]
  \pgfplotsset{
      scale only axis,
  }
  \begin{axis}[
    %xlabel=$A$,
    %ylabel=$B$,
    ticks=none,
  ]

    \addplot[only marks, mark=+, mark size=8pt, thin, color = blue]
    coordinates{ % + data
      (0.05,0.50)
      (0.10,0.15)
      (0.30,0.85)
      (0.45, 0.95)
      (0.60, 0.75)
    }; %\label{plot_one}
    \addplot[only marks, mark=-, mark size=8pt, thin, color = red]
    coordinates{ % + data
      (0.20,0.05)
      (0.25,0.60)
      (0.55,0.40)
      (0.90, 0.85)
      (0.90, 0.15)
    }; 
    
        \path[name path = begin_left_shade_path_4] (axis cs:1.0, 0.7) -- (axis cs:0.0, 0.7);
    \path[name path = end_left_shade_path_4] (axis cs:1.0, 0.0) -- (axis cs:0.0, 0.0);
    \addplot [bubblegum] fill between[of = begin_left_shade_path_4 and end_left_shade_path_4, soft clip = {domain=0.0:0.95}];
    
    \path[name path = begin_left_shade_path_2] (axis cs:0.0, 1.0) -- (axis cs:1.0, 1.0);
    \path[name path = end_left_shade_path_2] (axis cs:0.0, 0.70) -- (axis cs:1.0, 0.70);
    \addplot [babyblue] fill between[of = begin_left_shade_path_2 and end_left_shade_path_2, soft clip = {domain=0.0:0.95}];
    
  \end{axis}
\end{tikzpicture}





\begin{tikzpicture}[->,>=stealth',
            level/.style={sibling distance = 5cm/#1, level distance = 2cm},
            basic/.style={draw, text width=2cm, drop shadow, font=\sffamily, rectangle},
            split/.style={basic, rounded corners=2pt, thin, align=center, fill=blue1},
            leaf/.default = red,
            leaf/.style={basic, rounded corners=6pt, thin,align=center, fill=#1, text width=1cm}] 
        \node [split] {$x_1<0.75$}
            child{ node [split] {$x_2<1.25$} 
            %child{ node [leaf] {$\omega_{01}$} edge from parent node[above right] {$yes$}}                      
            edge from parent node[above left] {$no$}}
            child{ node [split] {$x_2<1.25$}};
\end{tikzpicture}


\end{document}

相关内容