-
Notifications
You must be signed in to change notification settings - Fork 1
Figure 4: pandas / tabular data - scatter plot - seismicity around Indonesia #5
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
Conversation
|
Found 1 changed notebook. Review the changes at https://app.gitnotebooks.com/GenericMappingTools/pygmt-paper-figures/pull/5 |
|
@yvonnefroehlich Could you please also include the image in the notebooks, which can make review easier. |
I have included the output images within the notebooks for all PRs. During preparing the AGU24 preworkshop we faced an issue with the review of JNs using gitnotebooks, please see GenericMappingTools/agu24workshop#9 (comment). It looks like that images lead to large diffs and for some JNs these diffs become too large and reviewing the JNs failed, but it worked when not showing the output images (less usage of |
I also prefare to have real data. We also used real data for the seismology example in the workshop last year (wow - this is already nearly one year ago).
Sounds good.
I agree that we should mention |
Looking at GMT's plotting modules (https://docs.generic-mapping-tools.org/6.6/modules.html#plotting) and gallery examples (https://docs.generic-mapping-tools.org/6.6/gallery.html), I wish we could use GMT's
|
Hm, good questions. Not sure if there is something suitable for our example. For teleseismic studies, the backazimuth coverage by earthquakes around a recording station. But so far we plot the area with the epicenters.
Wow, somebody is looking at these maps. Thanks for the positive feedback 🙂! Regarding the epicenter map with the depth section at the sides: I saw such maps in publications and was wondering how people made the depth sections at the bottom and right. Thus I tried to figure out how to get a plot with a Cartesian depth axis but with geographical longitude or latitude axis to match the Mercator projection of the map in the center. As far as I know, there is no projection provided by GMT to do this directly, but you have to create several frames. Besides this, one needs to know the height of the map to know the height of the depth section on the right. Of course you can adjust this manually. But I think it could be nice to have a script where you can adjust the study area and the dimensions of the depth sections are adjusted automatically. GMT provides the Regarding the choropleth map: Here I actually tried to make a choropleth map by explicitly avoiding the polygon geometry provided by GeoPandas but using the |
|
|
I'm still debating which version to choose. The old one includes one scatter plot and two histograms. It not only demonstrates pandas support but also shows that PyGMT can generate histograms. The new one features three scatter plots and illustrates how to use the mapproject wrapper to obtain height and map coordinates, but it might be a bit too technical? I'm a bit inclined toward the old version. |
I agree the advantage of the old version is that the histogram is a non-map plot. The new version is definitely more technical, but this kind of plot seems to be widely used in seismology publications. And getting the figure height can be useful for other figures too. Maybe we can include the mapproject wrapper in the old version: we can extract the height of the main map and use it to determine and set the height of the histograms (see commit d8238d7). |
I added an inset map in commit 6c1bfad. It's only 4 lines more (without comments). But the inset has to be added before plotting the epicenters on the main map to have the dimensions of the main map available for |
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Fig4_PyGMT_pandas.py
Outdated
|
|
||
| # Plot epicenters with color (hypocentral depth) or size (moment magnitude) | ||
| pygmt.makecpt(cmap="SCM/navia", series=[0, 700], reverse=True, transparency=30) | ||
| fig.colorbar(frame=["xaf+lHypocentral depth", "y+lkm"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just simplify it to:
| fig.colorbar(frame=["xaf+lHypocentral depth", "y+lkm"]) | |
| fig.colorbar(frame="af+lHypocentral depth (km)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. I placed the unit as y label to avoid that we have to think about having units in brackets or using a /🙃😅.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, we can keep it now. But I feel the frame parameter is still not Pythonic and we may need to implement the Frame class anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes, the frame parameter is maybe the most complicated parameter in GMT / PyGMT and provides a huge amount of quite different functionalities 🙂.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, maybe we should have a look at the author guidelines of
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Fig4_PyGMT_pandas.py
Outdated
|
|
||
| # Add histogram for magnitude distribution | ||
| with fig.inset(position="jBL+w7c/4c+o0.2c", margin=(1.2, 0.2, 0.9, 0.2), box=True): | ||
| with pygmt.config(FONT="8p"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need to set the FONT here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove it; please see my comment #5 (comment). And in addition, there are different themes in GMT which also affect the defaults. I think having different font sizes look OK.
![]() |
![]() |
seisman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel this PR is good to merge except for two minor comments.
As before, please clean up the Python version and the output PNG images.
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
…siong | Clean cells
|
Line 51: "Magnitude M" seems duplicate, "Magnitude" is enough. |



This PR adds a JN for
pandas- tabular data -DataFrame:Figure.plot- scatter plot (color- and size-coding)Figure.histogram(not only maps)Preview:
