I'm working on a compound nomogram, the first scale of which has different values for girls and boys. (It has to do with median weights for a particular age). f(x) in each case is a logistic eqn: for boys it's 24-(8.75/(1+((age/14.7)^5))), for girls it's 22-(6.75/(1+((age/12.7)^6)))
I've drawn this out by hand previously, so I know what it's supposed to look like. However, the scales don't align, however I try - indeed the align command doesn't seem to make a difference no matter what I put in there. (I initially thought I was being very clever by using wolfram alpha to generate a conversion function, but even if I use a simple arbitrary scalar, I still get the same result.) Here's the code for the first scale, as two simple type eight blocks. No align function, as it doesn't seem to make a difference.
Code: Select all
"""
agescale.py
Copyright (C) 2011 Jason Walker
"""
from pynomo.nomographer import *
Boys_para={
'tag':'Age',
'u_min':5,
'u_max':19,
'function':lambda u:(24-(8.75/(1+((u/14.7)**5)))),
'title':r'Boys',
'tick_levels':2,
'tick_text_levels':1,
'tick_side':'left',
'title_x_shift':-0.5
}
Girls_para={
'tag':'Age',
'u_min':5,
'u_max':19,
'function':lambda u:(22-(6.75/(1+((u/12.7)**6)))),
'align':lambda u:u,
'title':r'Girls',
'tick_levels':2,
'tick_text_levels':1,
'tick_side':'right',
'title_x_shift':0.5
}
Boys_block={
'block_type':'type_8',
'f_params':Boys_para
}
Girls_block={
'block_type':'type_8',
'f_params':Girls_para
}
main_params={
'filename':'agescale.pdf',
'paper_height':20.0,
'paper_width':2.0,
'block_params':[Boys_block,Girls_block],
'transformations':[('scale paper',)]
}
Nomographer(main_params)
When I run this, the 19 mark on the girls scale is about 16.7 on the boys - which is incorrect.
Now here's the funny thing: If I don't tag them, they line up perfectly. Delete the tag commands, and it produces a double scale where 19 on the girls is ~ 17.6 on the boys, which is bang on perfect.
I'd leave it at that, but obviously when you move on to a more complicated nomogram you get your girl scale hanging around looking lost above the nomogram.
All advice gratefully accepted.
Jason