Examples of axes parameters

From Pynomo
Jump to: navigation, search

Linear Axes

Example 1

Ex axes 1.png
from pynomo.nomographer import *
 
N_params={
        'u_min':1.0,
        'u_max':10.0,
        'function':lambda u:u,
        'title':'u',
        }
 
block_params={
              'block_type':'type_8',
              'f_params':N_params,
              'width':5.0,
              'height':15.0,
                     }
 
main_params={
              'filename':'ex_axes_1.pdf',
              'paper_height':15.0,
              'paper_width':5.0,
              'block_params':[block_params],
              'transformations':[('scale paper',)]
              }
 
Nomographer(main_params)

Example 2

We put less ticks, change tick side and labelings for them:

Ex axes 2.png
from pynomo.nomographer import *
 
N_params={
        'u_min':1.0,
        'u_max':10.0,
        'function':lambda u:u,
        'title':'u',
        'tick_levels':3,
        'tick_text_levels':2,
        'tick_side':'left',
        }
block_params={
              'block_type':'type_8',
              'f_params':N_params,
              'width':5.0,
              'height':10.0,
                     }
main_params={
              'filename':'ex_axes_2.pdf',
              'paper_height':10.0,
              'paper_width':5.0,
              'block_params':[block_params],
              'transformations':[('scale paper',)]
              }
Nomographer(main_params)

Example 3

We change axis title position:

Ex axes 3a.png
from pynomo.nomographer import *
 
_params={
        'u_min':1.0,
        'u_max':10.0,
        'function':lambda u:u,
        'title':'u',
        'tick_levels':3,
        'tick_text_levels':2,
        'tick_side':'left',
        'title_x_shift':-1.0,
        'title_y_shift':0.5
        }
block_params={
              'block_type':'type_8',
              'f_params':N_params,
              'width':5.0,
              'height':10.0,
                     }
main_params={
              'filename':'ex_axes_3.pdf',
              'paper_height':10.0,
              'paper_width':5.0,
              'block_params':[block_params],
              'transformations':[('scale paper',)]
              }
Nomographer(main_params)

Example 4

We put title to center of axis and change tick and text levels at different parameters range by using 'extra_params':

Ex axes 4.png
from pynomo.nomographer import *
 
N_params={
        'u_min':1.0,
        'u_max':10.0,
        'function':lambda u:u,
        'title':'title',
        'tick_levels':2,
        'tick_text_levels':1,
        'tick_side':'left',
        'title_draw_center':True,
        'extra_params':[{
                        'u_min':5.0,
                        'u_max':10.0,
                        'tick_levels':3,
                        'tick_text_levels':2,
                        },
                        {
                        'u_min':9.0,
                        'u_max':10.0,
                        'tick_levels':4,
                        'tick_text_levels':2,
                        }
                        ]
        }
block_params={
              'block_type':'type_8',
              'f_params':N_params,
              'width':5.0,
              'height':10.0,
                     }
main_params={
              'filename':'ex_axes_4.pdf',
              'paper_height':10.0,
              'paper_width':5.0,
              'block_params':[block_params],
              'transformations':[('scale paper',)]
              }
Nomographer(main_params)

Example 4.1

We add some color and extra titles:

Ex axes 4 1.png
from pynomo.nomographer import *
 
# Ex 4.1
N_params={
        'u_min':1.0,
        'u_max':10.0,
        'function':lambda u:u,
        'title':'title',
        'tick_levels':2,
        'tick_text_levels':1,
        'tick_side':'left',
        'title_draw_center':True,
        'text_format':r"$%3.1f$ ",
        'axis_color':color.cmyk.Orange,
        'text_color':color.cmyk.Plum,
        'title_color':color.cmyk.Plum,
        'extra_params':[{
                        'u_min':5.0,
                        'u_max':10.0,
                        'tick_levels':3,
                        'tick_text_levels':2,
                        'axis_color':color.cmyk.Red,
                        },
                        {
                        'u_min':9.0,
                        'u_max':10.0,
                        'tick_levels':4,
                        'tick_text_levels':2,
                        'axis_color':color.cmyk.Blue,
                        }
                        ],
        'extra_titles':[
              {'dx':1.0,
              'dy':1.0,
              'text':'extra title 1',
              'width':5,
              'pyx_extra_defs':[color.rgb.red,text.size.tiny]
              },
              {'dx':0.0,
              'dy':2.0,
              'text':'extra title 2',
              'width':5,
              'pyx_extra_defs':[color.rgb.green]
              },
              {'dx':-1.0,
              'dy':1.0,
              'text':r"extra  \par title 3", # \par = newline
              'width':5,
              'pyx_extra_defs':[color.rgb.blue]
              }]
        }
block_params={
              'block_type':'type_8',
              'f_params':N_params,
              'width':5.0,
              'height':10.0,
                     }
main_params={
              'filename':'ex_axes_4_1.pdf',
              'paper_height':10.0,
              'paper_width':5.0,
              'block_params':[block_params],
              'transformations':[('scale paper',)]
              }
Nomographer(main_params)

Manual Axes

Example 5

We put manual points:

Ex axes 5.png
from pynomo.nomographer import *
 
N_params={
        'u_min':1.0,
        'u_max':10.0,
        'function':lambda u:u,
        'title':'title',
        'tick_levels':2,
        'tick_text_levels':1,
        'tick_side':'left',
        'title_draw_center':True,
        'scale_type':'manual point',
        'manual_axis_data': {1.0:'one',
                     2.0:'two',
                     3.0:'three',
                     3.1415:r'$\pi$',
                     4.0:'four',
                     5.0:'five',
                     6.0:'six',
                     7.0:'seven',
                     8.0:'eight',
                     9.0:'nine',
                     10.0:'ten'}
        }
block_params={
              'block_type':'type_8',
              'f_params':N_params,
              'width':5.0,
              'height':10.0,
                     }
main_params={
              'filename':'ex_axes_5.pdf',
              'paper_height':10.0,
              'paper_width':5.0,
              'block_params':[block_params],
              'transformations':[('scale paper',)]
              }
Nomographer(main_params)

Example 6

We put manual lines:

Ex axes 6.png
from pynomo.nomographer import *
 
N_params={
        'u_min':1.0,
        'u_max':10.0,
        'function':lambda u:u,
        'title':'title',
        'tick_levels':2,
        'tick_text_levels':1,
        'tick_side':'left',
        'title_draw_center':True,
        'scale_type':'manual line',
        'manual_axis_data': {1.0:'one',
                     2.0:'two',
                     3.0:'three',
                     3.1415:r'$\pi$',
                     4.0:'four',
                     5.0:'five',
                     6.0:'six',
                     7.0:'seven',
                     8.0:'eight',
                     9.0:'nine',
                     10.0:'ten'}
 
        }
block_params={
              'block_type':'type_8',
              'f_params':N_params,
              'width':5.0,
              'height':10.0,
                     }
main_params={
              'filename':'ex_axes_6.pdf',
              'paper_height':10.0,
              'paper_width':5.0,
              'block_params':[block_params],
              'transformations':[('scale paper',)]
              }
Nomographer(main_params)


Example 7

Combination of manual lines and linear scale:

Ex axes 7.png
from pynomo.nomographer import *
 
N_params={
        'u_min':1.0,
        'u_max':10.0,
        'function':lambda u:u,
        'title':'title',
        'tick_levels':2,
        'tick_text_levels':1,
        'tick_side':'left',
        'scale_type':'manual line',
        'manual_axis_data': {1.0:'one',
                     2.0:'two',
                     3.0:'three',
                     3.1415:r'$\pi$',
                     4.0:'four',
                     5.0:'five',
                     6.0:'six',
                     7.0:'seven',
                     8.0:'eight',
                     9.0:'nine',
                     10.0:'ten'},
        'extra_params':[{
                        'u_min':1.0,
                        'u_max':10.0,
                        'scale_type':'linear',
                        'tick_levels':3,
                        'tick_text_levels':2,
                        'tick_side':'right',
                        }]
        }
block_params={
              'block_type':'type_8',
              'f_params':N_params,
              'width':5.0,
              'height':10.0,
                     }
main_params={
              'filename':'ex_axes_7.pdf',
              'paper_height':10.0,
              'paper_width':5.0,
              'block_params':[block_params],
              'transformations':[('scale paper',)]
              }
Nomographer(main_params)

Example 7.1

Let's add arrow scale:

Ex axes 7 1.png
from pynomo.nomographer import *
 
# Ex 7.1
N_params={
        'u_min':1.0,
        'u_max':10.0,
        'function':lambda u:u,
        'title':r'\bf title',
        'tick_levels':2,
        'tick_text_levels':1,
        'tick_side':'left',
        'scale_type':'manual line',
        'manual_axis_data': {1.0:'one',
                     2.0:'two',
                     3.0:'three',
                     3.1415:r'$\pi$',
                     4.0:'four',
                     5.0:'five',
                     6.0:'six',
                     7.0:'seven',
                     8.0:'eight',
                     9.0:'nine',
                     10.0:'ten'},
        'extra_params':[{
                        'u_min':1.0,
                        'u_max':10.0,
                        'scale_type':'linear',
                        'tick_levels':3,
                        'tick_text_levels':2,
                        'tick_side':'right',
                        'extra_angle':90.0,
                        'text_horizontal_align_center':True,
                        'text_format':r"$%2.1f$",
                        },
                        {'scale_type':'manual arrow',
                         'manual_axis_data':{6.2830:r'$2\pi$',
                                            9.4245:r'$3\pi$'},
                         'arrow_color':color.cmyk.Sepia,
                         'arrow_length':2.0,
                         'text_color':color.cmyk.Sepia,
                        }
                        ]
        }
block_params={
              'block_type':'type_8',
              'f_params':N_params,
              'width':5.0,
              'height':10.0,
                     }
main_params={
              'filename':'ex_axes_7_1.pdf',
              'paper_height':10.0,
              'paper_width':5.0,
              'block_params':[block_params],
              'transformations':[('scale paper',)]
              }
Nomographer(main_params)

XY Axes

Example 8

Scale defined by x and y functions that are specific for type 8 single block

Ex axes 8.png
from pynomo.nomographer import *
 
N_params={
        'u_min':0.0,
        'u_max':300.0,
        'function_x':lambda u:3*sin(u/180.0*pi),
        'function_y':lambda u:3*cos(u/180.0*pi),
        'title':'u',
        'tick_levels':3,
        'tick_text_levels':1,
        'title_x_shift':-0.5,
        }
 
block_params={
              'block_type':'type_8',
              'f_params':N_params,
              'width':5.0,
              'height':15.0,
                     }
 
main_params={
              'filename':'ex_axes_8.pdf',
              'paper_height':10.0,
              'paper_width':10.0,
              'block_params':[block_params],
              'transformations':[('scale paper',)]
              }
 
Nomographer(main_params)

Example 8.1

Let's add some more definitons and color to example 8 type 8

Ex axes 8 1.png
N_params={
        'u_min':0.0,
        'u_max':300.0,
        'function_x':lambda u:3*sin(u/180.0*pi),
        'function_y':lambda u:3*cos(u/180.0*pi),
        'title':'u',
        'tick_levels':3,
        'tick_text_levels':1,
        'title_x_shift':-0.5,
         #'grid_length':0.1,
         'grid_length_0':0.8/4,
         'grid_length_1':0.6/4,
         'grid_length_2':0.5/4,
         'grid_length_3':0.4/4,
         'grid_length_4':0.3/4,
         #'text_size': text.size.scriptsize, #not used in this example
         'text_size_0': text.size.tiny,
         'text_size_1': text.size.tiny,
         'text_size_2': text.size.tiny,
         'text_size_3': text.size.tiny,
         'text_size_4': text.size.tiny,
         #'text_size_log_0': text.size.tiny, #not used in this example
         #'text_size_log_1': text.size.tiny, #not used in this example
         #'text_size_log_2': text.size.tiny, #not used in this example
         #'text_size_manual': text.size.tiny, #not used in this example
         'text_distance_0':1.2/4,
         'text_distance_1':1.1/4,
         'text_distance_2':1.0/4,
         'text_distance_3':1.0/4,
         'text_distance_4':1.0/4,
         'title_distance_center':0.7,
         'title_opposite_tick':True,
         'title_draw_center':True,
         'text_format':"$%3.1f$",
         'full_angle':True,
         'extra_angle':90.0,
         'text_horizontal_align_center':True,
         'text_format':r"$%2.0f$",
         'text_color':color.cmyk.Sepia,
        }
 
block_params={
              'block_type':'type_8',
              'f_params':N_params,
              'width':5.0,
              'height':15.0,
                     }
 
main_params={
              'filename':'ex_axes_8_1.pdf',
              'paper_height':10.0,
              'paper_width':10.0,
              'block_params':[block_params],
              'transformations':[('scale paper',)]
              }
 
Nomographer(main_params)

Logarithmic axes

Example 9

Logarithmic scale:

Ex axes 9.png
from pynomo.nomographer import *
 
N_params={
        'u_min':1.0,
        'u_max':10000.0,
        'function':lambda u:log(u),
        'title':'u',
        'scale_type':'log',
        }
 
block_params={
              'block_type':'type_8',
              'f_params':N_params,
              'width':5.0,
              'height':15.0,
                     }
 
main_params={
              'filename':'ex_axes_9.pdf',
              'paper_height':15.0,
              'paper_width':5.0,
              'block_params':[block_params],
              'transformations':[('scale paper',)]
              }
 
Nomographer(main_params)