
이것이 내가 Geogebra에서 플롯한 것입니다.
Geogebra에서 Tikz 파일을 내보낼 때 얻는 코드는 다음과 같습니다.
\definecolor{ududff}{rgb}{0.30196078431372547,0.30196078431372547,1}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]
\begin{axis}[
x=1cm,y=1cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-4.370038701302235,
xmax=4.373881990999934,
ymin=-0.5693858009107018,
ymax=5.2038438869554735,
xtick={-4,-3,...,4},
ytick={0,1,...,5},]
\clip(-4.370038701302235,-0.5693858009107018) rectangle (4.373881990999934,5.2038438869554735);
\draw [line width=2pt] (-3,1)-- (3,1);
\draw [shift={(0,1)},line width=2pt] plot[domain=0:3.141592653589793,variable=\t]({1*3*cos(\t r)+0*3*sin(\t r)},{0*3*cos(\t r)+1*3*sin(\t r)});
\begin{scriptsize}
\draw [fill=ududff] (-3,1) circle (0.5pt);
\draw [fill=ududff] (3,1) circle (0.5pt);
\end{scriptsize}
\end{axis}
\end{tikzpicture}
이것이 내 Latex 문서에 붙여넣으면 나타나는 결과입니다.
내가 이것을 얻는 이유는 무엇입니까? 어떻게 고치나요? 여러번 시도했는데...
답변1
유일한 문제는 Shift 명령이 단위를 선언하지 않았다는 것입니다 cm
(예 shift={(0cm,1cm)}
: ). 다음 코드가 작동합니다.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepackage{xcolor}
\definecolor{ududff}{rgb}{0.30196078431372547,0.30196078431372547,1}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]
\begin{axis}[
x=1cm,y=1cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-4.370038701302235,
xmax=4.373881990999934,
ymin=-0.5693858009107018,
ymax=5.2038438869554735,
xtick={-4,-3,...,4},
ytick={0,1,...,5},]
\clip(-4.370038701302235,-0.5693858009107018) rectangle (4.373881990999934,5.2038438869554735);
\draw [line width=2pt] (-3,1)-- (3,1);
% The shift command has changed
\draw [shift={(0cm,1cm)},line width=2pt] plot[domain=0:3.141592653589793,variable=\t]({1*3*cos(\t r)+0*3*sin(\t r)},{0*3*cos(\t r)+1*3*sin(\t r)});
\begin{scriptsize}
\draw [fill=ududff] (-3,1) circle (0.5pt);
\draw [fill=ududff] (3,1) circle (0.5pt);
\end{scriptsize}
\end{axis}
\end{tikzpicture}
\end{document}