Data visualization with SAS programming

annotate: function="image" position with pixels?

Reply
Regular Contributor
Regular Contributor
Posts: 156

annotate: function="image" position with pixels?

Dear all,

I'd like to annotate my hbar graph and plac an image over the graph with the help of the annotate function image. I have an image which is 544x15 pixel in width x height. My graph is 800px wide (I use goptions xpixels = 800). Now I'd like to position the image over the graph by using this pixel information. Something like: position it here: from x=10px, y=5px to x=554px, y=25px. Can I do that?

(The problem is that xsys and ysys are either in cells or percent - I'd like to position the image under the x axis. I tried it with percent but the result doesn't look nice.)

here's the original image:

legende_g05.png

and that's the result:

result.gif

As you can see there are little red dots and the smilies get worse on the right. I guess SAS tries to strech the image (which is a png) as I use xsys="3" (percent). That's why I'd prefer using pixels.

That's my annotate code:

code.gif

Best wishes

Eva

SAS Employee
Posts: 977

Re: annotate: function="image" position with pixels?

Hmm ... looks like what you're doing should work.

Perhaps (temporarily) experiment with style='tile', and then keep making your annotated image area a little bigger and a little bigger, until you start seeing the image getting 'tiled' (more than 1 copy visible).  Then reduce the size until you no longer see the tiling.  And then switch back to style='fit'.

Sometimes there's a bit of round-off, and sometimes 1 pixels difference can cause the image to appear dithered or stretched (which takes some trial-and-error to get looking right.

I've got a request in to R&D to add the capability to just specify the center coordinate of the annotated image, and then annotate the image at actual/perfect size (without the user having to calculate the x/y extents for the annotate).

SAS Employee
Posts: 977

Re: annotate: function="image" position with pixels?

Perhaps an alternative in this case would be to let Gchart create the color legend, and then annotate the colored smiley-faces below the annotated legend values.

Regular Contributor
Regular Contributor
Posts: 156

Re: annotate: function="image" position with pixels?

When I experiment with that - one question: does the xpixels and ypixels option in the goptions statement refer to the graph area or the data area? Maybe that's the problem.

And yes, pixels instead of cells/percent in the image annotate function would be great! Because you don't work with % or cells with images. Or just using the start position and let SAS do the rest (calculate the end position). I tried leaving out the x and y variables on the observation with function="image" but then SAS throws an error.

How would you do the alternative?

SAS Employee
Posts: 977

Re: annotate: function="image" position with pixels?

In general, the goptions xpixels & ypixels applies to the total size of the output graph.

(you can check the size of the output graph with an image viewing/editing software to verify that)

Ask a Question
Discussion stats
  • 4 replies
  • 489 views
  • 0 likes
  • 2 in conversation