How to plot a straight segment of a first degree function?

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:

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

\documentclass{article}

\usepackage{pgfplots}

\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$]

\end{axis}

\end{tikzpicture}

\end{document}


So, how can i do it?

• 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

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}


• Absolutely fantastic, thank you! – Diego Jun 11 '19 at 19:54

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:

Thanks a lot for the help. Problem solved.