find the values of theta in a cost function from andrew ng course
Elaborating on the previous answer, now hat you have $\theta_0 = 0.5$, take any value of $x$ and the corresponding $h_\theta$ value to find $\theta_1$. For instance, using $x=1$ will yield:

$h_\theta(1) = \theta_0 + \theta_1 \times 1$

From the graphd, $h_\theta(1) = 1.5$ so that:

$\theta_0 + \theta_1 = 1.5$

$\theta_1 = 1.5 - \theta_0$

$\theta_1 = 1.5 - 0.5 = 1$

The final equation is then $h_\theta = 0.5 + x$

As said in the comment, you can also get the slope visually, noticing that if you increase $x$ by 1, $y$ also increases by 1 when you follow the slope.

Does this help?