GenericMappingTools / gmt

The Generic Mapping Tools
https://www.generic-mapping-tools.org
Other
843 stars 350 forks source link

Let pshistogram handle both Cartesian and polar histograms #6141

Open PaulWessel opened 2 years ago

PaulWessel commented 2 years ago

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.

Esteban82 commented 2 years ago

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

maxrjones commented 2 years ago

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.

PaulWessel commented 2 years ago

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.

joa-quim commented 2 years ago

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).

PaulWessel commented 2 years ago

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 commented 2 years ago

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