I am trying to draw a picture of a concave function. I would like the axes to start at (0,0), however when I draw the picture as you can see below the y-axis starts below 0.
I have tried running several codes from previous answers but none of them seem to work. The last one I have tried is this one trying to override values outside the picture:
\documentclass[usenames,dvipsnames]{beamer}
\usepackage{pgfplots}
\pgfplotsset{compat = newest}
\pgfplotsset{overwrite option/.style args={#1 with #2}{#1=#2,#1/.code=}}
\begin{document}
\begin{frame}{CONVEX AND CONCAVE FUNCTIONS}
\framesubtitle{DEFINITION}
\textbf{CONCAVE FUNCTION:} is a function where no line segment joining two points on the graph lies above the graph at any point.
{ % begin outer pgfplotsset scope
\pgfplotsset{ymax=5, overwrite option=ymin with 0, overwrite option=xmin with 0, execute at begin axis={\pgfplotsset{width=5cm}}}% the ymin key doesn't work anymore
\begin{tikzpicture}
\begin{axis}[
xmax = 10,
xtick={0,2,4,6,8,10},
ytick={0,2,4,6},
axis lines = left,
domain=0:10,
% minor y tick num=1,
samples=100,
% enlarge x limits=false,
% grid=both,
no markers,
axis equal]
\addplot[ultra thick,Mahogany]{2*x^(1/2)};
\end{axis}
\end{tikzpicture}
} % end outer pgfplotsset scope
\end{frame}
\end{document}
axis equal
.axis equal
, but then you need to change thewidth
/height
of theaxis
. Do you want/need theaxis equal
feature? (I.e. that 1 unit on the x-axis is the same length as 1 unit on the y-axis.)