修复并改进裁剪图表

修复并改进裁剪图表

我尝试绘制此图,并以不同的方式绘制;但是,当将其添加到我的书籍模板时,它会超出范围,因此我尝试显示一个独立的图,但它看起来被裁剪了。我该如何:

  1. 修复图表的裁剪
  2. 改进它,使它看起来更接近原版,或者目前是否可以接受?

原始图表 在此处输入图片描述

我的图表版本 在此处输入图片描述

我的代码

\documentclass[preview]{standalone}
\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions} 
\usetikzlibrary{arrows,quotes,calc,decorations.text,positioning} 
\begin{document}
    \begin{figure}[h]
        \centering
        \smartdiagramset{uniform color list=teal!60 for 7 items,
            module x sep=3.75,
            back arrow distance=0.75,
            sequence item border color=black,
            uniform arrow color=true,
            arrow color=gray!50!black,
            circular distance=5cm,
            font=\large,
            text width=2.5cm,
            module minimum width=2.5cm,
            module minimum height=1.5cm,
            arrow line width=2.5pt,
            arrow tip=to,
        } 
        \smartdiagramadd[circular diagram:clockwise]{
            Designing \& manufacturing,Distribution,Consumption \& Use,Disposal, Recycling,Raw material processing
        }
        {}
  
        \begin{tikzpicture}[overlay]
            \draw[stealth-,
            line width=1mm,
            red!40,
            dashed,
            postaction={decorate,
                decoration={text along path,
                    text align={left indent={.1\dimexpr\pgfdecoratedpathlength\relax}},
                    text={Landfill},
                    raise=5pt}}] 
            ([xshift=-4cm,yshift=-2cm]module5.south) to[out = 0, in = 270, looseness = 1.91] (module5.south);
            \draw[-stealth,
            line width=1mm,
            red!40,
            dashed,
            postaction={decorate,
                decoration={text along path,
                    text align=center,
                    text={Renewable resources},
                    raise=5pt}}] 
            (module5.south west) to[out = 225, in = 180, looseness = .975] (module6.west);
            \draw[stealth-,
            line width=1mm,
            red!40,
            dashed,
            postaction={decorate,
                decoration={text along path,
                    text align=center,
                    text={Non-renewable resources},
                    raise=5pt}}] 
            ([xshift=-6cm,yshift=-2cm]module1.south) to[out = 0, in = 180, looseness = 1.1] (module1.west);
            \draw[-stealth, %bend left=15
            line width=1mm,
            red!40,
            dashed,
            postaction={decorate,
                decoration={text along path,
                    text align=center,
                    text={Manufacture and refurbish},
                    raise=5pt}}] 
            ([xshift=.5cm]module5.north west) to[bend left=15,out = 105, in = 205, looseness = .75] ([xshift=.5cm]module2.south west);
    
            \draw[-stealth,
            line width=1mm,
            red!40,
            dashed,
            postaction={decorate,
                decoration={text along path,
                    text align=center,
                    text={Share},
                    raise=5pt}}] 
            (module3.south west) to[out = 225, in = 135, looseness = 4] (module3.north west);
            
            \draw[-stealth,
            line width=1mm,
            red!40,
            dashed,
            postaction={decorate,
                decoration={text along path,
                    text align={left indent={.45\dimexpr\pgfdecoratedpathlength\relax}},
                    text={Reuse and redistribute},
                    raise=5pt}}] 
            ([xshift=-.75cm]module3.south) to[out = 270, in = 240, looseness = 3] (module2.south);
                            
            \draw[stealth-,
            line width=1mm,
            red!40,
            dashed,
            postaction={decorate,
                decoration={text along path,
                    text align=center,
                    text={Repair product life extension},
                    raise=-15pt}}] 
            (module2.north east) to[out = 75, in = 315, looseness = 1.75] (module3.south east);
%           \draw[help lines, gray, dashed, step=1] (0,0) grid (14,12);
        \end{tikzpicture}  
    \end{figure}
\end{document}

答案1

这是一个使用 TikZ 几乎绘制原始图表的想法。

不幸的是,三角帽箭头没有实现double虽然我们可以用两条单独的路径来修改,但内部路径也用于text along path装饰

这使用一个循环,我们在每个项目中指定两个变量:它应该使用的角度和文本。角度总和应为 360。PGFMath 函数(但它们是常量)用于更改内箭头的半径或缩进。我对三角学不感兴趣R,所以请随意调整它们,以使箭头看起来不错。startIndtotalInd

对于圆形箭头之间的连接,我使用样式为每个圆弧插入坐标。虽然我们不用每个圆弧,但我们可以为每个圆弧分配 5 个或 10 个坐标,这是非常繁琐的输入。Arc coordinates i

举个例子,我建立了一个从 Disposal 到 Design & Manfacturing 的连接。按照预览中的方式进行连接并不简单,因为它覆盖了目标,并使用了一个非常特殊的箭头尖,而这在普通的 TikZ 中是没有的(但使用harpoonedTriangle尖头可能会有)。

代码

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows.meta, backgrounds, bending, decorations.text, quotes}
\begin{document}
\begin{tikzpicture}[
  Every Arc/.style={
    arrows=[bend], Triangle Cap[reversed]-Triangle Cap},
  every Arc/.style ={Every Arc, line width=10mm},
  every Arc'/.style={
    Every Arc, line width=9mm,
    /utils/exec=\pgfmathsetmacro\c{#1/10*100+20}, draw=white!\c!black},
  text decoration/.style={decoration={
      name = text along path, text={#1}, raise=-.35em, text align={align=center}}},
  decoration={text color=white},
  Arc 1'/.style={decoration=reverse path},
  Arc 2'/.style={decoration=reverse path},
  Arc 6'/.style={decoration={reverse path, text color=black}},
  declare function={R=5; startInd = 1.5; totalInd = 2.5;},
  radius = R,
  Arc coordinates 1/.style={insert path={coordinate[midway] (Arc-1)}},
  Arc coordinates 4/.style={insert path={coordinate[near end] (Arc-4)}},
]
\sffamily
\foreach[
  count=\i from 1,
  remember=\ARC as \prevARC (initially 290),
  ] \ARC/\TEXT in {
  40/DISPOSAL,
  45/RECYCLING,
  80/RAW MATERIAL PROCESSING,
  75/DESIGN {\&} MANUFACTURING,
  45/DISTRIBUTION,
  75/CONSUMPTION {\&} USE}{
  \draw[every Arc=\i, Arc \i/.try]   (\prevARC         :R) arc [start angle=\prevARC,          delta angle=-\ARC         ];
  \draw[every Arc'=\i, Arc \i'/.try] (\prevARC-startInd:R) arc [start angle=\prevARC-startInd, delta angle=-\ARC+totalInd]
    [sloped, allow upside down, nodes={yshift=+-5mm}, Arc coordinates \i/.try]
    [postaction=decorate, text decoration/.expand once=\TEXT];
  \pgfmathsetmacro\ARC{\prevARC+-\ARC}
}
\scoped[
  on background layer,
  every edge/.append style={line width=4mm, line cap=rect, postaction=decorate},
  arrows={-Triangle Cap[cap angle=30, sep=+1mm, bend]},
  edge quotes mean={text decoration={#1}}
] \small
  \path (Arc-1) edge[bend left=60, "remanufacture {\&} refurbish"] (Arc-4)
;
\end{tikzpicture}
\end{document}

输出

在此处输入图片描述

答案2

在此处输入图片描述

我的代码

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows.meta, backgrounds, bending, decorations.text, quotes}
\begin{document}
\definecolor{vcolor}{rgb}{0,0.5,0}
\begin{tikzpicture}[
    Every Arc/.style={
        arrows=[bend], Triangle Cap[reversed]-Triangle Cap},
    every Arc/.style ={Every Arc, line width=10mm},
    every Arc'/.style={
        Every Arc, line width=9mm,
        /utils/exec=\pgfmathsetmacro\c{#1/10*100+20}, draw=green!\c!blue},
    text decoration/.style={decoration={
            name = text along path, text={#1}, raise=-.35em, text align={align=center}}},
    decoration={text color=white},
    Arc 1'/.style={decoration=reverse path},
    Arc 2'/.style={decoration=reverse path},
    Arc 6'/.style={decoration={reverse path, text color=black}},
    declare function={R=5; startInd = 1.5; totalInd = 2.5;},
    radius = R,
    Arc coordinates 1/.style={insert path={coordinate[midway] (Arc-1)}},
    Arc coordinates 2/.style={insert path={coordinate[pos=.2] (Arc-2)}},
    Arc coordinates 3/.style={insert path={coordinate[pos=.8] (Arc-3)}},
    Arc coordinates 4/.style={insert path={coordinate[near end] (Arc-4)}},
    Arc coordinates 5/.style={insert path={coordinate[near end] (Arc-5)}},
    Arc coordinates 6/.style={insert path={coordinate[near end] (Arc-6)}},
    ]
    
    \draw[-stealth,
    line width=1mm,
    vcolor,
    dashed,
    postaction={decorate,
        decoration={text along path,
            text align={center},text color=black,
            text={Renewable resources},
            raise=5pt}}] 
    (-4,-3.8) to[out = 225, in = 135, looseness = 2] (-5.1,2);
    \draw[-stealth,
    line width=1mm,
    vcolor,
    dashed,
    postaction={decorate,
        decoration={text along path,
            text align=center,,text color=black,
            text={Renewable resources},
            raise=5pt}}] 
    (2.1,-3.9) to[out = 150, in = 180, looseness = 1.25] (4.3,1.2);
    \draw[-stealth,
    line width=1mm,
    vcolor,
    dashed,
    postaction={decorate,
        decoration={text along path,
            text align=center,,text color=black,
            text={Repair product life extension},
            raise=5pt}}] 
    (2.5,-3.75) to[out = 150, in = 165, looseness = 1.25] (4.5,-.1);
    \draw[-stealth,
    line width=1mm,
    vcolor,
    dashed,
    postaction={decorate,
        decoration={text along path,
            text align=center,,text color=black,
            text={Share},
            raise=5pt}}] 
    (2.75,-3.5) to[out = 150, in = 150, looseness = .875] (4.35,-1.1);
    \draw[-stealth,
    line width=1mm,
    vcolor,
    dashed,
    postaction={decorate,
        decoration={text along path,
            text align=center,,text color=black,
            text={Manufacture and refurbish},
            raise=5pt}}] 
    (0,-4.425) to[out = 135, in = 200, looseness = 1.02] (1,4.4);
    \draw[stealth-,
    line width=1mm,
    vcolor,
    dashed,
    postaction={decorate,
        decoration={text along path,
            text align=center,,text color=black,
            text={Landfill},
            raise=5pt}}] 
    (-6,-6) to[out = 5, in = 200, looseness = 1.502] (-3,-4.5);
    \draw[stealth-,
    line width=1mm,
    vcolor,
    dashed,
    postaction={decorate,
        decoration={text along path,
            text align=center,,text color=black,
            text={Non-renewable resources},
            raise=5pt}}] 
    (-7.5,6) to[out = 5, in = 180, looseness = 1.50] (-3.75,4);
            \draw[step=1.0,black,thin] (-8,-8) grid (8,8);
    \sffamily
    \foreach[
    count=\i from 1,
    remember=\ARC as \prevARC (initially 290),
    ] \ARC/\TEXT in {
        40/DISPOSAL,
        45/RECYCLING,
        80/RAW MATERIAL PROCESSING,
        75/DESIGN {\&} MANUFACTURING,
        45/DISTRIBUTION,
        75/CONSUMPTION {\&} USE}{
        \draw[every Arc=\i, Arc \i/.try]   (\prevARC         :R) arc [start angle=\prevARC,          delta angle=-\ARC         ];
        \draw[every Arc'=\i, Arc \i'/.try] (\prevARC-startInd:R) arc [start angle=\prevARC-startInd, delta angle=-\ARC+totalInd]
        [sloped, allow upside down, nodes={yshift=+-5mm}, Arc coordinates \i/.try]
        [postaction=decorate, text decoration/.expand once=\TEXT];
        \pgfmathsetmacro\ARC{\prevARC+-\ARC}
    }
\end{tikzpicture}

\end{document}

答案3

以下答案使用轮图包,是我写的。

弧线中的文本被赋予键。此文本的方向取决于键中使用的arc data弧线中间的角度。此文本以 为弧线的中心。\WCmidanglearc data dirarc data pos=0.5

用键获得弧之间的间隙gap

箭是用钥匙获得的slices arrow

箭头的长度取决于使用键的文本的宽度value=width("\WCvarA")

在此处输入图片描述

\documentclass[border=6pt]{standalone}
\usepackage{wheelchart}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}
\sffamily
\wheelchart[
  arc data=\WCvarA,
  arc data angle shift=6,
  arc data dir={\WCmidangle<180?1:-1},
  arc data pos=0.5,
  arc data style={text color=white},
  data=,
  gap,
  radius={3}{4},
  slices arrow={1}{0},
  slices style={
    fill=white!\fpeval{(\WCcount/\WCtotalcount)*70}!black,
    draw=black
  },
  start angle=-75,
  value=width("\WCvarA")
]{%
  Disposal,
  Recycling,
  Raw material processing,
  Design {\&} manufacturing,
  Distribution,
  Consumption {\&} Use%
}
\end{tikzpicture}
\end{document}

相关内容