我如何在乳胶中生成以下图表来说明鱼群搜索算法的行为?
答案1
使用您自己的数据而不是rnd
:
\documentclass[border=2]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\usetikzlibrary{fadings,backgrounds}
\pgfdeclareradialshading{rad}{\pgfpoint{0cm}{0cm}}%
{color(0cm)=(blue!50!black);
color(0.15cm)=(blue);
color(0.35cm)=(blue!80);
color(0.7cm)=(green);
color(1cm)=(yellow);
color(1.2cm)=(red);
color(1.25cm)=(black)}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
enlargelimits,
]
\addplot[scatter,only marks,mark=*,domain=0:1] {rnd};
\begin{scope}[on background layer]
%\path[opacity=0.8,shading=radial, inner color=blue, outer color=red] (rel axis cs: 0,0) rectangle (rel axis cs: 1,1);
\path[opacity=0.8,shading=rad] (rel axis cs: 0,0) rectangle (rel axis cs: 1,1);
\end{scope}
\end{axis}
\end{tikzpicture}
\end{document}