def _make_chart(path_save=None): chart = PsychroChart("minimal") # Zones: zones_conf = { "zones": [{ "zone_type": "dbt-rh", "style": { "edgecolor": [1.0, 0.749, 0.0, 0.8], "facecolor": [1.0, 0.749, 0.0, 0.2], "linewidth": 2, "linestyle": "--" }, "points_x": [23, 28], "points_y": [40, 60], "label": "Summer" }, { "zone_type": "dbt-rh", "style": { "edgecolor": [0.498, 0.624, 0.8], "facecolor": [0.498, 0.624, 1.0, 0.2], "linewidth": 2, "linestyle": "--" }, "points_x": [18, 23], "points_y": [35, 55], "label": "Winter" }] } chart.append_zones(zones_conf) # Plotting chart.plot() # Vertical lines t_min, t_opt, t_max = 16, 23, 30 chart.plot_vertical_dry_bulb_temp_line(t_min, { "color": [0.0, 0.125, 0.376], "lw": 2, "ls": ':' }, ' TOO COLD ({}°C)'.format(t_min), ha='left', loc=0., fontsize=14) chart.plot_vertical_dry_bulb_temp_line(t_opt, { "color": [0.475, 0.612, 0.075], "lw": 2, "ls": ':' }) chart.plot_vertical_dry_bulb_temp_line(t_max, { "color": [1.0, 0.0, 0.247], "lw": 2, "ls": ':' }, 'TOO HOT ({}°C) '.format(t_max), ha='right', loc=1, reverse=True, fontsize=14) # Save to disk the base chart if path_save is not None: path_svg = os.path.join(basedir, path_save) chart.save(path_svg) return chart
def test_custom_psychrochart_2(self): """Customize a chart with some additions from a default style.""" # Load config config = load_config("minimal") # Customization config['limits']['pressure_kpa'] = 90.5 config['figure']['x_label'] = None config['figure']['y_label'] = None config['saturation']['linewidth'] = 3 config['chart_params']['with_constant_dry_temp'] = False config['chart_params']['with_constant_humidity'] = False config['chart_params']['with_constant_wet_temp'] = False config['chart_params']['with_constant_h'] = False # Chart creation chart = PsychroChart(config) self.assertEqual(90.5, chart.p_atm_kpa) # Zones: zones_conf = { "zones": [ { "zone_type": "xy-points", "style": { "linewidth": 2, "linestyle": "--", # "color": [0.831, 0.839, 0.0], "edgecolor": [0.498, 0.624, 0.8], "facecolor": [0.498, 0.624, 1.0, 0.3] }, "points_x": [23, 28, 28, 24, 23], "points_y": [1, 3, 4, 4, 2], "label": "Custom" }, { "zone_type": "not_recognized_type", "label": "Bad zone" } ] } chart.append_zones(zones_conf) # Plotting chart.plot() points = { 'exterior': (31.06, 32.9), 'exterior_estimated': (36.7, 25.0), 'interior': (29.42, 52.34) } convex_groups = [ (['exterior', 'exterior_estimated', 'interior'], {}, {}), ] points_plot = chart.plot_points_dbt_rh(points, convex_groups=convex_groups) print('Points in chart: %s' % points_plot) # Legend chart.plot_legend(markerscale=1., fontsize=11, labelspacing=1.3) # Save to disk path_svg = os.path.join(basedir, 'chart_overlay_test.svg') chart.save(path_svg)
def _make_chart(path_save=None): chart = PsychroChart("minimal") # Zones: zones_conf = { "zones": [ { "zone_type": "dbt-rh", "style": { "edgecolor": [1.0, 0.749, 0.0, 0.8], "facecolor": [1.0, 0.749, 0.0, 0.2], "linewidth": 2, "linestyle": "--", }, "points_x": [23, 28], "points_y": [40, 60], "label": "Summer", }, { "zone_type": "dbt-rh", "style": { "edgecolor": [0.498, 0.624, 0.8], "facecolor": [0.498, 0.624, 1.0, 0.2], "linewidth": 2, "linestyle": "--", }, "points_x": [18, 23], "points_y": [35, 55], "label": "Winter", }, ] } chart.append_zones(zones_conf) # Plotting chart.plot() # Vertical lines t_min, t_opt, t_max = 16, 23, 30 chart.plot_vertical_dry_bulb_temp_line( t_min, { "color": [0.0, 0.125, 0.376], "lw": 2, "ls": ":" }, f" TOO COLD ({t_min}°C)", ha="left", loc=0.0, fontsize=14, ) chart.plot_vertical_dry_bulb_temp_line(t_opt, { "color": [0.475, 0.612, 0.075], "lw": 2, "ls": ":" }) chart.plot_vertical_dry_bulb_temp_line( t_max, { "color": [1.0, 0.0, 0.247], "lw": 2, "ls": ":" }, f"TOO HOT ({t_max}°C) ", ha="right", loc=1, reverse=True, fontsize=14, ) # Save to disk the base chart if path_save is not None: path_svg = TEST_BASEDIR / path_save chart.save(path_svg) return chart