是否可以在 pgfplots 中关闭坐标系中的路径?如果我绘制某些东西,坐标系的框架矩形看起来不错,除了左下角:线条没有很好地合并(因此路径看起来“未闭合”)。有办法吗?当您使用较大的线宽时,这看起来特别奇怪。
我会上传截图这里。如您所见,顶角看起来不错,但底角则不然。
编辑:截图
现在直接截图在这里:)
如上所述:顶角看起来不错,但底角则不然。
答案1
我认为这是 PGFPlots 中的一个错误。轴应该是闭合的,但检查轴是否存在不连续性的条件(在这种情况下轴线不应闭合)混淆了\else
(我认为……)
您可以通过将以下块粘贴到序言中来修复该功能:
\makeatletter
\def\pgfplots@drawaxis@outerlines@cycledpath{%
\draw[
/pgfplots/every outer x axis line, % using these outer styles is only useful in conjunction with 'separate axis lines=true'
/pgfplots/every outer y axis line]
\pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}\endpgfextra
\ifpgfplots@hide@y
{ \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}\endpgfextra }
\else
decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}]
% { -- (\pgfplots@xmin, \pgfplots@ymax) }
{ \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}\endpgfextra }
\fi
\ifpgfplots@hide@x
%{ (\pgfplots@xmax, \pgfplots@ymax) }
{ \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}\endpgfextra }
\else
decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}]
%{ -- (\pgfplots@xmax, \pgfplots@ymax) }
{ \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}\endpgfextra }
\fi
\ifpgfplots@hide@y
%{ (\pgfplots@xmax, \pgfplots@ymin) }
{ \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}\endpgfextra }
\else
decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}]
%{ -- (\pgfplots@xmax, \pgfplots@ymin) }
{ \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}\endpgfextra }
\fi
\ifpgfplots@hide@x
%{ (\pgfplots@xmin, \pgfplots@ymin) }
{ \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}\endpgfextra }
\else
decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}]
%{ -- (\pgfplots@xmin, \pgfplots@ymin) }
{ \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}\endpgfextra }
\fi
% make sure that we do not have any of the axis discontinuities
% here - they should not be closed.
\if0\pgfplots@xaxisdiscontnum
\if0\pgfplots@yaxisdiscontnum
-- cycle
\fi
\fi
;%
}%