BookmarkSubscribeRSS Feed
Quartz | Level 8 Eva
Quartz | Level 8

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:


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:


Best wishes


Meteorite | Level 14

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).

Meteorite | Level 14

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.

Quartz | Level 8 Eva
Quartz | Level 8

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?

Meteorite | Level 14

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)



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 2 in conversation