Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about **How to plot predicted values vs the true value** **in Python**. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

## How to plot predicted values vs the true value?

**How to plot predicted values vs the true value?**The problem is that the range of your values span from about 0 to 60.000. I would suggest two options: Either you convert both axis to a log-scale

**plot predicted values vs the true value**The problem is that the range of your values span from about 0 to 60.000. I would suggest two options: Either you convert both axis to a log-scale

## Method 1

This is my try at understanding your problem and to get what you are exactly looking for. So assuming we have the true_value and predicted_value handy. I’d plot them like this:

plt.figure(figsize=(10,10)) plt.scatter(true_value, predicted_value, c='crimson') plt.yscale('log') plt.xscale('log') p1 = max(max(predicted_value), max(true_value)) p2 = min(min(predicted_value), min(true_value)) plt.plot([p1, p2], [p1, p2], 'b-') plt.xlabel('True Values', fontsize=15) plt.ylabel('Predictions', fontsize=15) plt.axis('equal') plt.show()

Which results in:

Are you looking for something like this by any chance? And yes I am using a logarithmic axis because of the difference in scales of your values.

I hope this is what you wanted.

PS. –I am really not sure what the coloring of the points in the provided chart is or what those bands are, but I can still think around what those bands mean and create something like that, but not sure about the marker colorings. So if you can provide the link to where you got that chart from, I think I might be able to understand what exactly is being done in that chart.

## Method 2

The problem is that the range of your values span from about 0 to 60.000. I would suggest two options: Either you convert both axis to a log-scale

g=plt.scatter(y_test1, y_pred_test_Forestreg) g.axes.set_yscale('log') g.axes.set_xscale('log') g.axes.set_xlabel('True Values ') g.axes.set_ylabel('Predictions ') g.axes.axis('equal') g.axes.axis('square')

Or, even better, Plot the difference between the true and predicted values (i.e. the **prediction errors**).

g=plt.plot(y_test1 - y_pred_test_Forestreg,marker='o',linestyle='')

**Summery**

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

**Also, Read**