Plot types - BHoM/LadybugTools_Toolkit GitHub Wiki
Python files related to plots are available under C:\ProgramData\BHoM\Extensions\PythonCode\LadybugTools_Toolkit\src\ladybugtools_toolkit\plot
Axes and figures
Some plot types return an axis object rather than a figure object. This provides more flexibility as multiple axes can now be added to the same figure.
To set up a figure with a single axis:
import matplotlib.pyplot as plt
from ladybugtools_toolkit.plot import utci_journey
fig, ax = plt.subplots(1, 1, figsize=(10,3))
utci_journey([23,34,12], ax=ax)
This sets up a figure with a single subplot (the 1, 1
means 1 subplot along and 1 subplot down), sets its size, and adds a utci_journey to the figure.
_condensation_potential
Create a plot of the condensation potential for a given set of timeseries dry bulb temperature and dew point temperature.
Args:
dry_bulb_temperature (pd.Series):
The dry bulb temperature dataset.
dew_point_temperature (pd.Series):
The dew point temperature dataset.
ax (plt.Axes, optional):
An optional plt.Axes object to populate. Defaults to None,
which creates a new plt.Axes object.
dbt_quantile (float, optional):
The quantile of the dry bulb temperature to use for the
condensation potential calculation. Defaults to 0.1.
dpt_quantile (float, optional):
The quantile of the dew point temperature to use for the
condensation potential calculation. Defaults to 0.9.
**kwargs:
A set of kwargs to pass to plt.plot.
Returns:
plt.Axes: The plt.Axes object populated with the plot.
from ladybug.epw import EPW
from ladybugtools_toolkit.ladybug_extension.datacollection import collection_to_series
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
temp = collection_to_series(epw.dry_bulb_temperature)
dewp = collection_to_series(epw.dew_point_temperature)
from ladybugtools_toolkit.plot._condensation_potential import condensation_potential
condensation_potential(temp, dewp)
_degree_days
Plot the heating and cooling degree days from a given EPW object.
Args:
epw (EPW):
An EPW object.
heat_base (float, optional):
The temperature at which heating kicks in. Defaults to 18.
cool_base (float, optional):
The temperature at which cooling kicks in. Defaults to 23.
**kwargs:
Additional keyword arguments to pass to the plot. These can include:
heat_color (str):
The color of the heating degree days bars.
cool_color (str):
The color of the cooling degree days bars.
figsize (Tuple[float]):
The size of the figure.
Returns:
Figure:
A matplotlib Figure object.
You can plot heating and cooling in the same plot (degree_days), or plot them separately (heating_degree_days), (cooling_degree_days)
from ladybug.epw import EPW
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
from ladybugtools_toolkit.plot._degree_days import degree_days
from ladybugtools_toolkit.plot._degree_days import heating_degree_days
from ladybugtools_toolkit.plot._degree_days import cooling_degree_days
degree_days(epw)
heating_degree_days(epw)
cooling_degree_days(epw)
_evaporative_cooling_potential
Plot evaporative cooling potential (DBT - DPT).
Args:
dbt (pd.Series):
A pandas Series containing Dry Bulb Temperature data.
dpt (pd.Series):
A pandas Series containing Dew Point Temperature data.
ax (plt.Axes, optional):
The matplotlib axes to plot the figure on. Defaults to None.
**kwargs:
Additional keyword arguments to pass to the heatmap function.
Returns:
plt.Axes: The matplotlib axes.
from ladybug.epw import EPW
from ladybugtools_toolkit.ladybug_extension.datacollection import collection_to_series
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
temp = collection_to_series(epw.dry_bulb_temperature)
dewp = collection_to_series(epw.dew_point_temperature)
from ladybugtools_toolkit.plot._evaporative_cooling_potential import evaporative_cooling_potential
evaporative_cooling_potential(temp,dewp)
_radiand_cooling_potential
Plot radiant cooling potential.
Args:
dpt (pd.Series):
A pandas series of dew point temperature.
ax (plt.Axes, optional):
The matplotlib axes to plot the figure on. Defaults to None.
**kwargs:
Additional keyword arguments to pass to matplotlib.pyplot.plot.
Returns:
plt.Axes: The matplotlib axes.
from ladybug.epw import EPW
from ladybugtools_toolkit.ladybug_extension.datacollection import collection_to_series
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
dewp = collection_to_series(epw.dew_point_temperature)
from ladybugtools_toolkit.plot._radiant_cooling_potential import radiant_cooling_potential
radiant_cooling_potential(dewp)
_seasonality
Create a plot which shows where the seasohn threshholds are for the input EPW object.
Args:
epw (EPW):
An EPW object.
ax (plt.Axes, optional):
A matplotlib axes object. Default is None which uses the current axes.
color_config (dict[str, str], optional):
A dictionary of colors for each season. If None, then default will be used.
**kwargs:
title (str):
The title of the plot. If not provided, then the name of the EPW file is used.
from ladybug.epw import EPW
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
from ladybugtools_toolkit.plot._seasonality import seasonality_comparison
seasonality_comparison(epw)
_skymatrix
Create a sky matrix image.
Args:
epw (EPW):
A EPW object.
ax (plt.Axes, optional):
The matplotlib Axes to plot on. Defaults to None which uses the current Axes.
analysis_period (AnalysisPeriod, optional):
An AnalysisPeriod. Defaults to AnalysisPeriod().
density (int, optional):
Sky matrix density. Defaults to 1.
show_title (bool, optional):
Show the title. Defaults to True.
show_colorbar (bool, optional):
Show the colorbar. Defaults to True.
**kwargs:
Additional keyword arguments to pass to the plotting function.
Returns:
Figure:
A matplotlib Figure object.
from ladybug.epw import EPW
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
from ladybugtools_toolkit.plot._skymatrix import skymatrix
skymatrix(epw)
_sunpath
Plot a sun-path for the given Location and analysis period.
Args:
location (Location):
A ladybug Location object.
ax (plt.Axes, optional):
A matplotlib Axes object. Defaults to None.
analysis_period (AnalysisPeriod, optional):
_description_. Defaults to None.
data_collection (HourlyContinuousCollection, optional):
An aligned data collection. Defaults to None.
cmap (str, optional):
The colormap to apply to the aligned data_collection. Defaults to None.
norm (BoundaryNorm, optional):
A matplotlib BoundaryNorm object containing colormap boundary mapping information.
Defaults to None.
sun_size (float, optional):
The size of each sun in the plot. Defaults to 0.2.
show_grid (bool, optional):
Set to True to show the grid. Defaults to True.
show_legend (bool, optional):
Set to True to include a legend in the plot if data_collection passed. Defaults to True.
Returns:
plt.Axes:
A matplotlib Axes object.
from ladybug.epw import EPW, Location
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
location = epw.location
from ladybugtools_toolkit.plot._sunpath import sunpath
sunpath(location)
_misc
Plot cloud cover categories from an EPW file.
Args:
epw (EPW):
The EPW file to plot.
ax (plt.Axes, optional):
A matploltib axes to plot on. Defaults to None.
Returns:
plt.Axes:
The matplotlib axes.
from ladybug.epw import EPW, Location
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
location = epw.location
from ladybugtools_toolkit.plot._misc import hours_sunlight
hours_sunlight(location)
_monthly_histogram_proportion
Create a monthly histogram of a pandas Series.
Args:
series (pd.Series):
The pandas Series to plot. Must have a datetime index.
bins (list[float]):
The bins to use for the histogram.
ax (plt.Axes, optional):
An optional plt.Axes object to populate. Defaults to None, which creates a new plt.Axes object.
labels (list[str], optional):
The labels to use for the histogram. Defaults to None, which uses the bin edges.
show_year_in_label (bool, optional):
Whether to show the year in the x-axis label. Defaults to False.
show_labels (bool, optional):
Whether to show the labels on the bars. Defaults to False.
show_legend (bool, optional):
Whether to show the legend. Defaults to False.
**kwargs:
Additional keyword arguments to pass to plt.bar.
Returns:
plt.Axes:
The populated plt.Axes object.
from ladybug.epw import EPW
from ladybugtools_toolkit.ladybug_extension.datacollection import collection_to_series
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
dbt = collection_to_series(epw.dry_bulb_temperature)
bins = [-30, -20, -10, 0, 10, 20, 30]
from ladybugtools_toolkit.plot._monthly_histogram_proportion import monthly_histogram_proportion
monthly_histogram_proportion(dbt, bins)
_psychrometric
Create a psychrometric chart using a LB backend.
Args:
epw (EPW):
An EPW object.
cmap (Colormap, optional):
A colormap to color things with!.
Default is "viridis".
analysis_period (AnalysisPeriod, optional):
An analysis period to filter values by.
Default is whole year.
wet_bulb (bool, optional):
Plot wet-bulb temperature constant lines instead of enthalpy.
Default is False.
psychro_polygons (PsychrometricPolygons, optional):
A PsychrometricPolygons object to use for plotting comfort polygons.
Default is None.
figsize (tuple[float, float], optional):
A tuple of floats for the figure size.
Default is (10, 7).
Returns:
plt.Figure:
A Figure object.
from ladybug.epw import EPW
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
from ladybugtools_toolkit.plot._psychrometric import psychrometric
psychrometric(epw)
_utci
Create a combined heatmap/histoghram figure for a UTCI data collection.
Args:
utci_collection (HourlyContinuousCollection):
A ladybug HourlyContinuousCollection object.
utci_categories (Categories, optional):
A Categories object with colors, ranges and limits. Defaults to UTCI_DEFAULT_CATEGORIES.
show_colorbar (bool, optional):
Set to True to show the colorbar. Defaults to True.
**kwargs:
Additional keyword arguments to pass.
Returns:
Figure:
A matplotlib Figure object.
from ladybug.epw import EPW
from ladybugtools_toolkit.external_comfort.typology import Typology
from ladybugtools_toolkit.external_comfort.simulate import SimulationResult
from ladybugtools_toolkit.external_comfort.material import Materials
from ladybugtools_toolkit.external_comfort.externalcomfort import ExternalComfort
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
dbt = epw.dry_bulb_temperature
typology = Typology(identifier="Unshaded, wind (baseline)")
ground_material = Materials.Generic_HW_Concrete
shade_material = Materials.Generic_25mm_Wood
sr = SimulationResult(epw_path, ground_material, shade_material)
ec = ExternalComfort(sr, typology)
from ladybugtools_toolkit.plot._utci import utci_heatmap_histogram
utci_heatmap_histogram(ec.universal_thermal_climate_index)
Create a histogram showing the distribution of UTCI values.
Args:
utci_collection (HourlyContinuousCollection):
A ladybug HourlyContinuousCollection object.
ax (plt.Axes, optional):
A matplotlib Axes object to plot on. Defaults to None.
utci_categories (Categories, optional):
A Categories object with colors, ranges and limits. Defaults to UTCI_DEFAULT_CATEGORIES.
show_labels (bool, optional):
Set to True to show the UTCI category labels on the plot. Defaults to False.
**kwargs:
Additional keyword arguments to pass to the plotting function.
Returns:
plt.Axes:
A matplotlib Axes object.
from ladybug.epw import EPW
from ladybugtools_toolkit.external_comfort.typology import Typology
from ladybugtools_toolkit.external_comfort.simulate import SimulationResult
from ladybugtools_toolkit.external_comfort.material import Materials
from ladybugtools_toolkit.external_comfort.externalcomfort import ExternalComfort
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
dbt = epw.dry_bulb_temperature
typology = Typology(identifier="Unshaded, wind (baseline)")
ground_material = Materials.Generic_HW_Concrete
shade_material = Materials.Generic_25mm_Wood
sr = SimulationResult(epw_path, ground_material, shade_material)
ec = ExternalComfort(sr, typology)
from ladybugtools_toolkit.plot._utci import utci_histogram
utci_histogram(ec.universal_thermal_climate_index)
Plot the shade benefit category.
Args:
unshaded_utci (HourlyContinuousCollection | pd.Series):
A dataset containing unshaded UTCI values.
shaded_utci (HourlyContinuousCollection | pd.Series):
A dataset containing shaded UTCI values.
comfort_limits (tuple[float], optional):
The range within which "comfort" is achieved. Defaults to (9, 26).
location (Location, optional):
A location object used to plot sun up/down times. Defaults to None.
color_config (dict[str, str], optional):
A dictionary of colors for each shade-benefit category.
If None then defaults will be used.
figsize (tuple[float], optional):
The size of the figure. Defaults to (15, 5).
**kwargs:
Additional keyword arguments to pass to the plotting function.
title (str, optional):
The title of the plot. Defaults to None.
Returns:
plt.Figure:
A figure object.
from ladybug.epw import EPW
from ladybugtools_toolkit.external_comfort.typology import Typology
from ladybugtools_toolkit.external_comfort.simulate import SimulationResult
from ladybugtools_toolkit.external_comfort.material import Materials
from ladybugtools_toolkit.external_comfort.externalcomfort import ExternalComfort
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
dbt = epw.dry_bulb_temperature
typologyOne = Typology(identifier="Unshaded", wind_speed_multiplier=2)
typologyTwo = Typology(identifier="Shaded", wind_speed_multiplier=0.5)
ground_material = Materials.Generic_HW_Concrete
shade_material = Materials.Generic_25mm_Wood
sr = SimulationResult(epw_path, ground_material, shade_material)
ecUnshaded = ExternalComfort(sr, typologyOne)
ecShaded = ExternalComfort(sr, typologyTwo)
from ladybugtools_toolkit.plot._utci import utci_shade_benefit
utci_shade_benefit(ecUnshaded.universal_thermal_climate_index, ecShaded.universal_thermal_climate_index)
Create a figure showing the UTCI proportion for the given analysis period.
Args:
utci_collection (HourlyContinuousCollection):
A ladybug HourlyContinuousCollection object.
ax (plt.Axes, optional):
The matplotlib Axes to plot on. Defaults to None which uses the current Axes.
show_legend (bool, optional):
Set to True to plot the legend also. Default is True.
show_values (bool, optional):
Set to True to show values. Default is True.
utci_categories (Categories, optional):
The UTCI categories to use. Defaults to UTCI_DEFAULT_CATEGORIES.
**kwargs:
Additional keyword arguments to pass to the plotting function.
Returns:
plt.Axes: A matplotlib Axes object.
from ladybug.epw import EPW
from ladybugtools_toolkit.external_comfort.typology import Typology
from ladybugtools_toolkit.external_comfort.simulate import SimulationResult
from ladybugtools_toolkit.external_comfort.material import Materials
from ladybugtools_toolkit.external_comfort.externalcomfort import ExternalComfort
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
dbt = epw.dry_bulb_temperature
typology = Typology(identifier="Unshaded, wind (baseline)")
ground_material = Materials.Generic_HW_Concrete
shade_material = Materials.Generic_25mm_Wood
sr = SimulationResult(epw_path, ground_material, shade_material)
ec = ExternalComfort(sr, typology)
from ladybugtools_toolkit.plot._utci import utci_pie
utci_pie(ec.universal_thermal_climate_index)
Create a heatmap showing the annual hourly UTCI difference between collections.
Args:
utci_collection1 (HourlyContinuousCollection):
The first UTCI collection.
utci_collection2 (HourlyContinuousCollection):
The second UTCI collection.
ax (plt.Axes, optional):
The matplotlib Axes to plot on. Defaults to None which uses the current Axes.
**kwargs:
Additional keyword arguments to pass to the heatmap function.
Returns:
plt.Axes:
A matplotlib Axes object.
from ladybug.epw import EPW
from ladybugtools_toolkit.external_comfort.typology import Typology
from ladybugtools_toolkit.external_comfort.simulate import SimulationResult
from ladybugtools_toolkit.external_comfort.material import Materials
from ladybugtools_toolkit.external_comfort.externalcomfort import ExternalComfort
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
dbt = epw.dry_bulb_temperature
typologyOne = Typology(identifier="Unshaded", wind_speed_multiplier=3)
typologyTwo = Typology(identifier="Shaded", wind_speed_multiplier=0.5)
ground_material = Materials.Generic_HW_Concrete
shade_material = Materials.Generic_25mm_Wood
sr = SimulationResult(epw_path, ground_material, shade_material)
ecUnshaded = ExternalComfort(sr, typologyOne)
ecShaded = ExternalComfort(sr, typologyTwo)
from ladybugtools_toolkit.plot._utci import utci_heatmap_difference
utci_heatmap_difference(ecUnshaded.universal_thermal_climate_index, ecShaded.universal_thermal_climate_index)
Plot a single days UTCI with composite DBT, RH, MRT and WS components shown also.
Args:
utci (pd.Series):
An annual time-indexed series containing UTCI values.
dbt (pd.Series):
An annual time-indexed series containing DBT values.
mrt (pd.Series):
An annual time-indexed series containing MRT values.
rh (pd.Series):
An annual time-indexed series containing RH values.
ws (pd.Series):
An annual time-indexed series containing WS values.
ax (plt.Axes, optional):
The matplotlib Axes to plot on. Defaults to None which uses the current Axes.
month (int, optional):
The month to plot. Default is 6.
day (int, optional):
The day to plot. Default is 21.
kwargs:
Additional keyword arguments to pass to the matplotlib plot function.
Returns:
Figure:
A matplotlib Figure object.
from ladybug.epw import EPW
import pandas as pd
from ladybugtools_toolkit.external_comfort.typology import Typology
from ladybugtools_toolkit.external_comfort.simulate import SimulationResult
from ladybugtools_toolkit.external_comfort.material import Materials
from ladybugtools_toolkit.external_comfort.externalcomfort import ExternalComfort
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
dbt = epw.dry_bulb_temperature
typology = Typology(identifier="Unshaded, wind (baseline)")
ground_material = Materials.Generic_HW_Concrete
shade_material = Materials.Generic_25mm_Wood
sr = SimulationResult(epw_path, ground_material, shade_material)
ec = ExternalComfort(sr, typology)
utci = pd.Series(data=ec.universal_thermal_climate_index, index=pd.date_range(start="2025-01-01 00:00:00", end="2025-12-31 23:00:00", freq="h"), name="UTCI")
dbt = pd.Series(data=ec.dry_bulb_temperature, index=pd.date_range(start="2025-01-01 00:00:00", end="2025-12-31 23:00:00", freq="h"), name="DBT")
mrt = pd.Series(data=ec.mean_radiant_temperature, index=pd.date_range(start="2025-01-01 00:00:00", end="2025-12-31 23:00:00", freq="h"), name="MRT")
rh = pd.Series(data=ec.relative_humidity, index=pd.date_range(start="2025-01-01 00:00:00", end="2025-12-31 23:00:00", freq="h"), name="RH")
ws = pd.Series(data=ec.wind_speed, index=pd.date_range(start="2025-01-01 00:00:00", end="2025-12-31 23:00:00", freq="h"), name="WS")
from ladybugtools_toolkit.plot._utci import utci_day_comfort_metrics
utci_day_comfort_metrics(utci,dbt,mrt,rh,ws)
Create a proportional bar chart showing how different UTCI collections compare in terms of time within each comfort band.
Args:
utci_collections (list[HourlyContinuousCollection]):
A list of UTCI collections.
ax (plt.Axes, optional):
The matplotlib Axes to plot on. Defaults to None which uses the current Axes.
identifiers (list[str], optional):
A list of names to give each collection. Defaults to None.
utci_categories (Categories, optional):
The UTCI categories to use. Defaults to UTCI_DEFAULT_CATEGORIES.
density (bool, optional):
If True, then show percentage, otherwise show count. Defaults to True.
**kwargs:
Additional keyword arguments to pass to the function.
Returns:
plt.Axes:
A matplotlib Axes object.
from ladybug.epw import EPW
from ladybugtools_toolkit.external_comfort.typology import Typologies
from ladybugtools_toolkit.external_comfort.simulate import SimulationResult
from ladybugtools_toolkit.external_comfort.material import Materials
from ladybugtools_toolkit.external_comfort.externalcomfort import ExternalComfort
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
dbt = epw.dry_bulb_temperature
typology_one = Typologies.OPENFIELD
typology_two = Typologies.SKY_SHELTER
ground_material = Materials.Generic_HW_Concrete
shade_material = Materials.Generic_25mm_Wood
sr = SimulationResult(epw_path, ground_material, shade_material)
ec_one = ExternalComfort(sr, typology_one)
ec_two = ExternalComfort(sr, typology_two)
utci_collection = ec_one.universal_thermal_climate_index, ec_two.universal_thermal_climate_index
from ladybugtools_toolkit.plot._utci import utci_comfort_band_comparison
utci_comfort_band_comparison(utci_collection)
Create a proportional bar chart showing how different UTCI collections compare in terms of time within each comfort band.
Args:
utci_series (list[pd.Series]):
A list of UTCI series objects.
ax (plt.Axes, optional):
The matplotlib Axes to plot on. Defaults to None which uses the current Axes.
identifiers (list[str], optional):
A list of names to give each collection. Defaults to None.
utci_categories (Categories, optional):
The UTCI categories to use. Defaults to UTCI_DEFAULT_CATEGORIES.
density (bool, optional):
If True, then show percentage, otherwise show count. Defaults to True.
**kwargs:
Additional keyword arguments to pass to the function.
Returns:
plt.Axes:
A matplotlib Axes object.
from ladybug.epw import EPW
from ladybugtools_toolkit.external_comfort.typology import Typologies
from ladybugtools_toolkit.external_comfort.simulate import SimulationResult
from ladybugtools_toolkit.external_comfort.material import Materials
from ladybugtools_toolkit.external_comfort.externalcomfort import ExternalComfort
from ladybugtools_toolkit.ladybug_extension.datacollection import collection_to_series
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
dbt = epw.dry_bulb_temperature
typology_one = Typologies.OPENFIELD
typology_two = Typologies.SKY_SHELTER
ground_material = Materials.Generic_HW_Concrete
shade_material = Materials.Generic_25mm_Wood
sr = SimulationResult(epw_path, ground_material, shade_material)
ec_one = ExternalComfort(sr, typology_one)
ec_two = ExternalComfort(sr, typology_two)
utci_one_series = collection_to_series(ec_one.universal_thermal_climate_index)
utci_two_series = collection_to_series(ec_two.universal_thermal_climate_index)
utcis_series = (utci_one_series, utci_two_series)
from ladybugtools_toolkit.plot._utci import utci_comfort_band_comparison_series
utci_comfort_band_comparison_series(utcis_series)
Plot a set of UTCI collections on a single figure for monthly diurnal periods.
Args:
utci_collections (list[HourlyContinuousCollection]):
A list of UTCI collections.
ax (plt.Axes, optional):
The matplotlib Axes to plot on. Defaults to None which uses the current Axes.
month (int, optional):
The month to get the typical day from. Default is 6.
collection_ids (list[str], optional):
A list of descriptions for each of the input collections. Defaults to None.
agg (str, optional):
How to generate the "typical" day. Defualt is "mean" which uses the mean for each timestep in that month.
utci_categories (Categories, optional):
The UTCI categories to use. Defaults to UTCI_DEFAULT_CATEGORIES.
show_legend (bool, optional):
If True, show the legend. Defaults to True.
categories_in_legend (bool, optional):
If True, add the UTCI categories to the legend. Defaults to True.
**kwargs:
Additional keyword arguments to pass to the matplotlib plot function.
ylims (list[float], optional):
The y-axis limits. Defaults to None which just uses the min/ax of the fiven collections.
Returns:
Figure:
A matplotlib figure object.
from ladybug.epw import EPW
from ladybugtools_toolkit.external_comfort.typology import Typologies
from ladybugtools_toolkit.external_comfort.simulate import SimulationResult
from ladybugtools_toolkit.external_comfort.material import Materials
from ladybugtools_toolkit.external_comfort.externalcomfort import ExternalComfort
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
dbt = epw.dry_bulb_temperature
typology_one = Typologies.OPENFIELD
typology_two = Typologies.SKY_SHELTER
typology_three = Typologies.NEAR_WATER
ground_material = Materials.Generic_HW_Concrete
shade_material = Materials.Generic_25mm_Wood
sr = SimulationResult(epw_path, ground_material, shade_material)
ec_one = ExternalComfort(sr, typology_one)
ec_two = ExternalComfort(sr, typology_two)
ec_three = ExternalComfort(sr,typology_three)
utci_collection = [ec_one.universal_thermal_climate_index, ec_two.universal_thermal_climate_index, ec_three.universal_thermal_climate_index]
from ladybugtools_toolkit.plot._utci import utci_comparison_diurnal_day
utci_comparison_diurnal_day(utci_collection)
Create a figure showing the pseudo-journey between different UTCI conditions at a given time of year
Args:
utci_values (float):
A list of UTCI values.
ax (plt.Axes, optional):
The matplotlib Axes to plot on. Defaults to None which uses the current Axes.
names (list[str], optional):
A list of names to label each value with. Defaults to None.
curve (bool, optional):
Whether to plot the pseudo-journey as a spline. Defaults to False.
show_legend (bool, optional):
Set to True to plot the UTCI comfort band legend also.
show_grid (bool, optional):
Set to True to include a grid on the plot.
utci_categories (Categories, optional):
The UTCI categories to use. Defaults to UTCI_DEFAULT_CATEGORIES.
**kwargs:
Additional keyword arguments to pass to the plotting function.
Returns:
plt.Axes: A matplotlib Axes object.
from ladybugtools_toolkit.plot._utci import utci_journey
utci_journey((-20, 0, 5, 12, -11, 30, 21), names=("to cold","better now", "spring is on its way", "spring is here", "oh no, is it winter again?", "lovley summer day", "favorite tempertur"))
solar
Create a solar radiation rose
Args:
epw_file (Path):
The EPW file representing the weather data/location to be visualised.
ax (plt.Axes, optional):
A polar axis onto which the radiation rose will be plotted.
Defaults to None.
rad_type (IrradianceType, optional):
The type of radiation to plot.
Defaults to "TOTAL".
analysis_period (AnalysisPeriod, optional):
The analysis period over which radiation shall be summarised.
Defaults to AnalysisPeriod().
tilt_angle (float, optional):
The tilt (from 0 at horizon, to 90 facing the sky) to asses.
Defaults to 0.
cmap (str, optional):
The colormap to apply.
Defaults to "YlOrRd".
directions (int, optional):
The number of directions to bin data into.
Defaults to 36.
label (bool, optional):
Set to True to include labels on teh plot.
Defaults to True.
bar_width (float, optional):
Set the bar width for each of the bins.
Defaults to 1.
lims (tuple[float, float], optional):
Set the limits of the plot.
Defaults to None.
Returns:
plt.Axes:
The matplotlib axes.
from pathlib import Path
epw_path = r" Paste path to epw file inside quotation marks "
epw_file = Path(epw_path)
from ladybugtools_toolkit.solar import radiation_rose
radiation_rose(epw_file)
Create a tilt-orientation factor plot.
Args:
epw_file (Path):
The EPW file representing the weather data/location to be visualised.
ax (plt.Axes, optional):
The axes to plot on.
Defaults to None.
rad_type (IrradianceType, optional):
The type of radiation to plot.
Defaults to TOTAL.
analysis_period (AnalysisPeriod, optional):
The analysis period over which radiation shall be summarised.
Defaults to AnalysisPeriod().
cmap (str, optional):
The colormap to apply.
Defaults to "YlOrRd".
directions (int, optional):
The number of directions to bin data into.
Defaults to 36.
tilts (int, optional):
The number of tilts to calculate.
Defaults to 9.
quantiles (tuple[float], optional):
The quantiles to plot.
Defaults to (0.05, 0.25, 0.5, 0.75, 0.95).
lims (tuple[float, float], optional):
The limits of the plot.
Defaults to None.
Returns:
plt.Axes:
The matplotlib axes.
from pathlib import Path
epw_path = r" Paste path to epw file inside quotation marks "
epw_file = Path(epw_path)
from ladybugtools_toolkit.solar import tilt_orientation_factor
tilt_orientation_factor(epw_file)
wind
Create a simple line plot of wind speed.
Args:
ax (plt.Axes, optional):
The axes to plot on. If None, the current axes will be used.
**kwargs:
Additional keyword arguments to pass to the function. These include:
title (str, optional):
A title for the plot. Defaults to None.
Returns:
plt.Axes:
A matplotlib Axes object.
from ladybug.epw import EPW
from ladybugtools_toolkit.wind import Wind
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
wind = Wind.from_epw(epw)
wind.plot_timeseries()
Create a plot showing the annual wind speed and direction bins using the month_time_average method.
Args:
ax (plt.Axes, optional):
The axes to plot on. If None, the current axes will be used.
show_values (bool, optional):
Whether to show values in the cells. Defaults to False.
show_arrows (bool, optional):
Whether to show the directional arrows on each patch.
other_data: (pd.Series, optional):
The other data to align with the wind direction and speed.
Defaults to None which uses wind speed.
**kwargs:
Additional keyword arguments to pass to the pcolor function.
title (str, optional):
A title for the plot. Defaults to None.
Returns:
plt.Axes:
A matplotlib Axes object.
from ladybug.epw import EPW
from ladybugtools_toolkit.wind import Wind
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
wind = Wind.from_epw(epw)
wind.plot_windmatrix()
Create a histogram showing wind speed frequency.
Args:
ax (plt.Axes, optional):
The axes to plot this chart on. Defaults to None.
speed_bins (list[float], optional):
The wind speed bins to use for the histogram. These bins are right inclusive.
percentiles (tuple[float], optional):
The percentiles to plot. Defaults to (0.5, 0.95).
function (str, optional):
The function to use. Either "pdf" or "cdf". Defaults to "pdf".
ylim (tuple[float], optional):
The y-axis limits. Defaults to None.
Returns:
plt.Axes: The axes object.
from ladybug.epw import EPW
from ladybugtools_toolkit.wind import Wind
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
wind = Wind.from_epw(epw)
wind.plot_densityfunction()
Create a wind rose showing wind speed and direction frequency.
Args:
ax (plt.Axes, optional):
The axes to plot this chart on. Defaults to None.
directions (int, optional):
The number of directions to use. Defaults to 36.
other_data (list[float], optional):
A list of other data to bin by direction.
If None, then wind speed will be used.
other_bins (list[float]):
The other data bins to use for the histogram. These bins are right inclusive.
If other data is None, then the default Beaufort bins will be used,
otherwise 11 evenly spaced bins will be used.
colors: (str | tuple[float] | Colormap, optional):
A list of colors to use for the other bins. May also be a colormap.
Defaults to the colors used for Beaufort wind comfort categories.
title (str, optional):
title to display above the plot. Defaults to the source of this wind object.
legend (bool, optional):
Set to False to remove the legend. Defaults to True.
ylim (tuple[float], optional):
The y-axis limits. Defaults to None.
label (bool, optional):
Set to False to remove the bin labels. Defaults to False.
Returns:
plt.Axes: The axes object.
from ladybug.epw import EPW
from ladybugtools_toolkit.wind import Wind
epw_path = r" Paste path to epw file inside quotation marks "
epw = EPW(epw_path)
wind = Wind.from_epw(epw)
wind.plot_windrose()
Plot a 2D-histogram for a collection of wind speeds and directions.
Args:
ax (plt.Axes, optional):
The axis to plot results on. Defaults to None.
directions (int, optional):
The number of directions to use. Defaults to 36.
other_data (list[float], optional):
A list of other data to bin by direction. If None, then wind speed will be used.
other_bins (list[float]):
The other data bins to use for the histogram. These bins are right inclusive.
density (bool, optional):
If True, then return the probability density function. Defaults to False.
cmap (str | Colormap, optional):
The colormap to use. Defaults to "YlGnBu".
show_values (bool, optional):
Whether to show values in the cells. Defaults to True.
vmin (float, optional):
The minimum value for the colormap. Defaults to None.
vmax (float, optional):
The maximum value for the colormap. Defaults to None.
Returns:
plt.Axes:
A matplotlib Axes object.
from ladybug.epw import EPW
from ladybugtools_toolkit.wind import Wind
epw_path = r"C:\Users\msandmer\OneDrive - Buro Happold\Desktop\downloaded epw\SWE_ST_Stockholm.Arlanda.AP.024600_TMYx.epw"
epw = EPW(epw_path)
wind = Wind.from_epw(epw)
wind.plot_windhistogram()