-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong point location in inset #1930
Comments
Hi @eyalshimony, thanks for trying PyGMT! So it's a bit unintuitive, but it's best not to set the projection width in the inset plot. Try this instead: with fig.inset(position="jTR+w3c", box="+pblack"):
# Use a plotting function to create a figure inside the inset
fig.coast(
region=[-125, -110, 30, 45],
projection="M?c",
land="gray",
borders=[1, 2],
shorelines="1/thin",
water="white"
)
fig.plot(x=-117.55, y=35.7, size=[0.2], style="c", frame="afg", color="black") Specifically, use You may need to adjust the width in |
Thanks for the quick response! It may be helpful for other users if you'll correct the example in https://www.pygmt.org/v0.3.0/tutorials/inset.html accordingly. |
Yes that would be a good idea. Would you like to try making a quick change at https://github.com/GenericMappingTools/pygmt/edit/main/examples/tutorials/advanced/insets.py? |
I submitted the change |
I am sorry, I checked it and it actually ruins some stuff in the example. Most importantly, the highlighting stops working. I do not know enough about this in order to fix it, so I think it is best be left to the experts. |
Where did you submit it? Just take a look at our contributing guide on how to create a PR for fixing issues 😉. |
I see you've made the change at https://github.com/eyalshimony/pygmt/tree/patch-1. If you click on the 'Contribute' button and then Open Pull Request, we'll be able to see it. |
Yes, I understood it afterwards but as I said above changing the projection along your recommendations ruins the highlighting. I have no idea why, so I think it would be better if you'd fix it. |
Hmm yeah, I just tried using |
I'm reopening the issue to track the potential issue in https://github.com/GenericMappingTools/pygmt/blob/main/examples/tutorials/advanced/insets.py |
We have to use |
With M? the highlighting exists, but it is in the wrong location |
Yes, I can confirm the issue. After some tries, I think the only one that works is |
Here is a GMT bash script to reproduce the issue:
For the @PaulWessel The use of |
Ping @PaulWessel on #1930 (comment) |
Yep, saw this issue but up to my neck in issues (not all GMT), so I will get to it when I can. |
The key thing that happens is the unfortunate selection of -R and inset size (square). That map is not square, so GMT finds that the hight with I am not sure what to do for the unfortunate selection of -R and a square inset. It is not easy for the user to know what is the best -R that gives a square map for some projection. Perhaps we need to come up with a better implementation here. Maybe the inset command should be |
And gmt_DCW_operation ends up making a virtual dataset and passing it via a call to psxy where the command string contains -J. So I think it picks up the |
@eyalshimony Here is a better solution for you case. So instead of specifying
Unfortunately,
|
Description of the problem
When plotting a point in an inset, it is drawn in the wrong geographic location.
Full code that generated the error
System information
Please paste the output of
python -c "import pygmt; pygmt.show_versions()"
:PyGMT information:
version: v0.6.0
System information:
python: 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)]
executable: C:\Users\eyals\AppData\Local\Programs\Python\Python310\python.exe
machine: Windows-10-10.0.19044-SP0
Dependency information:
numpy: 1.21.2
pandas: 1.3.3
xarray: 0.19.0
netCDF4: 1.5.7
packaging: 21.0
ghostscript: 9.54.0
gmt: 6.3.0
GMT library information:
binary dir: C:/Users/eyals/AppData/Local/Programs/Python/Python310
cores: 4
grid layout: rows
library path: c:/programs/gmt6/bin/gmt_w64.dll
padding: 2
plugin dir: c:/programs/gmt6/bin/gmt_plugins
share dir: c:/programs/gmt6/share
version: 6.3.0
The text was updated successfully, but these errors were encountered: