# Help with LaTeX graph

Could someone help me code this graph please ?

• Welcome! Please show us what you have so far and explain the particular problem you're having. Posting a minimal example - a complete but minimal document which sets up the problem - is the best approach. Your question may get answered without one, especially if your image is especially attractive or challenging, but do-it-all-for-me questions are not really fair ones for this site as they expect others to do everything for you rather than just helping you with a particularly sticky issue you can't solve for yourself. – cfr May 1 '16 at 23:51
• I don't know how to do this at all. – Li Wang May 2 '16 at 1:05
• @cfr Please, could you do it for me ? – Li Wang May 2 '16 at 1:27
• Take a look at pgfplots or tikz. Search this site and this site to get started. If you do it yourself, great. If you get stuck, you'll have a minimal document to post here and a specific question to ask. Or wait. Probably somebody will do it for you eventually. Possibly even me. I'm not in the mood right now, though. Too late to start from scratch unless it's a tree or otherwise intribuging. Trees are different. – cfr May 2 '16 at 1:31
• @cfr I have a question: if I created a file on share latex containing an image, how should I reference it ? so that it appears in my document – Li Wang May 2 '16 at 1:52

Metapost is a good tool for this sort of semi-numerical graph. Here I've shown it wrapped up with luamplib, so this example needs to be compiled with lualatex.

\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
% unit size
numeric u;
u = 7mm;

% axes
path xx, yy;
xx = (left -- 6 right) scaled u;
yy = (down -- 9 up   ) scaled u;
drawarrow xx withcolor .6 white;
drawarrow yy withcolor .6 white;
label.rt  ("$x$", point 1 of xx);
label.top ("$y$", point 1 of yy);
label.llft("$0$", origin);

% points of interest
pair E, M, B;
E = (0,5u);
B = (5u,0);
M = (1.8u,2u);

% graphs
path ff, gg;
z0 = whatever[E,M]; x0 = xpart point 0 of xx;
z1 = whatever[E,M]; y1 = ypart point 0 of yy;
ff = z0 -- z1;
gg = point 0.9 of yy .. M { M-E } .. B;

draw ff withcolor .67 blue;
draw gg withcolor .53 red;

% labels
dotlabel.llft("$E$", E);
dotlabel.urt ("$B$", B);
dotlabel.urt ("$M(x,y)$", M);

endfig;
\end{mplibcode}
\end{document}


## Notes

• The definition of path ff shows you how to define a line through two points.

The definition z0 = whatever[E,M] defines z0 to be somewhere on the line through E and M, then the second equation x0 = xpart point 0 of xx pins it down. z$ is short hand for (x$,y$) where $ is any suitable suffix. For more explanation read the Metapost manuals and tutorials listed at the first link above.

• The definition of gg shows you how to define a curved path tangent to a point.

The {M-E} after the point M in the curve constrains it to be moving in the direction of M from E at that point (so that it's parallel to the straight line).