Skip to content

Figure.ternary: Support Frame's xaxis/yaxis/zaxis attributes to set axis settings for a/b/c axes#4517

Open
Chuan1937 wants to merge 40 commits intomainfrom
test_ternary
Open

Figure.ternary: Support Frame's xaxis/yaxis/zaxis attributes to set axis settings for a/b/c axes#4517
Chuan1937 wants to merge 40 commits intomainfrom
test_ternary

Conversation

@Chuan1937
Copy link
Copy Markdown
Member

Add ternary frame

Update the test pygmt/tests/test_ternary.py to use the new implemented Frame and Axis parameter classes.

Fixes partly #4494

@seisman
Copy link
Copy Markdown
Member

seisman commented Apr 9, 2026

xref: #4505 (comment)

@yvonnefroehlich
Copy link
Copy Markdown
Member

Actually I would split this into two PRs, one for the code changes for the ternary frame itself and one for updating the tests.

@Chuan1937 Chuan1937 changed the title Add ternary frame and DOC/Test "test_ternary": Migrate frame settings to the new Frame/Axis syntax Internally convert xaxis/yaxis/zaxis to -Ba/-Bb/-Bc Apr 10, 2026
@Chuan1937 Chuan1937 changed the title Internally convert xaxis/yaxis/zaxis to -Ba/-Bb/-Bc Internally convert xaxis/yaxis/zaxis to -Ba/-Bb/-Bc for ternary Apr 10, 2026
Comment thread pygmt/src/ternary.py Outdated
@seisman
Copy link
Copy Markdown
Member

seisman commented Apr 10, 2026

Actually I would split this into two PRs, one for the code changes for the ternary frame itself and one for updating the tests.

Actually we have to update the tests in this PR to ensure the code changes are correct.

Comment thread pygmt/src/ternary.py Outdated
@seisman seisman changed the title Internally convert xaxis/yaxis/zaxis to -Ba/-Bb/-Bc for ternary Figure.ternary: Internally convert xaxis/yaxis/zaxis to -Ba/-Bb/-Bc Apr 10, 2026
Comment thread pygmt/tests/test_ternary.py Outdated
Comment thread pygmt/src/ternary.py Outdated
Comment thread pygmt/src/ternary.py Outdated
Comment thread pygmt/src/ternary.py Outdated
Co-authored-by: Dongdong Tian <[email protected]>
Chuan1937 and others added 8 commits April 17, 2026 11:18
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Comment thread pygmt/src/ternary.py Outdated
Comment thread pygmt/src/ternary.py
Comment thread pygmt/tests/test_ternary.py
Comment thread pygmt/tests/test_ternary.py
Comment thread pygmt/tests/test_ternary.py
@seisman
Copy link
Copy Markdown
Member

seisman commented Apr 17, 2026

Still need to generate the baseline images and put them to dagshug, following the instructions at https://www.pygmt.org/dev/contributing.html#using-data-version-control-dvc-to-manage-test-images. Let me know if you'd like to do it or need help.

@Chuan1937
Copy link
Copy Markdown
Member Author

Still need to generate the baseline images and put them to dagshug, following the instructions at https://www.pygmt.org/dev/contributing.html#using-data-version-control-dvc-to-manage-test-images. Let me know if you'd like to do it or need help.

ok, I can do it.

@Chuan1937
Copy link
Copy Markdown
Member Author

@seisman
I tried pushing to DagsHub, but I'm not a collaborator yet.

@seisman
Copy link
Copy Markdown
Member

seisman commented Apr 17, 2026

You need to create an account on DagsHub, and then I can add you as a collaborator

@Chuan1937
Copy link
Copy Markdown
Member Author

You need to create an account on DagsHub, and then I can add you as a collaborator

I have logged in using github.

@seisman
Copy link
Copy Markdown
Member

seisman commented Apr 17, 2026

Hmmm. I can't find you https://dagshub.com/Chuan1937

@Chuan1937
Copy link
Copy Markdown
Member Author

Hmmm. I can't find you https://dagshub.com/Chuan1937

I changed to https://dagshub.com/Chuan1937

@seisman
Copy link
Copy Markdown
Member

seisman commented Apr 17, 2026

Ok. DOne

Comment thread pygmt/src/ternary.py Outdated
Comment thread pygmt/tests/baseline/test_ternary.png.dvc Outdated
Comment thread pygmt/tests/baseline/test_ternary_1_label.png.dvc
Comment thread pygmt/tests/baseline/test_ternary_3_labels.png.dvc Outdated
Co-authored-by: Dongdong Tian <[email protected]>
@seisman
Copy link
Copy Markdown
Member

seisman commented Apr 18, 2026

I just found one minor issue, which can be reproduced below

gmt begin map
  gmt makecpt -Cturbo -T0/80/10
  gmt ternary @ternary.txt -R0/100/0/100/0/100 -JX15c -Sc0.1c -C -Bafg
  gmt ternary @ternary.txt -R0/100/0/100/0/100 -JX15c -Sc0.1c -C -Bafg -B -Xw+1cba
gmt end show
map

As you can see, passing -Bafg alone doesn't plot the frame, which makes little sense. I think in this case, we should always pass -Bafg -B instead.

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

Labels

enhancement Improving an existing feature needs review This PR has higher priority and needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants