Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Magics is internally working in cm. All the superpage, page and subpage dimension should be given in cm.  When working with png, you can set the parameter output_width to the number of pixel you want.  Magics will map this width with super_page_x_length to define a ratio and compute the height in pixel.
  2. In the following example : we set the output_width to 1200, the page is the default A4 landscape. 1200 will match 29.7, the height will be computed to respect the aspect ratio ie, the height will be 848.


    Code Block
    languagepy
    titlePython Example : resize a png
    collapsetrue
    from Magics.macro import *
    #Setting output
    output = output(
        output_formats                = ['png'],
    	output_name                   = 'size',
        output_name_first_page_number = 'off',
    	output_width = 1200)
    #Setting the coastlines
    background = mcoast(
        map_coastline_land_shade        = 'on',
        map_coastline_land_shade_colour = 'cream')
    #Setting data
    grib = mgrib(grib_input_file_name = "path/data.grib")
    #Defining the contour
    contour = mcont(
    )
    #Plotting
    plot(output, background, grib, data)


           

...