Creating a scatter plot along with the regressed line on it

Hi,

I wanted to create a chart showing scatter plot of data along with a line graph ( similar to the image). Can’t find a way to plot it?
What should I do?

Image

1 Like

At the moment, the most flexible way would be to use a Python/R/JavaScript script to plot a scatter plot along with a line graph. In addition, if your particular use case is a linear regression, you can use the Linear Regression Learner node. Here you will find the “Linear Regression Scatterplot View” which displays the input data along with the regression line in a scatter plot.

2 Likes

Hello everyone. Currently we can only add the straight line to the correlation graph by Python/R/JavaScript script?

1 Like

Hello @Marcelo_Linero,

and welcome to KNIME Community!

Correct. There’s a ticket in the system for it (AP-15096). I’ve added a +1 from you.

Br,
Ivan

1 Like

Thank you @ipazin. +1 also from my side :wink:

1 Like

Done @gcincilla.
Ivan

1 Like

Thank you @ipazin. We will be waiting for the solution.
Regards.

And another +1 if it helps

Request noted @dfaberjob.
Ivan

Kindly add a +1 for me.
Thanks!

1 Like

I have often the same issue.
I end up adding a line of fake points (colored in different color) calculated with the regression coefficients.

The workflow looks like this:

  1. Create a table of many x values for the range you want to plot
  2. Use regression predictor to predict the points of the regression line
  3. Append a column to label the regression line points “Line”

On the main data table

  1. Add a column to label the data “Data”
  2. Concatenate “Data” and “Line”
  3. Assign different colors and plot…

If one adds a lot of points… they look like a line. But it’s a very poor solution.

Hope it helps

Ludovico

1 Like

Done @zioludo.
Care to share workflow @zioludo? Maybe someone (or you if you want) can make a generic Component out of it and share it so others can benefit from it until proper solution is available…
Ivan

I will do! But please add +1 for me as well!

1 Like

Tnx @zioludo. Request noted :slight_smile:
Ivan

I have developed a simple component that does the trick… with minimal configuration.
You can find it here:

(Can I upload the component only?)

1 Like

Hello @zioludo,

nice one!

Yes you can. See here for more on sharing Components:
https://docs.knime.com/latest/analytics_platform_components_guide/index.html#sharing-components

Br,
Ivan

Done!

3 Likes

This new component converts the dots in a line.

3 Likes