netallocation.plot module¶
Created on Thu Mar 7 16:13:57 2019
@author: fabian
- netallocation.plot.annotate_branch_names(n, ax, shift=- 0.012, size=12, color='k', prefix=True, adjust_str=None, **kwargs)[source]¶
- netallocation.plot.annotate_bus_names(n, ax=None, shift=- 0.012, size=12, adjust_str=None, color='darkslategray', **kwargs)[source]¶
Annotate names of buses plot.
- Parameters
n (pypsa.Network) –
ax (matplotlib axis) –
shift (float/tuple) – Shift of the text with respect to the x and y bus coordinate. The default is -0.012.
size (float, optional) – Text size. The default is 12.
color (string, optional) – Text color. The default is ‘k’.
**kwargs (dict) –
Keyword arguments going to ax.text() function. For example:
transform=ccrs.PlateCarree()
bbox=dict(facecolor=’white’, alpha=0.5, edgecolor=’None’)
- netallocation.plot.chord_diagram(ds, agg='mean', minimum_quantile=0, groups=None, size=200, pallette='Category20', fig_inches=4)[source]¶
Build a chord diagram on the base of holoviews [1].
It visualizes allocated peer-to-peer flows for all buses given in the data. As for compatibility with ipython shell the rendering of the image is passed to matplotlib however to the disfavour of interactivity. Note that the plot becomes only meaningful for networks with N > 5, because of sparse flows otherwise.
[1] http://holoviews.org/reference/elements/bokeh/Chord.html
- Parameters
allocation (xarray.Dataset) – Dataset with ‘peer_to_peer’ variable.
lower_bound (int, default is 0) – filter small power flows by a lower bound
groups (pd.Series, default is None) – Specify the groups of your buses, which are then used for coloring. The series must contain values for all allocated buses.
size (int, default is 300) – Set the size of the holoview figure
save_path (str, default is '/tmp/chord_diagram_pypsa') – set the saving path of your figure
- netallocation.plot.component_plot(n, linewidth_factor=5000.0, gen_size_factor=50000.0, sus_size_factor=10000.0, carrier_colors=None, carrier_names=None, figsize=(10, 5), boundaries=None, **kwargs)[source]¶
Plot a pypsa.Network generation and storage capacity
- Parameters
n (pypsa.Network) – Optimized network
linewidth_factor (float, optional) – Scale factor of line widths. The default is 5e3.
gen_size_factor (float, optional) – Scale factor of generator capacities. The default is 5e4.
sus_size_factor (float, optional) – Scale factor of storage capacities. The default is 1e4.
carrier_colors (pd.Series, optional) – Colors of the carriers. The default is None.
carrier_names (pd.Series, optional) – Nice names of the carriers. The default is None.
figsize (tuple, optional) – figsize of resulting image. The default is (10, 5).
boundaries (tuple, optional) – Geographical bounds of the geomap. The default is [-10. , 30, 36, 70].
- Returns
Figure and axes of the corresponding plot.
- Return type
fig, ax
- netallocation.plot.fact_sheet(n, fn_out=None)[source]¶
Create a fact sheet which summarizes the network.
- Parameters
n (pypsa.Network) – Optimized network
- Returns
df – Summary of the network.
- Return type
pandas.DataFrame
- netallocation.plot.injection_plot_kwargs(p)[source]¶
Generate keyword arguments for plotting the given injection with n.plot()
Returns kwargs which can be used in the n.plot function
- Parameters
p (pd.Series/xr.DataArray) – Injection pattern
- Returns
A dictionary with keyword arguments for bus_sizes and bus_colors.
- Return type
kwargs
Example
>>> p = ntl.network_injection(n, n.snapshots[0]) >>> n.plot(**injection_plot_kwargs(p))