Skip to main content

首页 / Posts

[OriginPro] Plot from a Formula: Useful for Multiple Linear Regression or Simple Linear Regression

This article introduces ways to visualize multiple linear regression results, including how to draw function plots and scatter plots and how to use OriginPro for data visualization, helping you explain linear-regression models more intuitively.

Rosetears·
··697 words·4 mins

Background
#

After completing a multiple linear regression analysis, presenting the results only as a formula can feel too abstract and monotonous. This article uses OriginPro to walk through three methods for visualizing functions, with a special demonstration of how to combine scatter plots and function plots.


Basic Visualization Methods
#

Method 1: Quick Function-Plot Drawing
#

  1. Operation path: Click the top menu Plot > Function Plot > 2D Function Plot.
  2. Formula input rules:
    • Merge all independent variables into a single symbol x. If there are multiple independent variables, enter all of them as x; do not enter x1, x2, and so on because of software syntax limits.
    • Example: the original formula y=0.217x₁+0.115x₂+0.416x₃+0.24x₄ should be rewritten as y=0.217*x+0.115*x+0.416*x+0.24*x.
  3. Parameter suggestions:
    • Points refer to the number of plotted points. From previous knowledge, we know points can form a line. The more points there are, the smoother the line becomes.
    • From and To represent the value range of x.
    • Here we are drawing a straight line, so set the number of points to 100 and the x range from 0 to 10. If you want to draw a curve, you can increase the number of points appropriately.
      Function plot parameter settings
  4. Graph optimization: After clicking OK, the graph is created. Finally, beautify it as needed.
    Pasted image 20250219202811

Method 2: Set Column Values
#

  1. Set the independent variable:

    • First left-click A(X), then right-click and choose Set Column Values, and enter the range and formula.
    • Note that Row should be set to i, not x.
    • From(F) and To(T) define the value range of the independent variable i. In testing, the minimum F value can only be set to 0, representing the number of points.
    • Col sets the specific values of the independent variable. It is best to use n*i, which generates an arithmetic sequence.

    Independent variable column settings

  2. Set the dependent variable:

    • Left-click B(Y), then right-click and choose Set Column Values, and enter the range and formula.
    • Here, Row can be set to automatic. The system will automatically match the number of dependent-variable values according to the independent-variable range.
    • Enter the formula directly in Col. Note that because we set the independent variable in column A, x should be entered as A here.

    Dependent variable column settings

  3. Generate the chart: Select all the data and draw a line chart.


Method 3: Quick Formula-Cell Method
#

  • Directly double-click the F(x) cell below the table and enter the formula. The requirements are the same as in Method 2.

  • Feature: It generates results quickly, but the default number of points is small. If you need to adjust it manually, right-click the column and open Column Properties.

    Formula cell input


Advanced Application: Overlaying a Scatter Plot and Function Plot
#

Scatter + function plots are more commonly used in simple linear regression, but if you want to draw a similar chart for multiple regression, that is also possible.

  1. Export function data: Note: if you already have function data from Method 2 or Method 3, you do not need this step. This step is only for a little convenience.

    • In Method 1, after drawing the function plot, double-click the chart, click Function, and change the function settings. Then click Workbook to export the function data into a table.
      Data export settings
  2. Preprocess the data:

    • Paste the exported data, meaning the data used for linear regression analysis, into an OriginPro worksheet. At this point, set the independent variable as Y and the dependent variable as X to make plotting easier.
      Data format adjustment
  3. Create the base scatter plot:

    • Select all data > Plot > Basic 2D > Scatter.
    • Click the far-right Swap XY button to align the coordinate direction.

    Swap axes

  4. Add the function graph:

    • Right-click a blank area and choose New Layer (Axes) > No Axes (linked dimensions/scale to XY axes)(N).
    • In the chart window, select “2,” then right-click Plot Setup.

    Layer management interface

  5. Adjust:

    • First choose Line, then select the table containing the function data in the upper window, set the X and Y axes, and click “Apply” to confirm.
    • If you do not want the coordinate axes to change, uncheck “Rescale.”
    • If the worksheet is not displayed, click the far-right arrow beside Show(S) to display the workbook.
      Combined graph effect
  6. After that, the chart is finished. You can then beautify and adjust it as needed.

    Final result

Click here to watch the video version of this article

Related

[OriginPro] Draw a Correlation Analysis Heat Map

··361 words·2 mins
This article explains how to use OriginPro to draw a polished, information-rich correlation heat map and compares it with a Python heat map. The detailed steps help you quickly use the OriginPro plugin and improve your data-analysis visuals.

Regression Analysis — Differences Among Three Types of Logistic Regression

··453 words·3 mins
This article introduces three common logistic regression models: binary logistic regression, multinomial logistic regression, and ordered logistic regression. It explains their applications and differences for different dependent-variable types, helping readers understand when to use these statistical models in real analysis.

【SPSS】Regression Analysis — Linear Regression

··757 words·4 mins
This article introduces the main differences between linear regression and logistic regression, and explains the steps, result interpretation, and common statistics in regression analysis, such as R-squared, the Durbin-Watson value, and regression coefficients, helping readers understand how to use regression models for data analysis.