如何用 tikz 绘制双坐标系?

如何用 tikz 绘制双坐标系?

我正在尝试绘制这个双坐标系。 在此处输入图片描述 我最多可以画出这个(在代码上)

\documentclass[tikz]{standalone}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{cqcqcq}{rgb}{0.7529411764705882,0.7529411764705882,0.7529411764705882}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw [color=cqcqcq,dash pattern=on 4pt off 4pt, xstep=2.0cm,ystep=2.0cm] (0,0) grid (10,10);
\draw[->,color=black] (-0.0,0.0) -- (11
,0.0);
\foreach \x in {0,2.0,4.0,6.0,8.0,10.0}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[->,color=black] (0.0,-7.111454243646196) -- (0.0,11.88836233932886);
\foreach \y in {0,2.0,4.0,6.0,8.0,10.0}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
\clip(-7.592067226089411,-7.111454243646196) rectangle (29.694262245619367,11.88836233932886);
\end{tikzpicture}
\end{document}

答案1

从某事开始。

\documentclass[tikz,border=2mm]{standalone}
\begin{document}
 \begin{tikzpicture}
\draw[help lines] (0,0) grid (6,5);
\draw [->] (0,0)--(6.5,0) node[below right] {$x$};
\draw [->] (0,0)--(0,5.5) node[above left] {$y$};
\foreach \i in {1,...,6}
    \draw (\i,.3)--++(-90:6mm) node[below]{\i};
\foreach \i in {1,...,5}
    \draw (.3,\i)--++(180:6mm) node[left]{\i};
\node[below left] at (0,0) {0};

\begin{scope}[shift={(3,2)},draw=purple, text=purple]
\draw [->] (0,0)--(3.5,0) node[below right] {$x'$};
\draw [->] (0,0)--(0,4.5) node[above left] {$y'$};
\foreach \i in {1,...,3}
    \draw (\i,.3)--++(-90:6mm) node[below]{\i};
\foreach \i in {1,...,4}
    \draw (.3,\i)--++(180:6mm) node[left]{\i};
\node[below left] at (0,0) {0};
\end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容