Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs/joss paper review #18

Merged
merged 44 commits into from
Dec 3, 2024
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e652d1e
Enhance point cloud processing with ept tiling and better error handling
iosefa Nov 29, 2024
5b442e7
Update main.yml
iosefa Nov 29, 2024
f0ccb57
Merge pull request #15 from iosefa/iosefa-patch-1
iosefa Nov 29, 2024
04cd7b3
Refactor documentation structure and remove legacy files
iosefa Nov 30, 2024
36919c7
Add Dockerfile
benleamon Nov 30, 2024
aaaea65
Update Dockerfile
benleamon Nov 30, 2024
ac9e9a6
Update Dockerfile
benleamon Nov 30, 2024
4d71d1f
Add example LAZ data file to documentation
iosefa Nov 30, 2024
b6cb27a
Updated PAI, Added calculate-forest-metrics jupyter notebook
benleamon Nov 30, 2024
82a9d0c
update function for calculating metrics and plotting PAI
benleamon Nov 30, 2024
63fe3e6
Refactor contributing docs and update dependencies
iosefa Nov 30, 2024
cc7637f
Update jupyter notebooks, as well as generate_dtm().
benleamon Nov 30, 2024
a565239
Add optional metric_name for plot colorbar labels
iosefa Dec 1, 2024
7ae8e95
Refactor documentation structure and content
iosefa Dec 1, 2024
5830342
Edited jupyter notebooks
benleamon Dec 1, 2024
799719e
Add new images and documentation files
iosefa Dec 3, 2024
2634fdb
Add CNAME, update dependencies, and CI improvements
iosefa Dec 3, 2024
4667f9e
Merge pull request #16 from iosefa/next
iosefa Dec 3, 2024
14cf768
Enhance CHM interpolation logic and update tests.
iosefa Dec 3, 2024
a82f91e
Merge pull request #17 from iosefa/tests/fit-tests
iosefa Dec 3, 2024
f8ef6bf
Bump version to 0.2.1 in setup.py.
iosefa Dec 3, 2024
cf835bd
Remove unused notebook and update Binder links.
iosefa Dec 3, 2024
0e70339
Add Docker image publishing to workflow
iosefa Dec 3, 2024
e6e4c01
Update conda channel and visualization function names
iosefa Dec 3, 2024
136f774
Add paper.bib and paper.md files for project documentation
iosefa Sep 18, 2024
1d7145e
Add paper edits
benleamon Sep 19, 2024
af62a42
Add acknowledgements section to the paper
iosefa Sep 21, 2024
bd82be2
Update references in Statement of Need section
iosefa Sep 21, 2024
3b90400
Add GitHub Actions workflow for JOSS PDF generation
iosefa Sep 21, 2024
51dafb3
Update workflow to use latest action versions
iosefa Sep 21, 2024
9172804
Replace align with equation for improved LaTeX formatting
iosefa Sep 21, 2024
1ebe013
Added further edits
benleamon Sep 21, 2024
8be74c6
Add spacing between LaTeX equations in the manuscript
iosefa Sep 21, 2024
8785ba0
Fix affiliations and reference typo
iosefa Sep 21, 2024
ada7b5a
Change artifact path for paper upload
iosefa Sep 21, 2024
a279e1a
Add edits refining final paragraph
benleamon Sep 21, 2024
260c9cb
Add affiliation for Benjamin Palsa Leamon
iosefa Sep 21, 2024
5a50849
Fix format for references:
benleamon Sep 29, 2024
ded0c62
Update references and acknowledgements in paper
iosefa Sep 29, 2024
eea729e
Correct typos and standardize term capitalization for #11
iosefa Nov 21, 2024
24b6a23
Add PDAL citation to paper references for #11.
iosefa Nov 21, 2024
16bcad1
Remove author and update paper content to address reviewer comments.
iosefa Nov 27, 2024
caa2925
Update contributions and usage section
benleamon Dec 1, 2024
4ef7f71
Add new references and links, update acknowledgments
iosefa Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add optional metric_name for plot colorbar labels
The `plot_metric` function now includes an optional `metric_name` parameter to specify the label for the colorbar. If `metric_name` is not provided, the plot title will be used as the default label. This enhancement allows for more descriptive or unit-specific labels on the colorbar.
  • Loading branch information
iosefa committed Dec 1, 2024
commit a56523950e2aed37b6663986ee62d619c676f914
12 changes: 9 additions & 3 deletions pyforestscan/visualize.py
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ def plot_2d(points, x_dim='X', y_dim='Z', color_map='viridis', alpha=1.0, point_
plt.colorbar(label='Height Above Ground (m)')
plt.show()

def plot_metric(title, metric, extent, cmap='viridis', fig_size=None):
def plot_metric(title, metric, extent, metric_name=None, cmap='viridis', fig_size=None):
"""
Plots a given metric using the provided data and configuration.

@@ -60,28 +60,34 @@ def plot_metric(title, metric, extent, cmap='viridis', fig_size=None):
2D array representing the metric's values.
:param extent: list
List of four elements [xmin, xmax, ymin, ymax] defining the extent of the plot.
:param metric_name: string, optional
Label to be used for the colorbar. If None, the title is used as the
metric name. This is useful for specifying units or a more detailed
description of the metric.
:param cmap: str, optional
Colormap to be used for the plot. Default is 'viridis'.
:param fig_size: tuple, optional
Tuple specifying the size of the figure (width, height). Default is calculated based on the extent.
:return: None
:rtype: None
"""
if metric_name is None:
metric_name = title
if fig_size is None:
x_range = extent[1] - extent[0]
y_range = extent[3] - extent[2]
aspect_ratio = x_range / y_range
fig_size = (10 * aspect_ratio, 10)

max_fig_size = 20 # inches
max_fig_size = 20
if max(fig_size) > max_fig_size:
scale_factor = max_fig_size / max(fig_size)
fig_size = (fig_size[0] * scale_factor, fig_size[1] * scale_factor)

plt.figure(figsize=fig_size)

plt.imshow(metric.T, extent=extent, cmap=cmap)
plt.colorbar(label=title)
plt.colorbar(label=metric_name)
plt.title(title)
plt.xlabel('X')
plt.ylabel('Y')