Skip to content

Bug in plotting XZ and YZ planes in perspective view #529

Closed

Description

@seisman

Full script that generated the error

gmt begin perspective pdf
gmt basemap -R0/10/0/10/0/20 -JX3c -JZ3c -Baf -Bzaf -BwsENZ1+b -pz135/40/5
gmt basemap -R0/10/0/10/0/20 -JX3c -JZ3c -Baf -Bzaf -BwsENZ1+b -px135/40/5 -X6c
gmt basemap -R0/10/0/10/0/20 -JX3c -JZ3c -Baf -Bzaf -BwsENZ1+b -py135/40/5 -X6c
gmt end

perspective

Description of the problem

If my understanding of -p option is correct, -px would plot a YZ plane at x=5 (the center of X axis). However, it seems the YZ plane is plotted at x=2.5. The same happens to -py.

Is this a bug or do I misunderstand the -p option.

System information

  • Operating system: macOS
  • Version of GMT: 6.0.0_b03d6d7_2019.03.06

Activity

  1. PaulWessel commented on Mar 18, 2019

    @PaulWessel
    Contributor

    Certainly looks like a bug or two. We agree that the -pz option seems to work but not the other two. I am also not sure about the lack of the "5" annotation on the z-axis, especially for the last two plots.

  2. PaulWessel commented on Mar 24, 2019

    @PaulWessel
    Contributor

    Perhaps @remkos can have a look at this as he implemented this version of -p I think. I am not sure what our intent is with the "z" value in -p when -px or -py are selected. We clearly also have code that seeks to skip the plotting of the z-annotation at the level of the horizontal plane, and that code predates -px and -py as well.

  3. stale commented on Apr 23, 2019

    @stale

    This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.

  4. added
    stale
    on Apr 23, 2019
  5. added
    bug
    and removed
    stale
    on Apr 23, 2019
  6. self-assigned this
    on Apr 30, 2019
  7. remkos commented on Apr 30, 2019

    @remkos
    Contributor

    I will put this one on me. The whole plotting with -px and -py was never implemented robustly, and some things simply cannot work given the way the projection is implemented in PostScript.
    However, this is clearly an error and it ought to be corrected.

  8. joa-quim commented on Jun 11, 2023

    @joa-quim
    Member

    #7518 Fixed the bad plane location for the second and third cases. However the base of the cube is no longer plotted, though it wasn't anymore before #7518 fix so an unrelated issue.

  9. seisman commented on Jun 12, 2023

    @seisman
    MemberAuthor

    After PR #7518 I'm getting this:
    perspective

    The plane locations are correct, but the z-annotation locations are wrong.

  10. joa-quim commented on Jul 18, 2023

    @joa-quim
    Member

    But you were also getting that before #7518 and if no one will fix it, no point in having this issue open.

  11. seisman commented on Jul 18, 2023

    @seisman
    MemberAuthor

    No, the z-annotation locations were correct before #7518.

  12. PaulWessel commented on Oct 29, 2023

    @PaulWessel
    Contributor

    Revisit this with a slightly modified script using subplot:

    gmt begin perspective png
    	gmt subplot begin 1x3 -Fs3c/6c -R0/10/0/10/0/20 -JX3c -JZ3c -M16p -Baf -Bzaf -BwsENZ1+b
    		gmt basemap -pz135/40/5 -B+tpz -c
    		gmt basemap -px135/40/5 -B+tpx -c
    		gmt basemap -py135/40/5 -B+tpy -c
    	gmt subplot end
    gmt end show
    

    which gives almost the above plot but OK z-annotations. However, a few bugs is noted:

    1. The title strings px and py are way off while pz is fine
    2. The pz plot lacks an annotated vertical axis
    3. The px and py cubes lack the base z-level frame and annotation.

    Clearly, the px and py are still not implemented correctly.

    perspective

  13. PaulWessel commented on Nov 7, 2023

    @PaulWessel
    Contributor

    If I change the -R so the are different:

    gmt begin perspective png
    	gmt subplot begin 1x3 -Fs3c/6c -R0/10/10/20/20/30 -JX3c -JZ3c -M16p -Baf -Bzaf -BwsENZ1+b
    		gmt basemap -pz145/40/27 -B+tpz -c
    		gmt basemap -px145/40/6 -B+tpx -c
    		gmt basemap -py145/40/15 -B+tpy -c
    	gmt subplot end
    gmt end show
    

    Then I get this:

    perspective

    So it always annotates x & y values but I think should switch to y-z for -px and and x-z if -py.

  14. remkos commented on Nov 8, 2023

    @remkos
    Contributor

    The original intent when -px -py were implemented was to slap an x-y plot onto one of the "walls". That's why the annotations were taken from the -Rx0/x1/y0/y1.
    In the GMT4 times, with all the commands needing individual -R -J, this was kind of logical.
    Not so today with the -R -J in the subplot statement.

  15. joa-quim commented on May 31, 2026

    @joa-quim
    Member

    #9047 fixed most of this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions