Scatter Plot diagonal reference line

Hello Knimers,

I have a dream that one day I could add a diagonal reference line to my scatter plot.
Or is it already possible? :melting_face:

@jawolli you could create such an image with the help of the integrated Python extension in KNIME and a Data App:

kn_example_python_graphic_scatterplot_diagonal_reference.knwf (779.2 KB)

3 Likes

Hello @jawolli and welcome to the KNIME community

Besides @mlauber71 suggest of using Py. You can code it in R with the help of ‘ggplot2’ library, there are few adjustment line types in the library.

You can find an example of KNIME deployment in the following workflow:

BR

3 Likes

Thank you @mlauber71 and @gonhaddock !

Unfortunately I am not familiar with either python or R.

Are there any no code solutions for my problem?

Hey @jawolli,

little update: while this is still not possible with the native node, we added a great new node in 5.2 called the Generic ECharts node. With that you can easily combine multiple plots (in your case a scatter and line plot). If you don’t want to fiddle with the json code of the library you can make use of the AI to get an idea on how to solve the problem.

Maybe worth giving it a try, let me know what your experience was.

Greetings,
Daniel

4 Likes

Hi @DanielBog,

Thank you very much. This worked well. I asked K-AI to add the diagonal to the scatter plot and all I needed to do was adjust the coordinates. Great node!

Best
Ben

6 Likes

Just upvoted this. It’s a bit weird that we can’t easily add an x=y reference line to scatter plots, since published plots so often have them. It would surely be very easy to add.

EDIT: I have re-read the thread and noticed that you all were talking about a fixed trend line… Sorry for the confusion! I’ll leave the reference to the component here if someone wants to take look…

Technically, yes. A linear regression still needs to happen behind the scenes to compute such a trend line.

I built a component (very much inspired by @zioludo’s Regression Line Plotter – KNIME Community Hub) that uses the ECharts node to create such a scatter plot using an existing linear regression model: Linear Regression Plotter – KNIME Community Hub. I built my version to plot an actual line on top of a scatter plot instead of imitating a line with evenly spaced data points.

1 Like