tengo el siguiente grafico
Como puede ver, el subtítulo (b)
no está centrado desde la subfigura correspondiente como (a)
. Si aumento el valor [.51\linewidth]
sucederán cosas no deseadas. Estoy usando subcaption
el paquete with memoir
porque las herramientas de memorias nativas para subfigure
s muestran problemas con la descarga correcta. El código de la imagen de arriba es:
\documentclass[11pt]{memoir}
\setstocksize{23cm}{15.9cm}
\settrimmedsize{23cm}{15.9cm}{*}
\settrims{0pt}{0pt}
\settypeblocksize{17.8cm}{11.3cm}{*}
\setlrmargins{2.3cm}{*}{*}
\setulmargins{6.4\onelineskip}{*}{*}
\setheadfoot{1.18\onelineskip}{\onelineskip}
\setheaderspaces{4.1\onelineskip}{*}{*}
\checkandfixthelayout[lines]
\usepackage{amsmath,amssymb,amsthm}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{subcaption}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.10}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{arrows}
\pgfplotsset{
/pgfplots/area style/.style={%
area cycle list,
area legend,
axis on top,
}}
\begin{document}
\blindtext\blindtext
\begin{figure}[b]
%\centering
\subcaptionbox{A cat\label{cat}}{\begin{tikzpicture}[scale=0.71]
\begin{axis}[axis equal,axis on top,axis lines=center,enlargelimits=false,xlabel=$x(t)$,ylabel=$y(t)$,xmax=2.5,xmin=-2.2,ymax=2.5,ymin=-2.2,area legend,xtick=\empty,ytick= \empty %,legend entries={$\Ran f$}]
\addplot[draw=blue!30!white,fill=blue!30!white,
domain=-2:2,samples=120] {sqrt(4-x^2)};
%\addlegendimage{fill=blue!30!white,area legend}
%\addlegendentry{$\Ran f$}
\addplot[draw=blue!30!white,fill=blue!30!white,
domain=-2:2,samples=120] {-sqrt(4-x^2)};
\addplot[white,fill,
domain=-1:1,samples=120] {sqrt(1-x^2)};
\addplot[white,fill,
domain=-1:1,samples=120] {-sqrt(1-x^2)};
%\node at (380,170) {$x'(t)$};
%\node at (20,170) {$y'(t)$};
\end{axis}
\end{tikzpicture}}
\subcaptionbox{An elephant\label{elephant}}[.51\linewidth]
{\begin{tikzpicture}[scale=0.71,/pgf/declare function={f=1/x;}]
\begin{axis}[axis x line=center,axis y line=center,xtick=\empty,ytick= \empty,xlabel=$x(t)$,
ylabel=$y(t)$,]
\addplot [red!30!white,name path=f,domain=-3:3, samples=60] {f};
\path[name path=axis] (axis cs:\pgfkeysvalueof{/pgfplots/xmin},0) -- (axis cs:\pgfkeysvalueof{/pgfplots/xmax},0);
\addplot[red!30!white] fill between[of=f and axis];
\end{axis}
\end{tikzpicture}}
\caption{Two animals}\label{animals}
\end{figure}
\end{document}
¿Cómo controlo eso?
Respuesta1
En vez de pasar scale=0.71
pasarlo tikzpicture
a las axis
opciones. También he añadido ylabel style={anchor=west}
poner y etiquetar poco arriba.
\documentclass[11pt]{memoir}
\setstocksize{23cm}{15.9cm}
\settrimmedsize{23cm}{15.9cm}{*}
\settrims{0pt}{0pt}
\settypeblocksize{17.8cm}{11.3cm}{*}
\setlrmargins{2.3cm}{*}{*}
\setulmargins{6.4\onelineskip}{*}{*}
\setheadfoot{1.18\onelineskip}{\onelineskip}
\setheaderspaces{4.1\onelineskip}{*}{*}
\checkandfixthelayout[lines]
\usepackage{amsmath,amssymb,amsthm}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{subcaption}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.10}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{arrows}
\pgfplotsset{
/pgfplots/area style/.style={%
area cycle list,
area legend,
axis on top,
}}
\begin{document}
\blindtext\blindtext
\begin{figure}[b]
%\centering
\subcaptionbox{A cat\label{cat}}{\begin{tikzpicture}
\begin{axis}[scale=0.71,axis equal,axis on top,axis lines=center,enlargelimits=false,xlabel=$x(t)$,ylabel=$y(t)$,xmax=2.5,xmin=-2.2,ymax=2.5,ymin=-2.2,area legend,xtick=\empty,ytick= \empty,
ylabel style={anchor=west} %,legend entries={$\Ran f$}
]
\addplot[draw=blue!30!white,fill=blue!30!white,
domain=-2:2,samples=120] {sqrt(4-x^2)};
%\addlegendimage{fill=blue!30!white,area legend}
%\addlegendentry{$\Ran f$}
\addplot[draw=blue!30!white,fill=blue!30!white,
domain=-2:2,samples=120] {-sqrt(4-x^2)};
\addplot[white,fill,
domain=-1:1,samples=120] {sqrt(1-x^2)};
\addplot[white,fill,
domain=-1:1,samples=120] {-sqrt(1-x^2)};
%\node at (380,170) {$x'(t)$};
%\node at (20,170) {$y'(t)$};
\end{axis}
\end{tikzpicture}}
\subcaptionbox{An elephant\label{elephant}}[.51\linewidth]
{\begin{tikzpicture}[/pgf/declare function={f=1/x;}]
\begin{axis}[scale=0.71,axis x line=center,axis y line=center,xtick=\empty,ytick= \empty,xlabel=$x(t)$,
ylabel=$y(t)$,,
ylabel style={anchor=west}]
\addplot [red!30!white,name path=f,domain=-3:3, samples=60] {f};
\path[name path=axis] (axis cs:\pgfkeysvalueof{/pgfplots/xmin},0) -- (axis cs:\pgfkeysvalueof{/pgfplots/xmax},0);
\addplot[red!30!white] fill between[of=f and axis];
\end{axis}
\end{tikzpicture}}
\caption{Two animals}\label{animals}
\end{figure}
\end{document}