Data visualization with SAS programming

Two kinds of graphs, shared/common axis?

Reply
Contributor
Posts: 21

Two kinds of graphs, shared/common axis?

Can SGPANEL or SGRENDER be used to put two graphs on a page that _share_ an axis? 

Here's what I would like to do: I have a variable which changes during the day, different values for each category, so I am doing an area chart to show that.  The variations depend upon different processes which are happening, for which I have the start and end times.   I would like to share the horizontal axis which will be 24 hours with a tick each quarter hour,  on top I want the area chart, below I want to do a horizontal high-low chart with the categories on the vertical axis being the process identifiers, and the bars representing the duration of the process.

SAS Super FREQ
Posts: 1,044

Re: Two kinds of graphs, shared/common axis?

Yes, you can build a GTL template with two graphs and common X axis.  There are many examples, and you can customize to your needs.  Here are a couple of examples from the support page:

35171 - Histogram with Normal and Kernel Density Curves

35040 - Monthly Stock Price and Volume Graph

Contributor
Posts: 21

Re: Two kinds of graphs, shared/common axis?

Those are helpful, and I will do more reading about templates but not quite what I was asking.  The examples show multiple charts from on dataset.   I actually have two datasets;  one for the upper chart - the dataset containing the variable I am doing the area chart for -  and one for the lower chart - the start/stop time of the processes.  Since the variable which changes during the day is measured at regular intervals,  and the start/stop times of the processes do not conform to those intervals, I do not think I can merge the two datasets .

SAS Super FREQ
Posts: 1,044

Re: Two kinds of graphs, shared/common axis?

The procedure only supports one data set per graph.  So, you have to merge the data.  It is OK to have two columns (X & Y) for the upper graph and two different columns (X2, Y2) for the lower.  As long as X and X2 are of the same type, the axes can be merged by the graph.  We do that with the survival plot.  The survival graph is with x=Time and the lower at risk table graph is using x=TAtTisk.

Post a Question
Discussion Stats
  • 3 replies
  • 382 views
  • 3 likes
  • 2 in conversation