	program magics

	call popen

	call pset1c("output_formats", (/"png"/), 1)
	call psetc("output_name", "legend3")
	call psetc("output_name_first_page_number", "off")

	call psetr("subpage_upper_right_longitude", 8.00)
	call psetr("subpage_upper_right_latitude", 44.00)
	call psetr("subpage_lower_left_latitude", 34.00)
	call psetr("subpage_map_vertical_longitude", 0.00)
	call psetr("subpage_lower_left_longitude", -12.00)
	call psetc("subpage_map_projection", "polar_stereographic")

	call psetc("grib_id", "t850")
	call psetc("grib_input_file_name", "./t850.grb")
	call pgrib

	call psetc("contour_level_selection_type", "level_list")
	call psetc("contour_shade_method", "area_fill")
	call psetc("contour_shade", "on")
	call pset1r("contour_level_list", (/-15.00, -12.00, -9.00, -6.00, -3.00, 0.00, 3.00, 6.00, 9.00, 12.00, 15.00/), 11)
	call psetc("contour_shade_colour_direction", "clockwise")
	call psetc("contour_hilo", "off")
	call psetc("contour", "off")
	call psetc("contour_label", "off")
	call psetc("contour_shade_max_level_colour", "red")
	call psetc("legend", "on")
	call psetc("contour_shade_min_level_colour", "blue")
	call pcont

	call psetc("grib_id", "z500")
	call psetc("grib_input_file_name", "./z500.grb")
	call pgrib

	call psetc("contour_level_selection_type", "interval")
	call psetc("contour_line_colour", "black")
	call psetr("contour_hilo_height", 0.25)
	call psetc("contour_hilo", "on")
	call psetc("contour_hilo_quality", "high")
	call pseti("contour_line_thickness", 1)
	call psetc("contour_label", "off")
	call psetc("contour_highlight_colour", "black")
	call pseti("contour_highlight_thickness", 2)
	call psetc("legend", "off")
	call psetr("contour_interval", 5.00)
	call pcont

	call psetc("map_coastline_resolution", "high")
	call psetc("map_grid_colour", "tan")
	call psetc("map_grid", "on")
	call psetc("map_coastline_colour", "tan")
	call pcoast

	call pset1c("text_lines", (/"<font size='1'>Positional and histogram legend</font>", "", "", "", "", ""/), 6)
	call psetr("text_font_size", 0.50)
	call psetc("text_justification", "left")
	call psetc("text_colour", "charcoal")
	call ptext

	call psetr("legend_box_x_position", 1.00)
	call psetc("legend_display_type", "histogram")
	call pseti("legend_label_frequency", 1)
	call psetr("legend_box_y_position", 16.00)
	call psetr("legend_box_x_length", 27.00)
	call psetc("legend_title", "on")
	call psetr("legend_text_font_size", 0.50)
	call psetc("legend_box_mode", "positional")
	call psetc("legend_text_colour", "black")
	call psetc("legend_histogram_mean_value", "on")
	call psetr("legend_box_y_length", 3.00)
	call psetc("legend", "on")
	call psetc("legend_title_text", "Temperature at 850 hPa")

	call pclose

	end
