“填充之间”区域之间存在不需要的线

“填充之间”区域之间存在不需要的线

我正在尝试制作这个情节:

在此处输入图片描述

如您所见,我在右侧遇到了麻烦。我想让彩色区域在右侧柔和地消失。为了实现这一点,我为每种颜色定义了两个区域。在较大的(左侧)区域上,我只是使用经典的“填充之间”,然后在其右侧连续添加一个小区域,我再次使用“填充之间”,但使用“左侧颜色”和“右侧颜色”选项。

但碰巧出现了与进行颜色转换的第二个定义区域接壤的灰色垂直线......我不明白我做错了什么。

任何想法?

提前致谢!

\documentclass{standalone}
\usepackage[american,cuteinductors,smartlabels]{circuitikz}
\tikzstyle{every path}=[line width=0.8pt,line cap=round,line join=round]
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{fillbetween}
\newcommand*{\rom}[1]{\expandafter\@slowromancap\romannumeral #1@}

\begin{document}
\begin{tikzpicture}

\newcommand{\degPunit}{20}

% AXIS
\draw[thin, ->] (-.2,0) -- (12,0) node[right] {$D$};
\draw[thin, ->] (0,-.2) -- (0,10) node[above] {$\alpha$ (deg)};

% TICKS
\draw[very thin] (1,0) -- ++(0,-.1) node[below] {$1$};
\draw[very thin] (2,0) -- ++(0,-.1) node[below] {$2$};
\draw[very thin] (3,0) -- ++(0,-.1) node[below] {$3$};
\draw[very thin] (4,0) -- ++(0,-.1) node[below] {$4$};
\draw[very thin] (5,0) -- ++(0,-.1) node[below] {$5$};
\draw[very thin] (6,0) -- ++(0,-.1) node[below] {$6$};
\draw[very thin] (7,0) -- ++(0,-.1) node[below] {$7$};
\draw[very thin] (8,0) -- ++(0,-.1) node[below] {$8$};
\draw[very thin] (9,0) -- ++(0,-.1) node[below] {$9$};
\draw[very thin] (10,0) -- ++(0,-.1) node[below] {$10$};
\draw[very thin] (11,0) -- ++(0,-.1) node[below] {$11$};

\draw[very thin] (0,180/20) -- ++(-.1,0) node[left] {$180$};
\draw[very thin] (0,150/20) -- ++(-.1,0) node[left] {$150$};
\draw[very thin] (0,120/20) -- ++(-.1,0) node[left] {$120$};
\draw[very thin] (0,90/20) -- ++(-.1,0) node[left] {$90$};
\draw[very thin] (0,60/20) -- ++(-.1,0) node[left] {$60$};
\draw[very thin] (0,30/20) -- ++(-.1,0) node[left] {$30$};
    
\node[below] at (.1,-.1) {\mbox{$0$}};
\node[left] at (-.1,0) {\mbox{$0$}};
                        

% AUX LINES 
\draw[dotted,color=gray] (0,9) -- (12,9);
\draw[dotted,color=gray] (1,0) -- (1,10);
    
% GRAPHS
\draw[name path=A1, color=black, samples = 200, domain=(1:11)] plot (\x,{acos(2/\x -1)/\degPunit});    
\draw[name path=A2, dashed ,color=black, samples = 200, domain=(11:11.5)] plot (\x,{acos(2/\x -1)/\degPunit});    

\node[right] at (11.5,7.3) {$\alpha^* (D)$};

\draw[name path=B1, color=gray, dashed, samples = 200, domain=(1:11.5)] plot (\x,{acos(1/\x)/\degPunit}); 
\node[right] at (11.5,4.3) {$\alpha (P = 0)$};
\node[right] at (7,5.5) {$\alpha (P > 0)$};
\node[right] at (7,2.2) {$\alpha (P < 0)$};


% COLORED REGIONS

\path[name path=X1, samples = 200, domain=(1:11)] plot (\x,0);  
\path[name path=X2, samples = 20, domain=(11:11.5)] plot (\x,0);    

\path[name path=C, samples = 200, domain=(11:11.5)] plot (\x,0);    


\begin{axis}[
axis lines = none,
xmin=0, xmax=12,
ymin=0, ymax=10,
width = 13.55cm,
height = 11.58cm]
\addplot[fill=green!20,draw = none] fill between[of=A1 and X1];
\addplot [name path=Y, draw = none]    
table[row sep=crcr]{%
0   0\\
0   9\\
};
\addplot [name path=D1, draw = none]
  table[row sep=crcr]{%
1   0\\
1   9\\
};
\addplot[fill=red!40,draw = none] fill between[of=Y and D1];

\addplot [name path=X180, draw = none]
  table[row sep=crcr]{%
1   9\\
11  9\\
};
\addplot [name path=X1802, draw = none]
  table[row sep=crcr]{%
11  9\\
11.5    9\\
};
\addplot[fill=red!20,draw = none] fill between[of=X180 and A1];

\addplot[draw = none, left color=red!20, right color=white] fill between[of=X1802 and A2];

\addplot[draw = none, left color=green!20, right color=green!0 ] fill between[of=A2 and X2];

\end{axis}

\node[right] at (.3,8) {\rom{1}};
\node[right] at (10,8) {\rom{2}};
\node[right] at (10,6) {\rom{3}};



% MARKS

\draw[dotted,color=gray] (2.4,0) -- (2.4,6);
\draw[dotted,color=gray] (0,3) -- (2.4,3);
\draw[dotted,color=gray] (0,6) -- (2.4,6);
\draw[dotted,color=gray] (0,4.98) -- (2.4,4.98);
\draw[dotted,color=gray] (0,1.5) -- (2.4,1.5);

\draw[dotted,color=gray] (0,3) -- (3.36,3);
\draw[dotted,color=gray] (1.32,0) -- (1.32,3);
\draw[dotted,color=gray] (1.92,0) -- (1.92,3);
\draw[dotted,color=gray] (2.4,0) -- (2.4,3);
\draw[dotted,color=gray] (2.88,0) -- (2.88,3);
\draw[dotted,color=gray] (3.36,0) -- (3.36,3);


\filldraw[black] (2.4,3) circle (2pt) node[anchor=north west]{};
\filldraw[black] (2.4,6) circle (2pt) node[anchor=west]{};
\filldraw[black] (2.4,4.98) circle (2pt) node[anchor=west]{};
\filldraw[black] (2.4,1.5) circle (2pt) node[anchor=west]{};
\filldraw[black] (2.4,0) circle (2pt) node[anchor=west]{};
    
\filldraw[black] (1.32,3) circle (2pt) node[anchor=west]{};
\filldraw[black] (1.92,3) circle (2pt) node[anchor=west]{};
\filldraw[black] (2.88,3) circle (2pt) node[anchor=west]{};
\filldraw[black] (3.36,3) circle (2pt) node[anchor=west]{};



\end{tikzpicture}
\end{document}

答案1

欢迎使用 TeX.SX!这可能只是渲染错误。您可以尝试使用该fadings库并使用fill=red!20, path fading=eastfill=green!20, path fading=east进行淡入淡出:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{fadings}

\tikzset{
    every path/.style={
        line width=0.8pt,
        line cap=round,
        line join=round
    }
}

\newcommand*{\rom}[1]{\expandafter\@slowromancap\romannumeral #1@}

\begin{document}
\begin{tikzpicture}

\newcommand{\degPunit}{20}

% AXIS
\draw[thin, ->] (-.2,0) -- (12,0) node[right] {$D$};
\draw[thin, ->] (0,-.2) -- (0,10) node[above] {$\alpha$ (deg)};

% TICKS
\draw[very thin] (1,0) -- ++(0,-.1) node[below] {$1$};
\draw[very thin] (2,0) -- ++(0,-.1) node[below] {$2$};
\draw[very thin] (3,0) -- ++(0,-.1) node[below] {$3$};
\draw[very thin] (4,0) -- ++(0,-.1) node[below] {$4$};
\draw[very thin] (5,0) -- ++(0,-.1) node[below] {$5$};
\draw[very thin] (6,0) -- ++(0,-.1) node[below] {$6$};
\draw[very thin] (7,0) -- ++(0,-.1) node[below] {$7$};
\draw[very thin] (8,0) -- ++(0,-.1) node[below] {$8$};
\draw[very thin] (9,0) -- ++(0,-.1) node[below] {$9$};
\draw[very thin] (10,0) -- ++(0,-.1) node[below] {$10$};
\draw[very thin] (11,0) -- ++(0,-.1) node[below] {$11$};

\draw[very thin] (0,180/20) -- ++(-.1,0) node[left] {$180$};
\draw[very thin] (0,150/20) -- ++(-.1,0) node[left] {$150$};
\draw[very thin] (0,120/20) -- ++(-.1,0) node[left] {$120$};
\draw[very thin] (0,90/20) -- ++(-.1,0) node[left] {$90$};
\draw[very thin] (0,60/20) -- ++(-.1,0) node[left] {$60$};
\draw[very thin] (0,30/20) -- ++(-.1,0) node[left] {$30$};
    
\node[below] at (.1,-.1) {\mbox{$0$}};
\node[left] at (-.1,0) {\mbox{$0$}};
                        
% AUX LINES 
\draw[dotted, color=gray] (0,9) -- (12,9);
\draw[dotted, color=gray] (1,0) -- (1,10);
    
% GRAPHS
\draw[name path=A1, color=black, samples=200, domain=(1:11)] plot (\x,{acos(2/\x -1)/\degPunit});    
\draw[name path=A2, dashed, color=black, samples=200, domain=(11:11.5)] plot (\x,{acos(2/\x -1)/\degPunit});    

\node[right] at (11.5,7.3) {$\alpha^* (D)$};

\draw[name path=B1, color=gray, dashed, samples=200, domain=(1:11.5)] plot (\x,{acos(1/\x)/\degPunit}); 
\node[right] at (11.5,4.3) {$\alpha (P = 0)$};
\node[right] at (7,5.5) {$\alpha (P > 0)$};
\node[right] at (7,2.2) {$\alpha (P < 0)$};

% COLORED REGIONS

\path[name path=X1, domain=(1:11)] plot (\x,0);  
\path[name path=X2, domain=(11:11.5)] plot (\x,0);    

% \path[name path=C, domain=(11:11.5)] plot (\x,0);    

\begin{axis}[
    axis lines=none,
    xmin=0, xmax=12,
    ymin=0, ymax=10,
    width=13.55cm,
    height=11.58cm]
\addplot[fill=green!20] fill between[of=A1 and X1];
\addplot [name path=Y, draw=none]    
    table[row sep=crcr]{%
        0   0\\
        0   9\\
    };
\addplot [name path=D1, draw=none]
    table[row sep=crcr]{%
        1   0\\
        1   9\\
    };
\addplot[fill=red!40] fill between[of=Y and D1];

\addplot [name path=X180, draw=none]
    table[row sep=crcr]{%
        1   9\\
        11  9\\
    };
\addplot [name path=X1802, draw=none]
    table[row sep=crcr]{%
        11  9\\
        11.5    9\\
    };
\addplot[fill=red!20] fill between[of=X180 and A1];

\addplot[fill=red!20, path fading=east] fill between[of=X1802 and A2];   % <--- !

\addplot[fill=green!20, path fading=east] fill between[of=A2 and X2];    % <--- !

\end{axis}

\node[right] at (.3,8) {\rom{1}};
\node[right] at (10,8) {\rom{2}};
\node[right] at (10,6) {\rom{3}};

% MARKS

\draw[dotted, color=gray] (2.4,0) -- (2.4,6);
\draw[dotted, color=gray] (0,3) -- (2.4,3);
\draw[dotted, color=gray] (0,6) -- (2.4,6);
\draw[dotted, color=gray] (0,4.98) -- (2.4,4.98);
\draw[dotted, color=gray] (0,1.5) -- (2.4,1.5);

\draw[dotted, color=gray] (0,3) -- (3.36,3);
\draw[dotted, color=gray] (1.32,0) -- (1.32,3);
\draw[dotted, color=gray] (1.92,0) -- (1.92,3);
\draw[dotted, color=gray] (2.4,0) -- (2.4,3);
\draw[dotted, color=gray] (2.88,0) -- (2.88,3);
\draw[dotted, color=gray] (3.36,0) -- (3.36,3);

\filldraw[black] (2.4,3) circle (2pt) node[anchor=north west]{};
\filldraw[black] (2.4,6) circle (2pt) node[anchor=west]{};
\filldraw[black] (2.4,4.98) circle (2pt) node[anchor=west]{};
\filldraw[black] (2.4,1.5) circle (2pt) node[anchor=west]{};
\filldraw[black] (2.4,0) circle (2pt) node[anchor=west]{};
    
\filldraw[black] (1.32,3) circle (2pt) node[anchor=west]{};
\filldraw[black] (1.92,3) circle (2pt) node[anchor=west]{};
\filldraw[black] (2.88,3) circle (2pt) node[anchor=west]{};
\filldraw[black] (3.36,3) circle (2pt) node[anchor=west]{};

\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容