3

I need to plot the following function (just like in the image) but I do not know how to use the features of the TKZ package and the PGFPLOTS:

enter image description here

The most I could get close to the image was with:

\documentclass{article}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\pagestyle{empty}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    minor tick num=1,
    axis x line=middle,
    axis y line=middle,
    xmin=-5,xmax=25,
    ymin=490, ymax=540,
    xlabel=$x$,ylabel=$y$]
\addplot[blue,domain=-5:25] {2*x+500};

\end{axis}

\end{tikzpicture}

\end{document}

So, how can i do it?

  • 1
    Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – Stefan Pinnow Jun 11 '19 at 19:30
5

To give you a start.

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
  \begin{tikzpicture}[>=stealth]
   \draw[thick,->] (0,-1) -- (0,5);
   \draw[thick,->] (-1,0) -- (5,0) node[right]{$x$};
   \draw (0,3) node[left]{$500$} -- (4,3.8);
   \draw[dashed,thick] (2,0) node[below] {$10$} |- (0,3.4) node[left]{$520$};
   \node[below left] {$0$};
  \end{tikzpicture}
\end{document}

enter image description here

| improve this answer | |
  • Absolutely fantastic, thank you! – Diego Jun 11 '19 at 19:54
0

Thank you @marmot!

I followed his guidance and was able to adapt as I needed. Thanks again, because now I understand the code.

Here's what I did:

\documentclass{article}
\usepackage{tikz}


\begin{document}

\begin{tikzpicture}[>=stealth]
\draw[thick,->] (0,-0.5) -- (0,3) node[left]{C$(x)$};
\draw[thick,->] (-0.5,0) -- (3,0) node[right]{$x$};
\draw (0,1.8) node[,left]{$500$} -- (2.5,2.55);
\draw[dashed,thick] (1.5,0) node[below] {$10$} |- (0,2.25) node[left]{$520$};
\node[below left] {$0$};
\fill[black] (1.5,2.25) circle (1.4pt) node[right]{\empty};
\fill[black] (0,1.8) circle (1.4pt) node[right]{\empty};
\end{tikzpicture}

\end{document}

Result:

enter image description here

Thanks a lot for the help. Problem solved.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.