azogue / psychrochart

A Python 3 library to make psychrometric charts and overlay information on them.
MIT License
99 stars 26 forks source link

How to create a zone with vapour content limit? #28

Closed Mifehr closed 1 year ago

Mifehr commented 1 year ago

Hi,

Thanks a lot for this package. It's helpful and good-looking, especially with the predefined styles.

My question: How can I create a zone that covers the entire graph up to a certain water vapour content (g/kg)?

azogue commented 1 year ago

Hi @Mifehr 👋,

Sorry for the delay in replying 🙏, I had totally forgotten about this library, for years (and had GH notifications muted 🙈)

If you are still interested, I'm now trying to refresh the library and solve almost all issues (Check the latest releases 😜)

How can I create a zone that covers the entire graph up to a certain water vapour content (g/kg)?

You mean zones like these, right?

chart-zones-wmax-zoom-out

azogue commented 1 year ago

With #36, with version >= 0.9.1, making a zone that covers the entire graph up to a certain water vapour content (g/kg) is done like this:

from psychrochart import PsychroChart, ChartZone, ZoneStyle

chart = PsychroChart.create("minimal")
chart.config.figure.figsize = 8, 6
chart.config.chart_params.zones.append(
    ChartZone(
        zone_type="dbt-wmax",
        # using the current plot limits to cover the entire area up to w=20 g/kg
        points_x=[chart.config.dbt_min, chart.config.dbt_max],
        points_y=[chart.config.w_min, 20],
        style=ZoneStyle(edgecolor="k", facecolor="#e4a039", linewidth=0),
        label="Up to 20 $g_w / kg_{da}$",
    )
)
chart.plot_over_saturated_zone(color_fill="#5A90E4")
chart.save("chart-saturation-zones.png")

Producing this image: chart-saturation-zones

I hope you find it helpful 🍻