How to add Fit Line (Trend Line) at subgroups in a scatter plot.
How to insert separate Fit Line (Trend Line) for males and females in the same scatter plot.
The scatter plot should have different symbols for males and females.
Data Exploration and VisualizationWindowsRe: How to add Fit Line (Trend Line) at subgroups in a scatter plot.There are a few different platforms that can be used to plot trend lines for different subgroups.
Scatterplot Matrix'

- Go to Graph=>Scatterplot Matrix
- Specify the X and Y columns to use
- Specify the Group variable to be Sex
- Once the graph is open, select Fit Line from the red triangle.
- To change the color and the markers, go to the data table
- Select all of the rows for the males
- Go to Row State column for one of the selected rows and right click and select the color to use
- Right click again, and select the marker to use
- Repeat the above three steps for the females
Graph Builder

- Go to Graph=>Graph Builder
- Drag the X column to the X Drop area
- Drag the Y column to the Y Drop area
- Right Click on the chart and select Smoother=>Remove
- Click on the Fit Line icon

- Drag the Sex column to the Overlay Drop Area
- Drag the Sex column to the Color Drop area
- In the legend area, right click on each of the lines and change the color and line style to match the colors of the markers
Fit Y by X

- Go to Analyze=>Fit Y by X
- Select the X and Y columns
- In the output display, under the red triangle, select Group By and select the Sex column
- Under the red triangle, select Fit Line
- Change the marker and the color of the points as was done in the Scatterplot Matrix, by changing the Row State values for each of the sexes.