如何才能使 y 轴与 x 轴负侧的大小相同?
\documentclass[border={0.2cm 0.2cm 0.2cm 0.2cm}]{standalone}
\usepackage{pgfplots,tikz}
\usepackage[c]{esvect}
\usetikzlibrary{arrows}
\pgfplotsset{compat=1.18}
\usetikzlibrary{angles}
\begin{document}
\begin{tikzpicture}
% let both axes use the same layers
\pgfplotsset{set layers}
\begin{axis}[
axis line style = thick,
axis equal,
axis x line=center,
axis y line=center,
%y axis line style={opacity=0},
%xlabel={$x$},
%ylabel={$y$},
xtick=\empty,
ytick=\empty,
xmin=-0.2,xmax=2.5,ymin=0,ymax=1,
every inner x axis line/.append style={-triangle 45},
every inner y axis line/.append style={-triangle 45},
yticklabel style = {font=\tiny,xshift=0.5ex},
xticklabel style = {font=\tiny,yshift=0.5ex},
%ticks=none,
]
\draw [line width=1pt,-latex] (0,0) -- (35:2.5) node [midway, above left, scale=0.7,xshift=3.5ex, yshift=2.5ex] {$\boldmath{\vv{b}}$};
\draw [line width=1pt,-latex,red] (0,0) -- (2.047880111,0) node [midway, above, scale=0.7,xshift=2.5ex] {$\boldmath{\vv{a}}$};
\draw [line width=1pt,-latex, blue] (0,0) -- (35:1) node [midway, above left, scale=0.7] {$\boldmath{\vv{e}}$};
\coordinate (A) at (35:1);
\coordinate (B) at (0,0);
\coordinate (C) at (1,0);
\pic [draw, ->, angle radius=0.6cm, angle eccentricity=1.5]
{angle = C--B--A};
\draw (0.42,0.13) node [scale=0.7] {\textbf{\textit{v}}};
\draw[line width=1pt, color=black,fill=black] (0,0) circle (1pt) node [below left,scale=0.7] {\textbf{\textit{O}}};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
与axis equal image=true
文档第 301 页ymin=-0.2
和 Tom 的评论一致ymax=1.5
\scriptsize
备注:我认为对于\scale{0.7}
文本和\scriptstyle
数学来说,最好使用而不是。
\tikz{%
\node [scale=0.7] at(0,0) {$\boldmath{\vv{b}}$};
\node at (0.2,0) {$\scriptstyle\boldmath{\vv{b}}$};
\node [scale=0.7] at(0.4,0) {\textbf{\textit{O}}};
\node at (0.6,0) {\scriptsize\textbf{\textit{O}}};
}
\documentclass[border={0.2cm 0.2cm 0.2cm 0.2cm}]{standalone}
\usepackage{pgfplots}%<-- tikz is loaded by pgfplots
\usepackage[c]{esvect}
\pgfplotsset{compat=1.18}
\usetikzlibrary{arrows, angles}
\begin{document}
\begin{tikzpicture}
% let both axes use the same layers
\pgfplotsset{set layers}
\begin{axis}[
axis line style = thick,
% axis equal,
axis equal image=true,%<-- this line
axis x line=center,
axis y line=center,
%y axis line style={opacity=0},
%xlabel={$x$},
%ylabel={$y$},
xtick=\empty,
ytick=\empty,
xmin=-0.2,xmax=2.5,ymin=-0.2,ymax=1.5,%<-- this line
every inner x axis line/.append style={-triangle 45},
every inner y axis line/.append style={-triangle 45},
yticklabel style = {font=\tiny,xshift=0.5ex},
xticklabel style = {font=\tiny,yshift=0.5ex},
%ticks=none,
]
% \draw (0,0) circle [radius=0.2];
\draw [line width=1pt,-latex] (0,0) -- (35:2.5) node [midway, above left, scale=0.7,xshift=3.5ex, yshift=2.5ex] {$\boldmath{\vv{b}}$};
\draw [line width=1pt,-latex,red] (0,0) -- (2.047880111,0) node [midway, above, scale=0.7,xshift=2.5ex] {$\boldmath{\vv{a}}$};
\draw [line width=1pt,-latex, blue] (0,0) -- (35:1) node [midway, above left, scale=0.7] {$\boldmath{\vv{e}}$};
\coordinate (A) at (35:1);
\coordinate (B) at (0,0);
\coordinate (C) at (1,0);
\pic [draw, ->, angle radius=0.6cm, angle eccentricity=1.5]
{angle = C--B--A};
\draw (0.42,0.13) node [scale=0.7] {\textbf{\textit{v}}};
\draw[line width=1pt, color=black,fill=black] (0,0) circle (1pt) node [below left,scale=0.7] {\textbf{\textit{O}}};
\end{axis}
\end{tikzpicture}
\tikz{%
\node [scale=0.7] at(0,0) {$\boldmath{\vv{b}}$};
\node at (0.2,0) {$\scriptstyle\boldmath{\vv{b}}$};
\node [scale=0.7] at(0.4,0) {\textbf{\textit{O}}};
\node at (0.6,0) {\scriptsize\textbf{\textit{O}}};
}
\end{document}