turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- Scatter plot matrix with 3 variables

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-20-2014 12:17 PM

Time | 700 | 900 | 1100 |
---|---|---|---|

Time1 | 10 | 11 | 21 |

Time2 | 20 | 12 | 22 |

Time3 | 30 | 13 | 23 |

Time4 | 40 | 14 | 24 |

I am trying to do a scatter plot with 'Time on x-axis' and 700, 900, 1100 values (above table has them as variable names) on y axis and corresponding values 10,20,30,40,11,12,13,14,........as poin for that particular Time and y-axis value.

In other terms, I am trying to see a point corresponding to all 3 variables. For below example, there would be only two points : one with age-14 height- 69 weight - 112.5; other point for age -13 height - 56.5 weight -84. I am not looking for a 3 dimensional but there can be a vertical right axis.

Age | Height | Weight |

14 | 69 | 112.5 |

13 | 56.5 | 84 |

I tried below code and it's plotting two plot separately one with height*age; other with weight*age. Can it be possible to have plot with height*weight*age ? Thanks

PROC GPLOT DATA = sashelp.class;

PLOT Height * Age / GRID

VAXIS=AXIS1

HAXIS=AXIS2

FRAME SKIPMISS LEGEND=LEGEND1 ;

PLOT2 Weight * Age = 2 / VAXIS=AXIS3

SKIPMISS OVERLAY LEGEND=LEGEND1 ;

Accepted Solutions

Solution

02-20-2014
05:25 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-20-2014 05:25 PM

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-20-2014 01:28 PM

Do you want something like this?

**data have;**

**input Time $ t700 t900 t1100;**

**datalines;**

**Time1 10 11 21**

**Time2 20 12 22**

**Time3 30 13 23**

**Time4 40 14 24**

**;**

**proc sgplot data=have;**

**scatter x=time y=t700;**

**scatter x=time y=t900;**

**scatter x=time y=t1100;**

**yaxis label="Whatever";**

**run;**

PG

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-20-2014 01:49 PM

I would need to plot 700, 900, 1100 on the y-axis (or any other axis with a scale); I am looking for something like a spectral plot / Matrix plot. As we see the below example plot, frequency on x- axis, m2/hz on y-axis. period on other axis (not sure if we can call that as z- axis). Thanks

Solution

02-20-2014
05:25 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-20-2014 05:25 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-20-2014 05:53 PM

I can't imagine how to create two X or Y axes related to the same curve, such as on your Specral Density example. Especially if one scale is linear and the other isn't. - PG

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-20-2014 06:07 PM

I am taking a stab here and may be totally off the mark here...

I suppose you may (Fourier) transform a time domain signal to the frequency domain. However, I don't know if the shape of the response stays the same. However, you could plot the original (signal by time) on (y, x) axis, and then also plot (TransSignal by freq) on (y, x2). Axis type can be linear or log (2, 10 or e). Now, you could make the 2nd plot invisible by making the line thickness zero or transparency=1. This will certainly give you "some kind of" plot. You may need to set axis options for offsets, thresholds etc to ensure the axes are synchronized.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-20-2014 07:12 PM

Sanjay,

I am trying to imagine what you suggested here but not sure how to code this. As I've got about 1000 signal points for one timeperiod (signal vs time) and 3000 signal points for one frequency (signal vs frequency). Would you be able to explain this with some code. Thanks

Timeperiod | 100 | 101 | 102 | 103 | 104 | 105 |

1/2/2010 11:00 | 10 | 20 | 30 | 40 | 50 | 60 |

1/2/2010 13:30 | 20 | 30 | 40 | 50 | 60 | 70 |

1/2/2010 16:00 | 40 | 60 | 60 | 60 | 60 | 60 |

1/2/2010 18:30 | 60 | 50 | 50 | 40 | 40 | 30 |

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-20-2014 08:04 PM

Can you attach sample data set (reduced) so I can try it out? Tell me which variables to plot.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-20-2014 08:25 PM

Sanjay,

Would this help for you to try ? Frequency variables here are 100 to 105 and 10,20,40,.....70,60,30.are signals at various time periods and frequencies.

Timeperiod | 100 | 101 | 102 | 103 | 104 | 105 |

1/2/2010 11:00 | 10 | 20 | 30 | 40 | 50 | 60 |

1/2/2010 13:30 | 20 | 30 | 40 | 50 | 60 | 70 |

1/2/2010 16:00 | 40 | 60 | 60 | 60 | 60 | 60 |

1/2/2010 18:30 | 40 | 50 | 50 | 40 | 40 | 30 |

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

02-20-2014 11:48 PM

This is not clear to me. Can you attach a SAS data set with four columns. Time, Signal1, Freq, Signal2?