Document #: US-13265,EN ------------------------------------------------------------------------------ Major subject: analysis Minor subjects: tech_notes Keywords: Abstract: VIGRAPH: Commonly Asked Questions and Answers - Equivalent to Release 6 Technical Note #25 or note #81 in Release 5. Expert note: VIGRAPH: Commonly Asked Questions and Answers ============================================== Overview -------- The following several pages will assist you in more fully realizing the benefits of VIGRAPH. Covered in a question and answer format are illus- trations on graphic presentation and data organization methods suitable for the best use of VIGRAPH. o How do you get hatch patterns to appear on your graph? o How do you get more than one line or bar color or marktype on a graph? o How do you produce a histogram (frequency bar chart) using VIGRAPH? QUESTION 1 ---------- How do you get hatch patterns to appear on your graph? ANSWER 1 -------- The profile screen allows you to change the presentation level of the plot. Presentation level 4 provides fully detailed colored hatch pat- terns in place of solid colors (level 5). Presentation level 3 present the hatch patterns in monochrome. Here is an example of the profile screen. Note that the presentation level can be changed in 4 places: main layout, edit, layering and plotter. EDITOR OPTIONS Presentation levels: main layout: 3 edit: 2 layering: 1 Error explanations (y/n): y Confirmation checks (y/n): y Hold redraw on edit (y/n): n Truncation length for data: 0 Font comparison character: g PLOTTER DATA Plot location: Empty location indicates plot directly to terminal. Device type: tek4105c Empty type defaults to terminal type. Presentation level: 4 ________________________________________________________________________________ QUESTION 2 ---------- How do you get more than one line or bar color or marktype on a graph? ANSWER 2 -------- You have to organize your data so that the values for the legend are in a column, and that value is repeated for the appropriate x and y values. For example, if you want to plot sales by month for several depart- ments, where the bar for each department is a different color, your table should look like this: |sales |month |dept | |-------------------------------| | $20.00|Jan |Shoe | | $13.00|Feb |Shoe | | $35.00|Mar |Shoe | | $15.00|Jan |Toy | | $17.00|Feb |Toy | | $21.00|Mar |Toy | | $25.00|Jan |Coat | | $18.00|Feb |Coat | | $28.00|Mar |Coat | |-------------------------------| The dept column will provide the legend labels and will be associated with a color or pattern for bar charts, line type for line graphs, or mark types for scatter plots. VIGRAPH - Data Mapping Specification Available columns +------------+---------+ |Column Name |Format | |------------+---------| Table or view to graph: mon_sales |sales |money | |month |c3 | |dept |c5 | Horizontal axis (X): month | | | | | | Vertical axis (Y): sales | | | | | | Optional series column (Z): dept | | | | | | Sort: no +------------+---------+ Be sure to change the sort from the default of yes to no. Otherwise the months would come out in sorted order. It will sometimes be necessary to include an extra column in your table to preserve the correct sort order. Please refer to Chapter 4 in the VIGRAPH User's Guide for more information on data preparation. QUESTION 3 ---------- How do you produce a histogram (frequency bar chart) using VIGRAPH? Given a table that contains a column (A) that had some data values in it like this: table1 How do you get a plot that looks like this: |a | |----------| 4-| _____ | 1.543| | | | | 2.632| 3-| _____ | | _____ | 4.113| | | | | | | | | 5.437| 2-| | | | | _____ | | | 6.002| | | | | | | | | | | 7.100| 1-| | | | | | | | | | 9.030| | | | | | | | | | | 10.000| -------------------------------------- | 14.550| 0-5 5-10 10-15 15-20 | 15.980| | 18.220| | 19.104| Where the X axis is a range of buckets for |----------| column A values and the Y axis is the frequency of occurrences of X. ANSWER 3 -------- You can produce a histogram with a few simple steps. 1. Create a temporary table with the following definition: In SQL: CREATE TABLE temp (seq integer2, bucket vchar(6), b_begin float4, b_end float4); In QUEL: CREATE temp (seq=i2,bucket=text(6),b_begin=f4,b_end=f4) 2. Using QBF, or the query language in the terminal monitor, populate the temporary table with bucket ranges. For example: temp table |seq |bucket|b_begin |b_end | |-----------------------------------| | 1|0-5 | 0.000| 4.990| | 2|5-10 | 5.000| 9.990| | 3|10-15 | 10.000| 14.990| | 4|15-20 | 15.000| 19.990| |-----------------------------------| The sequence column(seq) is needed so that the buckets come out in the order specified rather than in sorted order. 3. Create a view with the following definition: In SQL: CREATE VIEW histogram (seq,xcol,ycol) AS SELECT temp.seq, temp.bucket, count(table1.a) FROM temp,table1 WHERE table1.a BETWEEN temp.b_begin and temp.b_end GROUP BY temp.seq,temp.bucket; In QUEL: DEFINE VIEW histogram ( temp.seq, xcol=temp.bucket, ycol=count(table1.A BY temp.bucket WHERE table1.A >=temp.b_begin AND table1.A <= temp.b_end)) The resulting view contains the following data and can be used as the basis for your graph: |seq |xcol |ycol | |---------------------------| | 1|0-5 | 3| | 2|5-10 | 4| | 3|10-15 | 2| | 4|15-20 | 3| |---------------------------| 4. On the MapData screen in VIGRAPH, make sure you say no to sorting, because if you leave the default of yes, the values in the xcol will be sorted. Here is an example of a MapData screen: VIGRAPH - Data Mapping Specification Available columns +------------+---------+ |Column Name |Format | |------------+---------| Table or view to graph: histogram |seq |i1 | |xcol |text(6) | |ycol |i4 | Horizontal axis (X): xcol | | | | | | Vertical axis (Y): ycol | | | | | | Optional series column (Z): | | | | | | Sort: no +------------+---------+ Releases affected: all(all.all) - Releases not affected: Errors: Bugs/SIRS: ------------------------------------------------------------------------------
© William Yuan 2000
Email William