File:Heat index plot.svg

Summary

Description
English: Plot of heat index based on relative humidity and temperature in °C
Date
Source Own work
Author Morn
Other versions
SVG development
InfoField
Source code
InfoField

Python code

Source code
#!/usr/bin/env python

# Plot Heat index graph with Matplotlib

from pylab import *

figure(figsize = (10, 9))
tt = range(20, 51)

def heat_index(t, r):
    "Calculate Heat index for T (°C) and RH (%)"

    c1 = -8.78469475556
    c2 = 1.61139411
    c3 = 2.33854883889
    c4 = -.14611605
    c5 = -.012308094
    c6 = -.0164248277778
    c7 = 2.211732e-3
    c8 = 7.2546e-4
    c9 = -3.582e-6

    hi = c1 + c2*t + c3*r + c4*t*r + c5*t*t + c6*r*r + c7*t*t*r + c8*t*r*r + c9*t*t*r*r
    return round(hi)

for r in range(100, 30, -10):
    plot(tt, [heat_index(t, r) for t in tt], label = "RH = %u%%" % r,
        lw = 1.5, ls = "dashed", marker = "o")

legend()
fill_between(tt, 0, 26.5,    color = "#0f0",    alpha = .5)
fill_between(tt, 26.5, 31.5, color = "#ff6",    alpha = .5)
fill_between(tt, 31.5, 40.5, color = "#ffd700", alpha = .5)
fill_between(tt, 40.5, 53.5, color = "#ff8c00", alpha = .5)
fill_between(tt, 53.5, 200,  color = "#f00",    alpha = .4)

xticks(range(100))
yticks(range(150))
axis([27, 45, 27, 60])
xlabel("T [°C]")
ylabel("Heat index")
title("Heat index based on temperature and relative humidity")
grid()
savefig("heat_index_plot.svg")

show()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#Heat%20index%20plot.svgCategory:Self-published work
Category:Heat Index
Category:CC-Zero Category:Heat Index Category:Self-published work Category:Valid SVG created with Matplotlib code