我需要移动图例在东南方,现在在东北方。我想把它移到东南方。无论我怎么写,它都不会从那里移动。
\begin{figure}[!ht]
\centering
\begin{tikzpicture}
\begin{axis}[name=plot,
xmin=0, xmax=50, xlabel={$[lbs/min]$}, ylabel={Pressure Ratio},
ymin=0,ymax=4.5,width=1\textwidth]
\addplot[black,only marks,mark=+] table{capitoli/capitolo_02/data/185000_rpm.txt}; \label{imported_data}
\addplot[black,dashed,mark=dashed] table{capitoli/capitolo_02/data/greitzer_unstable.txt};\label{greitzer_unstable}
\addplot[black,mark=.] table{capitoli/capitolo_02/data/greitzer_stable.txt}; \label{greitzer_stable}
\end{axis}
\node[anchor=north east, draw=black,fill=white] (legend) at(plot.north east) {\begin{tabular}{l l l}
unstable & \ref{greitzer_unstable}\\
stable& \ref{greitzer_stable}\\
imported data & \ref{imported_data}
\end{tabular}};
\end{tikzpicture}
\caption{\textit{Caratteristica del GTX2860R approssimata con il polinomio di Moore-Greitzer, per $N=185000$}}
\label{fig:caratteristica_GTX2860R_approssimata}
\end{figure}
如果可能的话,我还想改变表格的大小。提前致谢
答案1
图表/图形的输入不可用,因此输出也不会显示---但是由于问题重新定位图例--只需使用at={(5,1)}
传递坐标--并将其与图例样式中的选项一起放置\node[draw=black,thick,rounded corners=2pt, at={(5,1)}]
--坐标可以根据您的选择放置图例--这是使用等5,1
定位的替代方法north, south
这5,1
只是近似值,可以变化来理解,5.1,1.2
例如--5.1
是沿 x 轴的运动,1.2
是沿 y 轴的运动
\documentclass{book}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[xmin=0,xmax=10,ymin=-5,ymax=5,name=border]
\end{axis}
\node[draw=black,thick,rounded corners=2pt, at={(5,1)}] {%
\begin{tabular}{@{}r@{ }l@{}}
\raisebox{2pt}{\tikz{\draw[black] (0,0) -- (5mm,0);}}&black\\
\raisebox{2pt}{\tikz{\draw[red] (0,0) -- (5mm,0);}}&red\\
\raisebox{2pt}{\tikz{\draw[green] (0,0) -- (5mm,0);}}&green\\
\raisebox{2pt}{\tikz{\draw[blue] (0,0) -- (5mm,0);}}&blue
\end{tabular}};
\end{tikzpicture}
\end{document}