TeX - LaTeX Asked by go go on May 25, 2021
I know I can use pgfplotsset{widht=8cm}
to adjust the width of whole figure, but I care more about the width of rectangle.
Here is my code:
documentclass[10pt]{standalone}
usepackage{pgfplots}
pgfplotsset{width=8cm,compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}
addplot coordinates {
(0,0)
(1,1)
};
end{axis}
end{tikzpicture}
end{document}
As I mentioned in the comments, scale only axis=true
only sets the length of the axis, not the whole picture.
documentclass[border=10pt]{standalone}
usepackage{pgfplots}
usetikzlibrary{calc, intersections}
pgfplotsset{compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}[
name=a,
width=8cm,
height=8cm,
scale=1,
]
addplot[
blue,
mark=*,
fill=blue,
] coordinates {
(0,0)
(1,1)
};
end{axis}
draw[orange, densely dashed] (0,-0.25) -- (8,-0.25);
begin{axis}[
at={($(a.south west) - (0,0.5cm)$)},
anchor=north west,
scale only axis=true,
width=8cm,
height=8cm,
]
addplot[
blue,
mark=*,
fill=blue,
] coordinates {
(0,0)
(1,1)
};
end{axis}
end{tikzpicture}
end{document}
The orange line indicates a width of 8 cm.
Correct answer by Excelsior on May 25, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP