Yet another problem with pslegend (vector)

Added by Guillaume over 1 year ago

Hi !

I am using GMT 5.4.5 and I would like to add a properly scaled arrow with pslegend. I tried to follow different examples and to look at the other posts (such as EMA's one last month), but I can't scale the arrow properly. I think it could come from my misunderstanding of the -Q+n option mixed with the -Si option for grdvector.

The script itself is quite long, but the main points are :

$map_size : ratio in cm/degree (paper width / longitude extension).
$vec_sc : maximum size wanted for vector (here it's 1110km on map for 35 m/s , which scaled with map_size gives 2 cm on paper).
$vec_unit : the correspondance 1 unit is equal to 31km so 35 units gives 1110km as wanted (line above).

VEC_SHP="-W${vec_pn}+s -Gblack -Q${vec_hd}+jc+e+a50+n${vec_sc} -Si${vec_unit}".

After that I run grdvector, everything looks fine... then I add the pslegend layer.
As I scaled down the arrows in grdvector with the -Q+n option, I have to also scale down the legend to match right? So ...

$lgn_marker=30 : arbitrarily chosen
$vec_dwn=$lgn_marker/$vec_max : the ratio XX/35 supposedly applied in grdvector (as 35 is my reference in $vec_sc)
$vv_shape=$(echo "scale=3; $vec_hd*$vec_dwn;"|bc)c+e
$vv_size=$(echo "scale=3; $lgn_marker*$vec_unit/111*$map_size*$vec_dwn;"|bc)c
$vv_pen=$(echo "scale=3; $vec_pn*$vec_dwn;"|bc)

S C v$vv_shape $vv_size black $vv_pen

But the result is obviously wrong (the longest vector here should represents 12m/s)... Help ?