03-15-2013 03:49 AM
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:
and that's the result:
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:
03-15-2013 08:20 AM
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).
03-15-2013 08:23 AM
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.
03-18-2013 06:18 AM
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?
03-18-2013 08:11 AM
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)