3

I try to draw a Bezier curve:

enter image description here

My MWE below:

\documentclass[]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{decorations.text}
\usetikzlibrary{intersections}
\usetikzlibrary{arrows}


\begin{document}
\begin{center}
    \begin{tikzpicture}
\begin{axis}[
axis lines = middle,
clip=false,
ylabel={$P$}, ylabel style={at=(current axis.above origin), anchor=east},
xlabel={$T$}, xlabel style={at=(current axis.right of origin), anchor=west},
xmin=0, xmax=1,
ymin=0, ymax=1,
ticks=none,
width=10cm,
height=10cm,
]
\draw[thick] (axis cs:0.05,1) .. controls (axis cs:2,0.7) and (axis cs:-0.8,0.1) .. (axis cs:0.9,0);
\end{axis}
\end{tikzpicture}
\end{center}

\end{document}

But the picture is not centered horizontally, because the contros are far beyond the boundaries of the coordinate plane. How can I draw a picture with the correct centering on the page?

4
  • 1
    Can't you just have clip=true, which is default, or do you need clip=false for some other reason? Sep 12, 2016 at 11:10
  • @TorbjørnT. I need need clip=false for some other reason. Sep 12, 2016 at 11:11
  • 1
    add overlay option to the \draw
    – percusse
    Sep 12, 2016 at 11:13
  • @percusse Yes, thank you, overlay option helped me. Sep 12, 2016 at 11:19

1 Answer 1

2

You can clip your picture (\framebox added only to see the effect):

\documentclass[]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{decorations.text}
\usetikzlibrary{intersections}
\usetikzlibrary{arrows}


\begin{document}
\begin{center}
\framebox{
    \begin{tikzpicture}
    \clip (-0.5,-0.5) rectangle (10,10); %here - PS
\begin{axis}[
axis lines = middle,
clip=false,
ylabel={$P$}, ylabel style={at=(current axis.above origin), anchor=east},
xlabel={$T$}, xlabel style={at=(current axis.right of origin), anchor=west},
xmin=0, xmax=1,
ymin=0, ymax=1,
ticks=none,
width=10cm,
height=10cm,
]
\draw[thick] (axis cs:0.05,1) .. controls (axis cs:2,0.7) and (axis cs:-0.8,0.1) .. (axis cs:0.9,0);
\end{axis}
\end{tikzpicture}
}
\end{center}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .