GenericMappingTools / GenericMappingTools/gmt

histogram: Support aligning bars at the right edge of bins

Open
#9,188 6 comments 0 reactions 1 assignee Claimed by @Esteban82 View on GitHub
feature request
Dominant language
C
Stars
979
Forks
414
Avg merge
17h 26m
Merged PRs (30d)
54

Description

In `histogram`, by default, bars are aligned at the left edge of the bins. With `-F` option, bars are centered in the bins.

The behavior can be confirmed below:
```
gmt begin map png
gmt histogram @v3206_06.txt -R-7000/1000/0/2000 -T250 -W0.25p -Baf250 -Gblue
gmt histogram @v3206_06.txt -R-7000/1000/0/2000 -T250 -W0.25p -Baf250 -Gblue -F -Xw+1c
gmt end show
```
Image

What's missing is aligning the bars at the right edge of the bins. For comparison, matplotlib's `hist` method provides the `algin` parameter which can be "left", "right", and "mid".

It would be great if GMT's histogram can also support it. For backward compatibility, I expect the following syntax:

- `-Fc` or `-F`: centering
- `-Fl`: left alignment (the default without -F)
- `-Fr`: right alignment

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.