Starlink / starlink

Starlink Software Collection
162 stars 53 forks source link

KAPPA: Devise a means of plotting DISPLAY's key aligned with the DATA… #69

Closed MalcolmCurrie closed 4 years ago

MalcolmCurrie commented 4 years ago

… picture.

It seems to be a common requirement in journals for image graphics to include an intensity key besides each image, and this key has most commonly the height of the image. It gives the best resolution of the colour ramp and looks neat.

Trying to achieve this in KAPPA adjusting various parameters proved fruitless, in the main because of KAPLIBS subroutine KPG1_ASSHR that allocates plenty of room for annotations and typically leading to a key that is only circa two thirds of the height of the image. So I've hacked the code without changing any APIs to make this possible.

There were two main steps: a) adjust the KEY picture height so that it matches the DATA picture vertical bounds; and

b) let the vertical placement value be negative (the PAR_GDR1R call already allowed this), and recognise a such a negative value as a request not to reduced the key vertical plotting area for annotations, gaps, tick marks etc..

Specifically, for a) I introduced a position code of D (for Data) for the key placement, and for b) I used negative KEYPOS(2)->RJUST(1) in a test near the end of KPG1_ASSHR to assign GBOX(2/4) to TBOX(2/4). Yes some of the intervening calculations in the latter are superfluous for this special case, but I didn't want to hack with lots of IF clauses or mess anything up for normal operation.

To give this option more visibility I added an example in DISPLAY. If approved, then we should add a item with an example graphic in the JCMT Software Blog.

I also fixed a bug in display.f, where only one KEYPOS value was being passed to a two-element RJUST in KPG1_LUTKY.

sfgraves commented 4 years ago

This feature sounds great Malcolm. The display keys being so awkward looking was one of the reasons I originally switched away from using Starlink plotting routines.

MalcolmCurrie commented 4 years ago

Thank you Sarah. One other thing I've not done, but arguably should have, is to narrow the KEY picture to reduce the unwanted whitespace.

MalcolmCurrie commented 4 years ago

Thank you David. Glad to know that I'd not messed up your code.