# Difference between revisions of "Type 5"

## In general

Type 5 is contour block that has functional relationship:

$F_1(u) = F_2(x,v). \,$

This type of block is used commonly in nomographs that have an equation in form

$f_a(a_1,a_2,a_3,...) = f_b(u,v) \,$

and $f_b(u,v) \,$ cannot be represented as line-nomograph. Typically equation above is written as pair of equations:

$f_a(a_1,a_2,a_3,...) = x \,$

and

$f_b(u,v) = x. \,$

This equation is written in form

$F_1(u) = F_2(x,v). \,$

in order to construct this contour block. In reality block consists of horizontal lines:

$F_1(u) = y \,$

and contour lines

$F_2(x,v) = y, \,$

where x and y are the coordinates of canvas. Coordinate x is reference with name wd in block parameters and it holds

$x = f_{wd}(wd). \,$

## Simple example

In the following example

$F_1(u)=u \,$

and

$F_2(wd,v)=wd+v. \,$

Thus the original equation is

$wd=u-v. \,$

Simple example: Type 5
Generated portable document file (pdf): File:Ex type5 nomo 1.pdf

#### Source code of simple example of type 5

"""
ex_type5_nomo_1.py

Simple nomogram of type 5.

In this example: wd = u-v

This program is free software: you can redistribute it and/or modify
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
from pynomo.nomographer import *

block_params={
'block_type':'type_5',
'u_func':lambda u:u,
'v_func':lambda x,v:x+v,
'u_values':[1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0],
'v_values':[1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0],
'wd_tick_levels':2,
'wd_tick_text_levels':1,
'wd_tick_side':'right',
'wd_title':'wd = u-v',
'u_title':'u',
'v_title':'v',
'wd_title_opposite_tick':True,
'wd_title_distance_center':2.5,
'isopleth_values':[[6.5,7,'x']],
}

main_params={
'filename':'ex_type5_nomo_1.pdf',
'paper_height':10.0,
'paper_width':10.0,
'block_params':[block_params],
'transformations':[('rotate',0.01),('scale paper',)]
}

Nomographer(main_params)

## Parameters for type 5

No specific axis parameters. Everything is defined in block.

#### Block parameters

Specific block parameters for type 5
Parameter Default value Explanation
'block_type' 'type_5'

This is type 5 block

'width' 10.0

Block width (to be scaled)

'height' 10.0

Block height (to be scaled)

'mirror_x' False

If x-axis is mirrored

'mirror_y' False

If y-axis is mirrored

'u_func' --

u function. For example lambda u:u

'v_func' --

v function. For example lambda x,v:x+v

'wd_func' lambda x:x

wd function for plotting wd.

'wd_func_inv' lambda x:x

inverse of wd function for plotting wd.

'u_values' --

List of plotted u values. For example [1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0]

'u_title'
'scale_type_u' 'manual_line'

Scale type. can be

• 'linear': linear scale
• 'log': logarithmic scale
• 'manual point': Points and corresponding text positions are given manually in 'manual axis data'. No line is drawn.
• 'manual line': Ticks and corresponding text positions are given manually in 'manual axis data'. Line is drawn.
'u_tick_side' --

Tick and text side in final paper. Can be:

• 'right'
• 'left'
'u_tag' 'none'

To align blocks w.r.t each other along axes with same tag

'u_reference' False

If axis is treated as reference line that is a turning point.

'u_tick_levels' 0

How many levels (minor, minor-minor, etc.) of ticks are drawn. Largest effect to 'linear' scale.

'u_tick_text_levels' 0

How many levels (minor, minor-minor, etc.) of texts are drawn. Largest effect to 'linear' scale.

'u_title_opposite_tick' False

Title in opposite direction w.r.t ticks

'u_title_distance_center' 1.5

Distance of centered title from line if centered title

'u_title_draw_center' False

Title is drawn to center of line

'v_values' --

List of plotted v values. For example [1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0]

'v_title'

v axis title.

'v_tick_side' 'right'

Tick and text side in final paper. Can be:

• 'right'
• 'left'
'v_tag' 'none'

To align blocks w.r.t each other along axes with same tag

'v_reference' False

If axis is treated as reference line that is a turning point.

'v_title_opposite_tick' False

Title in opposite direction w.r.t ticks

'v_title_distance_center' 1.5

Distance of centered title from line if centered title

'v_title_draw_center' True

Title is drawn to center of line

'wd_title' --

Axis title

'scale_type_wd' 'linear'

Scale type. can be

• 'linear': linear scale
• 'log': logarithmic scale
• 'manual point': Points and corresponding text positions are given manually in 'manual axis data'. No line is drawn.
• 'manual line': Ticks and corresponding text positions are given manually in 'manual axis data'. Line is drawn.
'wd_tick_side' --

Tick and text side in final paper. Can be:

• 'right'
• 'left'
'wd_tag' 'none'

To align blocks w.r.t each other along axes with same tag

'wd_reference' False

If axis is treated as reference line that is a turning point.

'wd_tick_levels' 0

How many levels (minor, minor-minor, etc.) of ticks are drawn. Largest effect to 'linear' scale.

'wd_tick_text_levels' 0

How many levels (minor, minor-minor, etc.) of texts are drawn. Largest effect to 'linear' scale.

'wd_title_opposite_tick' False

Title in opposite direction w.r.t ticks

'wd_title_distance_center' 1.5

Distance of centered title from line if centered title

'wd_title_draw_center' False

Title is drawn to center of line

'u_text_format' r"$%3.2f$ "

number format

'v_text_format' r"$%3.2f$ "

number format

'u_align_func' lambda u:u

for block alignment

'wd_align_func' lambda u:u

for block alignment

'u_axis_color' color.rgb.black

Color of u-scale

'u_text_color' color.rgb.black

Color of u-scale texts

'u_title_color' color.rgb.black

Color of u-scale title

'v_axis_color' color.rgb.black

Color of v-scale

'v_text_color' color.rgb.black

Color of v-scale texts

'v_title_color' color.rgb.black

Color of v-scale title

'wd_axis_color' color.rgb.black

Color of wd-scale

'wd_text_color' color.rgb.black

Color of wd-scale texts

'wd_title_color' color.rgb.black

Color of wd-scale title

'isopleth_values' [[]]

List of list of isopleth values. Unknown values are given with strings, e.g. 'x'. An example:

'isopleth_values':[[0.8,'x',0.7],[0.7,0.8,'x']]

#### General main parameters

General main parameters
Parameter Default value Explanation
'filename' --

filename of generated pdf

'paper_height' 10.0

Height of paper (roughly, ticks and texts extend this)

'paper_width' 10.0

Width of paper (roughly, ticks and texts extend this)

'block_params' --

List of blocks that make the nomograph

'transformations' --

List of transformations to transform nomograph

'title_str' --

Title string of nomograph

'title_x' --

Title x-position

'title_y' --

Title y-position

'title_box_width' --

Title box width

'title_color' color.rgb.black

Title color

'make_grid' False

If True, draws grid to help position texts, etc.

'draw_lines' False

If True, draws (brute-force) lines according to 'line_params'

'line_params' []

OBSOLETE, USE ISOPLETHS. List of dics of (brute-force) lines. For example:

[{'coords':[[0,0,1,1],[2,2,3,3]],
'line_style':[color.cmyk.Black,
style.linewidth.thick,
style.linestyle.dashed],
'circle_size':0.0005,
'circle_color':color.cmyk.Black,
}]
'pre_func' None

PyX function(canvas) to draw under nomograph. Function definitin could be:

def post(c):
c.stroke(path.line(2, 2, 15, 2) +
path.line(15, 2, 10, 15) +
path.line(15, 15, 2, 15) +
path.line(2, 15, 2, 2))
'post_func' None

PyX function(canvas) to draw over nomograph. Definiton same as for 'pre_func'.

'debug' False

If True, prints dicts of definions. Feature in PyNomo 0.2.1: not all default values are printed.

'extra_texts' []

List of dicts defining extra texts. Could be for example:

[{'x':1.0,
'y':1.0,
'text':'testing',
'width':5,
'pyx_extra_defs':[color.rgb.red,text.size.Huge]
},
{'x':1.0,
'y':2.0,
'text':'testing',
'width':5,
'pyx_extra_defs':[color.rgb.green]
},
{'x':1.0,
'y':3.0,
'text':r"line \par break",
'width':5,
'pyx_extra_defs':[color.rgb.blue,text.size.tiny]
}]
'isopleth_params' [{}]

List of dicts defining isopleths. Could be for example:

[{'color':'MidnightBlue',
'linewidth':'THICK',
'linestyle':'dashdotted',
'transparency':0.2},
{'color':'Orange',
'linewidth':'THIN',
'linestyle':'dashdotted',
'transparency':0.9}]