Data visualization with SAS programming

DRAWTEXT to the left of row axis.

Reply
Respected Advisor
Posts: 3,775

DRAWTEXT to the left of row axis.

So I decided to annotate my Y axis tick labels.  This drawtext statement works to place the text at the correct Y value and X=-10 is pretty close to where I want it on the left.

     drawtext 'this is it' / x=-10 xaxis=x2 y='10-001'  xspace=layoutpercent yspace=datavalue;

There's just one small problem the text is drawn in all columns (in my case 2) and I can't figure out how to only get it drawn in one column.

If I move the statement to outside the LAYOUT PROTOTYPE; block I cannot use YSPACE=DATAVALUE and I don't see how I can find the correct place to draw the text.

SAS Super FREQ
Posts: 890

Re: DRAWTEXT to the left of row axis.

What if you moved the draw text outside of the prototype and used "layoutpercent" for the Y as well?

Respected Advisor
Posts: 3,775

Re: DRAWTEXT to the left of row axis.

DanH@sas wrote:

What if you moved the draw text outside of the prototype and used "layoutpercent" for the Y as well?

But how can I associated the text with the Y tick values when I change to percent.  I am trying to label the common Y similar to way the X is is annotated here.  44129 - Split axis values across multiple lines with the Graph Template Language (GTL)

I want multiple calls to produce uniform panels, this question. https://communities.sas.com/message/193891#193891

I've got part of that working using a fixed font for Y axis tick labels of all 'a0'x and then annotate the values I wan't using DRAWTEXT with proportional font.

Maybe I'm doing it all wrong and need to start over.Smiley Happy

SAS Super FREQ
Posts: 1,081

Re: DRAWTEXT to the left of row axis.

Any statements in the PROTOTYPE of a LAYOUT DATAPANEL are always drawn in all the cells.  So, any DRAW statements will also draw in both cells.  This would be fine for the two X axes if they are UNION, and in both cases, a negative Y dimension will take you below each axis line.  For Y axis, the negative X dimension will take you to the left of both cells, which is ok for left cell, but not the right cell.  Example 44129 is for a single cell graph.

But, DATAPANEL creates equal size cells anyway, so I don't understand the issue.  Can you attach your graph output?

You could use a 1x2  LAYOUT LATTICE, and populate each cell yourself with the right plot statements with the subset of the data.  In GTL, you can use the IFN or IFC syntax to subset the data by a class variable.  Keeping Y axis for both cells, you can then use the DRAW statements in each LAYOUT OVERLAY to draw the split axis tick values.  You will have to do something to reserve the right amount of white space for DRAWing the custom tick values.

SAS 9.4 will do split tick values for you with just an option.  This was going to be the topic of my next blog.  :-)

Ask a Question
Discussion stats
  • 3 replies
  • 379 views
  • 0 likes
  • 3 in conversation