Skip to content

Commit fcf7018

Browse files
committed
merged and resolved
2 parents e69dfdc + fcc5944 commit fcf7018

File tree

3 files changed

+127
-89
lines changed

3 files changed

+127
-89
lines changed

README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Funded by ACS.
2121

2222
If you use this software please cite it as :
2323

24-
Tolhurst, G., & Black, M. (2025) plotting_maps. GitHub. Accessed [Date], from https://github.com/AusClimateService/plotting_maps
24+
Tolhurst, G., & Black, M. (2025). plotting_maps (Version 1.0.0) [Computer software]. https://doi.org/10.5281/zenodo.1234
2525

2626
## What's possible?
2727

@@ -34,11 +34,11 @@ There are many possibilities built into this function. ```plot_acs_hazard``` is
3434

3535
To access docstrings and learn about input arguments, use ```plot_acs_hazard?```. This will describe each parameter you can give to the function to customise your plot.
3636

37-
- Basic usage: Single plot of Australia eg temperature [Climate_and_hazards_report](https://github.com/AusClimateService/plotting_maps/blob/main/reports/Climate_and_hazards_report.ipynb) and [acs_plotting_maps_examples.ipynb](https://github.com/AusClimateService/plotting_maps/blob/main/example_notebooks/acs_plotting_maps_examples.ipynb)
38-
<img src="https://github.com/AusClimateService/plotting_maps/blob/main/figures/ch_report/Annual-maximum-daily%0Amaximum-temperature.png" width="300">
37+
- Basic usage: Single plot of Australia eg temperature [minimal_plotting_example_tx.ipynb](https://github.com/AusClimateService/plotting_maps/blob/main/example_notebooks/minimal_plotting_example_tx.ipynb), [story_map_plots.ipynb](https://github.com/AusClimateService/plotting_maps/blob/main/reports/story_map_plots.ipynb) and [acs_plotting_maps_examples.ipynb](https://github.com/AusClimateService/plotting_maps/blob/main/example_notebooks/acs_plotting_maps_examples.ipynb)
38+
<img src="https://github.com/AusClimateService/plotting_maps/blob/main/figures/Maximum-Temperature-of-Hottest-Heatwave.png" width="300">
3939

40-
- Plot ocean data: Plots of ocean data eg marine heat waves [acs_plotting_maps_examples.ipynb](https://github.com/AusClimateService/plotting_maps/blob/main/example_notebooks/acs_plotting_maps_examples.ipynb), and [Climate_and_hazards_report](https://github.com/AusClimateService/plotting_maps/blob/main/reports/Climate_and_hazards_report.ipynb)
41-
<img src="https://github.com/AusClimateService/plotting_maps/blob/main/figures/Ocean-acidification.png" width="300">
40+
- Plot ocean data: Plots of ocean data eg marine heat waves [story_map_plots.ipynb](https://github.com/AusClimateService/plotting_maps/blob/main/reports/story_map_plots.ipynb), [acs_plotting_maps_examples.ipynb](https://github.com/AusClimateService/plotting_maps/blob/main/example_notebooks/acs_plotting_maps_examples.ipynb), and [Climate_and_hazards_report](https://github.com/AusClimateService/plotting_maps/blob/main/reports/Climate_and_hazards_report.ipynb)
41+
<img src="https://github.com/AusClimateService/plotting_maps/blob/main/figures/story_map_plots/story_map_plots_MHWduration_gwl12.png" width="300">
4242

4343
- Plot data from anywhere in the world eg Antarctica or Europe [FAQ_example_antarctica.ipynb](https://github.com/AusClimateService/plotting_maps/blob/main/example_notebooks/FAQ_example_antarctica.ipynb)
4444

@@ -48,12 +48,12 @@ To access docstrings and learn about input arguments, use ```plot_acs_hazard?```
4848

4949
- Plot atmospheric data above ocean and land, for example, Tropical Cyclones [FAQ_example_TCs.ipynb](https://github.com/AusClimateService/plotting_maps/blob/main/example_notebooks/FAQ_example_TCs.ipynb)
5050

51-
<img src="https://github.com/user-attachments/assets/b5f21e58-831e-4016-8992-e612060c04da" width="600">
51+
<img src="https://github.com/AusClimateService/plotting_maps/blob/main/figures/Frequency-of-tropical-cyclones.png" width="600">
5252

5353

5454
- Plot stations data: Single plot of station data eg coastal flooding [acs_plotting_maps_examples.ipynb](https://github.com/AusClimateService/plotting_maps/blob/main/example_notebooks/acs_plotting_maps_examples.ipynb), [multi_plots](https://github.com/AusClimateService/plotting_maps/blob/main/example_notebooks/multi_plots.ipynb) and [Climate_and_hazards_report](https://github.com/AusClimateService/plotting_maps/blob/main/reports/Climate_and_hazards_report.ipynb)
5555

56-
<img src="https://github.com/AusClimateService/plotting_maps/blob/main/figures/ch_report/Change-in-frequency-of-flood-days.png" width="300">
56+
<img src="https://github.com/AusClimateService/plotting_maps/blob/main/figures/ch_report/Change-in-frequency-of-coastal-flood-days.png" width="300">
5757

5858
- Plot multiple data types in one figure. Gridded data and station data can be plotted on the same plot: eg ocean data and station data (station and gridded data on the same plot) [minimal_plotting_example_station.ipynb]((https://github.com/AusClimateService/plotting_maps/blob/main/example_notebooks/minimal_plotting_example_station.ipynb)
5959

@@ -564,8 +564,10 @@ plot_acs_hazard_1plus3(ds_gwl12=ds_gwl12[var],
564564
### How can I change the orientation (eg from vertical to horizontal) of the figures in a multipaneled plot?
565565
<details>
566566
<summary> Expand </summary>
567+
568+
Use `ncols` and `nrows` in the `plot_acs_hazard_multi` function to control a multipanelled figure's number of rows and columns.
567569

568-
For multi-panelled plots, we have provided a keyword `orientation` to easily change `"vertical"` stacked plots to `"horizontal"` aligned subplots. For four panelled plots there is also a `"square"` option for a 2-by-2 arrangement.
570+
For 2, 3, and 4 multi-panelled plots , we have provided a keyword `orientation` to easily change `"vertical"` stacked plots to `"horizontal"` aligned subplots. For four panelled plots there is also a `"square"` option for a 2-by-2 arrangement.
569571

570572
These options specify the axes grid, figsize, and location of titles etc.
571573

@@ -876,7 +878,7 @@ See for current issues: https://github.com/AusClimateService/plotting_maps/issue
876878
- Lightning plot. For the Climate Hazards report, recreate the lightning observations plot using the plot_acs_hazards function so that it is in the consistent format.
877879

878880
**Documentation:**
879-
- “release” this version of the code as v1.0.0. It is in wide use and care is being taken to keep backward compatibility while adding features. Eg see https://github.com/AusClimateService/plotting_maps/releases/new
881+
- Examples and FAQ for using plot_acs_hazard_multi
880882

881883
**Improve plotting function and axillaries:**
882884
- If hazard data had consistent file naming practices (DRS) and consistent attribute labels, then the plotting functions could be further automated. At the moment, the data files are named in different patterns, the files might have different names for coordinates (eg “time”, “lat”, “lon”)
@@ -885,14 +887,11 @@ See for current issues: https://github.com/AusClimateService/plotting_maps/issue
885887
- Possibly automate the arrows of the colourbar. (I don’t think the arrows on the colorbar should be determined by the data in the plot, I think they should be only limited by possible physical values of that metric so that all colourbars of that metric are comparable. Determine if you want the arrows to be determined by the plotting data or the metric’s possible physical values.)
886888
- Use a keyword to make plots appropriate for different uses eg journal, report, powerpoint, poster etc similar to https://seaborn.pydata.org/generated/seaborn.set_context.html
887889
- Simplify stored shapefiles or masks. Current masks are 1mm precision, this means that calculations with these regions are more intense than necessary. Most climate data is in the order of ~10 km (rarely ~100 m). Simplifying the geometries of the shapefiles can save lots of resources for no loss in results.
888-
- Improve the aesthetics and proportions of plotting, especially with dataset/date_range/baseline annotations. Design aesthetics were focused on vertical orientations for 4-panel plots without these annotations for a particular report.
890+
- Improve the aesthetics and proportions of plotting, especially with dataset/date_range/baseline annotations for plot_acs_hazard_1plus3, as has been done for plot_acs_hazard_multi. Design aesthetics were focused on vertical orientations for 4-panel plots without these annotations for a particular report.
889891
- Improve the aesthetics of plotting select_area. Eg remove boundaries of neighbouring regions (if desired)
890-
- Forest mask for forested areas. For example, FFDI is not useful in places where there is not connected vegetation/fuel. This is probably particularly for arid desert areas of central Australia. Changes in climate and land use may cause changes over time.
892+
- Forest mask for forested areas. For example, FFDI is not useful in places where there is not connected vegetation/fuel. This is probably particularly for arid desert areas of central Australia. Changes in climate and land use may cause changes over time. (see https://github.com/AusClimateService/plotting_maps/blob/main/reports/holistic-australian-bushfire-risk-assessment.ipynb for a possible solution)
891893
- Improve colormap for fire climate classes. This colour scheme is not completely colourblind-friendly. Perhaps modify the colours to increase the contrast.
892894

893-
**New plotting function:**
894-
- Fully flexible custom n x m grid of plots. At the moment, minor modifications within multiplot are needed to make a custom plot for new layouts. It may be possible to make a function that can take in dimensions and a list of dataarrays to make a figure of many plots. This should use a similar format to the existing multi-panel plots and allow plotting gridded data, station data, stippling, ocean data, etc. (in progress issue #29)
895-
896895
**Stats functions:**
897896
- Optimise workflow to enable area-averaged time series (stats or just area mean). This function can be very memory intensive. Need to apply a strategy or strategies to reduce memory use. A possible option may be to calculate and save area averages for every year. Saving outputs in annual files is a common practice for climate models.
898897
- Calculate statistics along streamlines. Similar to area averages, but for a custom transect. Eg for rivers instead of catchments. Eg issue https://github.com/AusClimateService/plotting_maps/issues/23

acs_plotting_maps.py

Lines changed: 66 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ def plot_titles(title="title",
983983
ax=None,
984984
text_xy = None,
985985
title_ha = "left",
986-
orientation = "none",):
986+
show_copyright = True,):
987987
"""
988988
Set the plot title and axis labels
989989
@@ -1037,11 +1037,10 @@ def plot_titles(title="title",
10371037
title_ha: {"left", "center", "right"}
10381038
Title horizontal alignment.
10391039
Default "left"
1040-
1041-
orientation: {"vertical", "horizontal"}
1042-
Orientation of figures, used to control layout of Copywrite text.
1043-
I.e. vertically stacked, or horizontal side-by-side
1044-
1040+
1041+
show_copyright: bool
1042+
Default True
1043+
10451044
Returns
10461045
-------
10471046
matplotlib.axes.Axes with text for titles etc.
@@ -1088,22 +1087,23 @@ def plot_titles(title="title",
10881087
transform=ax.transAxes,
10891088
zorder=10,
10901089
)
1091-
# print copyright outside bottom left corner
1092-
if figsize[0]<5.3:
1093-
string =""# f"\u00A9 Commonwealth of Australia {datetime.datetime.now().year}, \nAustralian Climate Service"
1094-
else:
1095-
string = ""#f"\u00A9 Commonwealth of Australia {datetime.datetime.now().year}, Australian Climate Service"
1096-
ax.text(
1097-
x=padding*xpt,
1098-
y=(padding+2*fontsize_footnote)*ypt,
1099-
s=string,
1100-
fontsize=fontsize_footnote,
1101-
transform=ax.transAxes,
1102-
verticalalignment="top",
1103-
zorder=10,
1104-
wrap=True,
1105-
)
1106-
if dataset_name is not None:
1090+
if show_copyright:
1091+
# print copyright outside bottom left corner
1092+
if figsize[0]<5.3:
1093+
string = f"\u00A9 Commonwealth of Australia {datetime.datetime.now().year}, \nAustralian Climate Service"
1094+
else:
1095+
string = f"\u00A9 Commonwealth of Australia {datetime.datetime.now().year}, Australian Climate Service"
1096+
ax.text(
1097+
x=padding*xpt,
1098+
y=(padding+2*fontsize_footnote)*ypt,
1099+
s=string,
1100+
fontsize=fontsize_footnote,
1101+
transform=ax.transAxes,
1102+
verticalalignment="top",
1103+
zorder=10,
1104+
wrap=True,
1105+
)
1106+
if dataset_name is not None:
11071107
# print data source inside bottom right
11081108
ax.text(
11091109
x=1- padding*xpt,
@@ -1211,6 +1211,7 @@ def plot_acs_hazard_multi(
12111211
savefig=True,
12121212
tick_rotation=None,
12131213
vcentre=None,
1214+
show_copyright=True,
12141215
):
12151216
"""
12161217
m-by-n panel plot with shared projection and titles etc.
@@ -1446,6 +1447,9 @@ def plot_acs_hazard_multi(
14461447
around the centre, eg for future temperature anomalies with a larger
14471448
positive range compared to the negative range.
14481449
1450+
show_copyright: bool
1451+
Default True
1452+
14491453
Returns
14501454
-------
14511455
A multi panel plot saved as a png in a "figures" file in your working directory.
@@ -1703,6 +1707,7 @@ def plot_acs_hazard_multi(
17031707
ax=ax111,
17041708
text_xy = text_xy,
17051709
title_ha = "center",
1710+
show_copyright=show_copyright,
17061711
)
17071712
# draw border
17081713
# ax111.axis(True)
@@ -1762,6 +1767,7 @@ def plot_acs_hazard(
17621767
savefig=True,
17631768
tick_rotation=None,
17641769
vcentre=None,
1770+
show_copyright=True,
17651771
):
17661772
"""This function takes gridded data or station_df dataframe and shapefiles
17671773
to visualise hazard data from a 2D Xarray data array
@@ -1955,6 +1961,9 @@ def plot_acs_hazard(
19551961
around the centre, eg for future temperature anomalies with a larger
19561962
positive range compared to the negative range.
19571963
1964+
show_copyright: bool
1965+
Default True
1966+
19581967
Returns
19591968
-------
19601969
The map is saved as a png in a "figures" file in your working directory.
@@ -2085,6 +2094,7 @@ def plot_acs_hazard(
20852094
ax=ax111,
20862095
text_xy = text_xy_1pp,
20872096
title_ha = "left",
2097+
show_copyright=show_copyright,
20882098
)
20892099
# -----------------------------------------------
20902100

@@ -2144,6 +2154,7 @@ def plot_acs_hazard_1pp(
21442154
savefig=True,
21452155
tick_rotation=None,
21462156
vcentre=None,
2157+
show_copyright=True,
21472158
):
21482159
"""This function takes gridded data or station_df dataframe and shapefiles
21492160
to visualise hazard data from a 2D Xarray data array
@@ -2341,6 +2352,9 @@ def plot_acs_hazard_1pp(
23412352
around the centre, eg for future temperature anomalies with a larger
23422353
positive range compared to the negative range.
23432354
2355+
show_copyright: bool
2356+
Default True
2357+
23442358
Returns
23452359
-------
23462360
The map is saved as a png in a "figures" file in your working directory.
@@ -2405,7 +2419,9 @@ def plot_acs_hazard_1pp(
24052419
outfile=outfile,
24062420
savefig=savefig,
24072421
tick_rotation=tick_rotation,
2408-
vcentre=vcentre,)
2422+
vcentre=vcentre,
2423+
show_copyright=show_copyright,
2424+
)
24092425

24102426

24112427
def plot_acs_hazard_2pp(
@@ -2456,6 +2472,7 @@ def plot_acs_hazard_2pp(
24562472
orientation="horizontal",
24572473
tick_rotation=None,
24582474
vcentre=None,
2475+
show_copyright=True,
24592476
):
24602477
"""
24612478
Two panel plot with shared cmap and titles etc.
@@ -2694,6 +2711,9 @@ def plot_acs_hazard_2pp(
26942711
around the centre, eg for future temperature anomalies with a larger
26952712
positive range compared to the negative range.
26962713
2714+
show_copyright: bool
2715+
Default True
2716+
26972717
Returns
26982718
-------
26992719
A two panel plot saved as a png in a "figures" file in your working directory.
@@ -2772,7 +2792,9 @@ def plot_acs_hazard_2pp(
27722792
outfile=outfile,
27732793
savefig=savefig,
27742794
tick_rotation=tick_rotation,
2775-
vcentre=vcentre,)
2795+
vcentre=vcentre,
2796+
show_copyright=show_copyright,
2797+
)
27762798

27772799

27782800

@@ -2829,7 +2851,8 @@ def plot_acs_hazard_3pp(
28292851
orientation="horizontal",
28302852
tick_rotation=None,
28312853
vcentre=None,
2832-
):
2854+
show_copyright=True,
2855+
):
28332856
"""
28342857
Three panel plot with shared cmap and titles etc.
28352858
As with plot_acs_hazard, but takes three xarray data arrays:
@@ -3082,6 +3105,9 @@ def plot_acs_hazard_3pp(
30823105
around the centre, eg for future temperature anomalies with a larger
30833106
positive range compared to the negative range.
30843107
3108+
show_copyright: bool
3109+
Default True
3110+
30853111
Returns
30863112
-------
30873113
A three panel plot saved as a png in a "figures" file in your working directory.
@@ -3158,7 +3184,9 @@ def plot_acs_hazard_3pp(
31583184
outfile=outfile,
31593185
savefig=savefig,
31603186
tick_rotation=tick_rotation,
3161-
vcentre=vcentre,)
3187+
vcentre=vcentre,
3188+
show_copyright=show_copyright,
3189+
)
31623190

31633191

31643192
def plot_acs_hazard_4pp(
@@ -3218,6 +3246,7 @@ def plot_acs_hazard_4pp(
32183246
orientation="vertical",
32193247
tick_rotation=None,
32203248
vcentre=None,
3249+
show_copyright=True,
32213250
):
32223251
"""
32233252
Four panel plot with shared cmap and titles etc.
@@ -3494,6 +3523,9 @@ def plot_acs_hazard_4pp(
34943523
around the centre, eg for future temperature anomalies with a larger
34953524
positive range compared to the negative range.
34963525
3526+
show_copyright: bool
3527+
Default True
3528+
34973529
Returns
34983530
-------
34993531
A four panel plot saved as a png in a "figures" file in your working directory.
@@ -3584,7 +3616,9 @@ def plot_acs_hazard_4pp(
35843616
outfile=outfile,
35853617
savefig=savefig,
35863618
tick_rotation=tick_rotation,
3587-
vcentre=vcentre,)
3619+
vcentre=vcentre,
3620+
show_copyright=show_copyright,
3621+
)
35883622

35893623

35903624

@@ -3652,6 +3686,7 @@ def plot_acs_hazard_1plus3(
36523686
orientation="vertical",
36533687
tick_rotation=None,
36543688
vcentre=None,
3689+
show_copyright=True,
36553690
):
36563691
"""
36573692
Four panel plot with 1 baseline plot and 3 future scenario
@@ -3971,6 +4006,9 @@ def plot_acs_hazard_1plus3(
39714006
around the centre, eg for future temperature anomalies with a larger
39724007
positive range compared to the negative range.
39734008
4009+
show_copyright: bool
4010+
Default True
4011+
39744012
Returns
39754013
-------
39764014
A four panel plot (one baseline and three anomalies) saved as a png
@@ -4184,7 +4222,7 @@ def plot_acs_hazard_1plus3(
41844222
ax=ax111,
41854223
text_xy = text_xy,
41864224
title_ha = "center",
4187-
orientation = orientation,
4225+
show_copyright=show_copyright,
41884226
)
41894227
# draw border
41904228
# ax111.axis(True)

example_notebooks/acs_plotting_maps_examples.ipynb

Lines changed: 48 additions & 47 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)