gmt icon indicating copy to clipboard operation
gmt copied to clipboard

Let pshistogram handle both Cartesian and polar histograms

Open PaulWessel opened this issue 3 years ago • 6 comments

Description of the desired feature

The psrose module is very old (2.4.1) and has a checkered history:

  1. It started off life not using -J but had a -Sradius option.
  2. The -R option is backwards [-Rr0/r1/theta0/theta1] relative to other azimuthal plots.
  3. Because not implemented as a projection we cannot use the -B machinery so any annotation problem requires fixes to the module itself.
  4. In GMT 5 we added -JXdiameter (as if this is a square Cartesian projection) because it would give the appearance of using -J.
  5. Elsewhere in GMT, we use have the polar cylindrical projection -JP with proper -B support, and here -R is properly given as -Rtheta0/theta1/r0/r1.

It is too late to fix the way psrose works. I propose this solution to address all the wrong things in psrose as well as enable future features:

  1. Add the polar histogram to pshistogram via -JP. Then -JX sets the Cartesian histogram and -JP does the polar. Both projections have proper -R and -B support.
  2. Deprecate psrose so it is no longer discussed but it will remain available under the hood for backwards usage.

Accepting comments from @GenericMappingTools/core.

PaulWessel avatar Dec 22 '21 05:12 PaulWessel

Sound good!! I agree that psrose could be upgrade.

Esteban82 avatar Dec 22 '21 17:12 Esteban82

A few questions:

  1. Would all capabilities currently supported by psrose be possible with pshistogram -JP? (e.g., -E, -Q, -S)
  2. In the proposed merge of histogram and rose, would histograms representing multiple dimensions be a reasonable feature request (e.g., https://forum.generic-mapping-tools.org/t/plotting-a-wind-rose-2d-histogram-style/2415)? I agree with the author of that post in this being a major limitation of psrose.

Linking @GenericMappingTools/pygmt-maintainers into the conversation, since this would likely lead to a PyGMT deprecation as well.

maxrjones avatar Dec 22 '21 20:12 maxrjones

It is true that rose has a few options specific to polar histogram and of course those letters are already taken for other things in histogram. I will go through all options and see what collisions we end up.

PaulWessel avatar Dec 22 '21 23:12 PaulWessel

I don't think deprecating psrose, even if leaving it crawling in the underground, is a good idea. People would start (and keep) asking what happened to it. Better just leave it as is and adding a big deprecation in the man page (but not necessarily in the binary).

joa-quim avatar Dec 23 '21 02:12 joa-quim

To be discussed I think. We could even have a redirecting psrose page that explains why and gives the link to pshistogram. for instance.

PaulWessel avatar Dec 23 '21 02:12 PaulWessel

The binning radially is also a desirable feature for Cartesian histograms, we will do that for both types.

PaulWessel avatar Dec 23 '21 03:12 PaulWessel