如何重新缩放带子标题的 pstricks 图像?

如何重新缩放带子标题的 pstricks 图像?

我有一张图片和一个代码,效果很好。

当我尝试缩放 PSTRickis 图像时,遇到了问题 - 错误

如何使用 subcption 包调整图像大小?

我在代码末尾添加了 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \resizebox{11cm}{!}{

以及代码末尾的其他 %%%%%%%%%%%%%%%%%%%%%%%%%%% }

我认为删除这两行中的 %%%%..%%% 应该能够调整图像大小,但我遇到了错误。

你可以帮帮我吗?

\documentclass[pstricks,border=12pt]{article}
\usepackage{pstricks,pst-node,pst-blur}
\usepackage{subcaption}
\usepackage[utf8]{inputenc}
\usepackage{eurosym}

\newpsobject{cnodeblue}{cnode}{fillstyle=solid,fillcolor=blue}
\newpsobject{cnodepink}{cnode}{fillstyle=solid,fillcolor=pink}
\newpsobject{cnodegreen}{cnode}{fillstyle=solid,fillcolor=green}
\newpsobject{psframegray}{psframe}{fillcolor=lightgray,linestyle=none,shadow,blur}

\definecolor{azultenue}{RGB}{65,170,193}
\definecolor{rojotenue}{RGB}{192,2,3}
\definecolor{naranjatenue}{RGB}{241,101,35}
\definecolor{verdetenue}{RGB}{144,169,61}
\definecolor{gris135}{RGB}{135,135,135}

\begin{document}

\begin{figure}[h!]
\centering


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  \resizebox{11cm}{!}{   


\psset{framearc=0.2, shadowcolor=black!70, shadowangle=-90, unit=1.0cm,nodesep=0.12cm}
%
\def\pscolhookii{\hskip 1cm}
\def\pscolhookiii{\hskip 1cm}
\begin{psmatrix}[rowsep=2.2, colsep=5.2]% defines the distance between two frames
 [name=Inicio] 
 \psframegray(-2.5,-2.5)(2.5,2.5)
%
 \rput(0,1.5){\circlenode[fillstyle=solid,fillcolor=azultenue]{p1}{\textcolor{black}{$p_1$}}}
%
 \rput(-1.5,-1){\circlenode[fillstyle=solid,fillcolor=naranjatenue]{c1}{\textcolor{black}{$c_1$}}}
 \rput(-0.5,-1){\circlenode[fillstyle=solid,fillcolor=naranjatenue]{c2}{\textcolor{black}{$c_2$}}}
%
 \psdots[dotsize=0.06](0.1,-1)
 \psdots[dotsize=0.06](0.4,-1)
 \psdots[dotsize=0.06](0.7,-1)
%
 \rput(1.5,-1){\circlenode[fillstyle=solid,fillcolor=naranjatenue]{cl}{\textcolor{black}{$c_\lambda$}}}
%
 \ncline[arcangle=0]{->}{p1}{c1}
 \nbput[nrot=:U,labelsep=0.075cm]{\small{$ \omega_{mut}$}}
%
 \ncline[arcangle=0]{->}{p1}{c2}
 \nbput[nrot=:U,labelsep=0.075cm]{\small{$ \omega_{mut}$} }
%
 \ncline[arcangle=0]{->}{p1}{cl}
 \nbput[nrot=:U,labelsep=0.075cm]{\small{$ \omega_{mut}$} }
\rput(0,-1.8){$\bullet$ Crear $\lambda$ mutantes de $p_1$}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
&[name=Conjunto]
\psframegray(-2.5,-2.5)(2.5,2.5)
\pstriangle[fillstyle=solid,fillcolor=gris135,linestyle=dashed,linecolor=red,linewidth=0.06cm,linearc=0.4](0,-1.56)(5.0,4.2)
%
 \rput(0,1.5){\circlenode[fillstyle=solid,fillcolor=azultenue]{p1}{\textcolor{black}{$p_1$}}}
%
 \rput(-1.5,-1){\circlenode[fillstyle=solid,fillcolor=naranjatenue]{c1}{\textcolor{black}{$c_1$}}}
 \rput(-0.5,-1){\circlenode[fillstyle=solid,fillcolor=naranjatenue]{c2}{\textcolor{black}{$c_2$}}}
%
 \psdots[dotsize=0.06](0.1,-1)
 \psdots[dotsize=0.06](0.4,-1)
 \psdots[dotsize=0.06](0.7,-1)
%
 \rput(1.5,-1){\circlenode[fillstyle=solid,fillcolor=naranjatenue]{cl}{\textcolor{black}{$c_\lambda$}}}

\rput(0,-1.8){$\bullet$ Evaluar Padres e Hijos}
\rput(0,-2.2){$\bullet$ Elegir el más apto del conjunto}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
&[name=EM]
\psframegray(-2.5,-2.5)(2.5,2.5)
%
 \rput(0,0){\circlenode[fillstyle=solid,fillcolor=verdetenue]{pnuevo}{\textcolor{black}{\hspace{0.36cm}}}}
%
\rput(0,-1.8){$\bullet$ El individuo elegido}
\rput(0,-2.3){ sustituirá a $p_1$}
\end{psmatrix}
\psset{linewidth=3pt, linecolor=red, arrows=->, nodesep=4pt,  linearc=0.25, angleB=180, shortput=nab, npos = 0.4,nodesep=2.6cm}
\ncline{Inicio}{Conjunto}
\ncline{Conjunto}{EM}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}


\caption{\vspace{4.5cm}Esquema $(1+\lambda)$}\label{1maslambda-ilustracion}
\end{figure}

\end{document} 

答案1

无需使用,\resizebox它看起来已经没问题了:

[...]
\ncline{Conjunto}{EM}

\vspace{6\normalbaselineskip}
\caption{Esquema $(1+\lambda)$}\label{1maslambda-ilustracion}
\end{figure}

如果你想调整它的大小使用

\begin{figure}[h!]
\centering
\resizebox{\linewidth}{!}{%
\psset{framearc=0.2, shadowcolor=black!70, shadowangle=-90, unit=1.0cm,nodesep=0.12cm}

[...]

\ncline{Inicio}{Conjunto}%
\ncline{Conjunto}{EM}%
}

\vspace{6\normalbaselineskip}
\caption{Esquema $(1+\lambda)$}\label{1maslambda-ilustracion}
\end{figure}
[...]

相关内容