pgfplots의 불완전한 플롯

pgfplots의 불완전한 플롯

나는 최대화 문제의 실행 가능한 세트를 플롯하려고 합니다. 제한 사항 중 하나는 x축까지 확장되어야 하므로 불완전합니다.여기에 이미지 설명을 입력하세요

또한 환경으로 인해 전체 그림+캡션이 페이지의 중앙에 배치되는 것 같지만 center그림도 캡션의 중앙에 위치할 것으로 예상했습니다.

MWE는

\documentclass[a4paper]{article}
\usepackage[font=footnotesize,labelfont=bf]{caption}
\usepackage{pgfplots}

\pgfplotsset{compat = newest}

\begin{document}

\begin{center}
   \begin{figure}
      \begin{tikzpicture}
         \begin{axis}[
            ticks=none, 
            axis x line=bottom,
            axis y line=left,
            xmin=0,xmax=1.2,
            ymin=0,ymax=1.3]
         \addplot[
            domain = 0:sqrt(33/56),
            samples =200,
            smooth,
            blue,
            thick
            ] {sqrt((33/8-7*x^2)/3)};
         \end{axis}
      \end{tikzpicture}
      \caption{This is text just to show that the figure is not centered with respect to the caption.}
   \end{figure}
\end{center} 

\end{document}

답변1

@RaffaeleSantoro의 답변 확장 :

도움을 사용합니다 samples = 800.

또한 환경 figure내부에 넣지 말고 다음과 같이 내부에서 center사용하십시오 .\centeringfigure

\documentclass[a4paper]{article}
\usepackage[font=footnotesize,labelfont=bf]{caption}
\usepackage{pgfplots}

\pgfplotsset{compat = newest}

\begin{document}

\begin{figure}
    \centering
    \begin{tikzpicture}
        \begin{axis}[
        ticks=none, 
        axis x line=bottom,
        axis y line=left,
        xmin=0,xmax=1.2,
        ymin=0,ymax=1.3]
        \addplot[
        domain = 0:sqrt(33/56),
        samples =800,
        smooth,
        blue,
        thick
        ] {sqrt((33/8-7*x^2)/3)};
        \end{axis}
    \end{tikzpicture}
    \caption{This is text just to show that the figure is not centered with respect to the caption.}
\end{figure}

\end{document}

여기에 이미지 설명을 입력하세요

답변2

이는 마지막 지점에 "도달"하지 않았기 때문이 아닙니다. 함수는 오른쪽에 정의되어 있지 않으며 sqrt(33/56)컴퓨터의 유한 정밀도로는 어느 쪽에서도 함수를 평가할 수 없습니다 sqrt(33/56). - 요점은 폐기되었습니다 - 컴파일 로그를 살펴보십시오. 한 가지 가능성은 샘플 수를 크게 늘려 마지막 지점에서 두 번째 지점까지 허용 가능한 결과를 제공하는 것입니다. 다른 방법은 y filter다음과 같이 점을 별도로 정의하는 것입니다.

\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ticks=none, 
axis x line=bottom,
axis y line=left,
xmin=0,xmax=1.2,
ymin=0,ymax=1.3]
\addplot[
domain=0:sqrt(33/56),
samples=200,
smooth,
blue, thick,
y filter/.expression={x==sqrt(33/56)?0:y},
] {sqrt((33/8-7*x^2)/3)};
\end{axis}
\end{tikzpicture}
\end{document}

그래프의 분기원

관련 정보