-
Notifications
You must be signed in to change notification settings - Fork 1
Figure 7: NumPy / datetime objects - date time chart - GitHub stars of GMT and the wrappers #10
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
base: main
Are you sure you want to change the base?
Changes from 33 commits
ba6f420
c0b903b
248a5bd
414c8b8
c73b38b
b46752c
2150e2a
e525ea6
7434785
9d3fb0d
80cf207
40bb6ce
6853dce
9188574
37d95e3
8b22b2f
abcc381
2550708
305321c
331718c
c0ef9ed
2ee2822
29a78d5
3118402
7ab6240
6aafdce
38d582d
268dd4b
38b04a2
81891b2
f9ff990
caa4edc
fd86eb7
79389d5
c144d8c
2e8a472
73ea374
0018c93
3da5bff
8f9dd85
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 1, | ||
| "id": "38df9b7b-1835-4ec9-aa00-a85c8b80730e", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# Copy finale version of script from normal Python file" | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": "Python 3 (ipykernel)", | ||
| "language": "python", | ||
| "name": "python3" | ||
| }, | ||
| "language_info": { | ||
| "codemirror_mode": { | ||
| "name": "ipython", | ||
| "version": 3 | ||
| }, | ||
| "file_extension": ".py", | ||
| "mimetype": "text/x-python", | ||
| "name": "python", | ||
| "nbconvert_exporter": "python", | ||
| "pygments_lexer": "ipython3", | ||
| "version": "3.12.3" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 5 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import datetime | ||
|
|
||
| import pandas as pd | ||
| import pygmt | ||
| from pygmt.params import Box | ||
|
|
||
|
|
||
| fig = pygmt.Figure() | ||
|
|
||
| fig.basemap( | ||
| projection="X12c/6c", | ||
| region=[datetime.date(2016, 1, 1), datetime.date(2026, 12, 31), -50, 1000], | ||
| frame=["x+lYear", "ya100f50+lGitHub stars"], | ||
| ) | ||
|
|
||
| for wrapper, file, color in zip( | ||
| ["GMT", "GMT/MEX", "GMT.jl", "PyGMT"], | ||
| ["gmt", "gmtmex", "gmtjl", "pygmt"], | ||
| ["238/86/52", "253/131/68", "170/121/193", "63/124/173"], | ||
| strict=False, | ||
| ): | ||
| df = pd.read_csv(f"star_history_{file}.csv") | ||
| df["Date"] = df["Date"].str.split(" \\(").str[0] | ||
| df["Date"] = pd.to_datetime( | ||
| df["Date"], format="%a %b %d %Y %H:%M:%S GMT%z", utc=True | ||
| ) | ||
|
|
||
| fig.plot(x=df["Date"], y=df["Stars"], pen=color) | ||
| fig.plot(x=df["Date"], y=df["Stars"], fill=color, style="a0.35c", label=wrapper) | ||
|
||
|
|
||
| fig.legend( | ||
| position="jTL+o0.1c+w2.3", box=Box(fill="gray95", pen="0.5p,gray50", radius="3p"), | ||
| ) | ||
|
|
||
| fig.show() | ||
| fig.savefig(fname="Fig7_PyGMT_datetime.png") | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| Repository,Date,Stars | ||
| GenericMappingTools/gmt,Sun Aug 12 2018 04:28:37 GMT+0200 (Mitteleuropäische Sommerzeit),0 | ||
yvonnefroehlich marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| GenericMappingTools/gmt,Mon Aug 13 2018 04:28:37 GMT+0200 (Mitteleuropäische Sommerzeit),1 | ||
| GenericMappingTools/gmt,Fri Jan 04 2019 21:15:59 GMT+0100 (Mitteleuropäische Normalzeit),62 | ||
| GenericMappingTools/gmt,Fri Mar 08 2019 15:57:05 GMT+0100 (Mitteleuropäische Normalzeit),123 | ||
| GenericMappingTools/gmt,Thu Aug 01 2019 13:21:13 GMT+0200 (Mitteleuropäische Sommerzeit),184 | ||
| GenericMappingTools/gmt,Tue Dec 10 2019 00:27:29 GMT+0100 (Mitteleuropäische Normalzeit),245 | ||
| GenericMappingTools/gmt,Thu Mar 26 2020 09:37:59 GMT+0100 (Mitteleuropäische Normalzeit),306 | ||
| GenericMappingTools/gmt,Sun Jul 19 2020 23:32:09 GMT+0200 (Mitteleuropäische Sommerzeit),367 | ||
| GenericMappingTools/gmt,Thu Jan 21 2021 10:07:51 GMT+0100 (Mitteleuropäische Normalzeit),428 | ||
| GenericMappingTools/gmt,Tue Jun 22 2021 19:14:01 GMT+0200 (Mitteleuropäische Sommerzeit),489 | ||
| GenericMappingTools/gmt,Wed Dec 22 2021 03:00:24 GMT+0100 (Mitteleuropäische Normalzeit),550 | ||
| GenericMappingTools/gmt,Fri Jun 24 2022 13:11:39 GMT+0200 (Mitteleuropäische Sommerzeit),611 | ||
| GenericMappingTools/gmt,Wed Mar 01 2023 19:23:26 GMT+0100 (Mitteleuropäische Normalzeit),672 | ||
| GenericMappingTools/gmt,Fri Sep 15 2023 09:52:04 GMT+0200 (Mitteleuropäische Sommerzeit),733 | ||
| GenericMappingTools/gmt,Mon Apr 15 2024 08:20:29 GMT+0200 (Mitteleuropäische Sommerzeit),794 | ||
| GenericMappingTools/gmt,Thu Dec 05 2024 07:00:13 GMT+0100 (Mitteleuropäische Normalzeit),855 | ||
| GenericMappingTools/gmt,Fri Oct 17 2025 13:42:18 GMT+0200 (Mitteleuropäische Sommerzeit),916 | ||
| GenericMappingTools/gmt,Fri Nov 21 2025 15:14:12 GMT+0100 (Mitteleuropäische Normalzeit),921 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| Repository,Date,Stars | ||
| GenericMappingTools/GMT.jl,Wed Feb 24 2016 04:55:51 GMT+0100 (Mitteleuropäische Normalzeit),0 | ||
| GenericMappingTools/GMT.jl,Thu Feb 25 2016 04:55:51 GMT+0100 (Mitteleuropäische Normalzeit),1 | ||
| GenericMappingTools/GMT.jl,Mon May 14 2018 22:45:09 GMT+0200 (Mitteleuropäische Sommerzeit),15 | ||
| GenericMappingTools/GMT.jl,Tue Dec 25 2018 09:59:20 GMT+0100 (Mitteleuropäische Normalzeit),29 | ||
| GenericMappingTools/GMT.jl,Thu Sep 05 2019 22:51:52 GMT+0200 (Mitteleuropäische Sommerzeit),43 | ||
| GenericMappingTools/GMT.jl,Thu Feb 06 2020 08:02:08 GMT+0100 (Mitteleuropäische Normalzeit),57 | ||
| GenericMappingTools/GMT.jl,Sat Jul 25 2020 01:53:54 GMT+0200 (Mitteleuropäische Sommerzeit),71 | ||
| GenericMappingTools/GMT.jl,Sun Feb 07 2021 20:42:01 GMT+0100 (Mitteleuropäische Normalzeit),85 | ||
| GenericMappingTools/GMT.jl,Wed Jul 21 2021 04:32:12 GMT+0200 (Mitteleuropäische Sommerzeit),99 | ||
| GenericMappingTools/GMT.jl,Thu Nov 11 2021 04:12:13 GMT+0100 (Mitteleuropäische Normalzeit),113 | ||
| GenericMappingTools/GMT.jl,Tue Feb 01 2022 10:40:01 GMT+0100 (Mitteleuropäische Normalzeit),127 | ||
| GenericMappingTools/GMT.jl,Thu Sep 29 2022 21:50:54 GMT+0200 (Mitteleuropäische Sommerzeit),141 | ||
| GenericMappingTools/GMT.jl,Thu Jun 08 2023 10:43:42 GMT+0200 (Mitteleuropäische Sommerzeit),155 | ||
| GenericMappingTools/GMT.jl,Mon Nov 13 2023 05:20:11 GMT+0100 (Mitteleuropäische Normalzeit),169 | ||
| GenericMappingTools/GMT.jl,Sat Mar 23 2024 08:08:10 GMT+0100 (Mitteleuropäische Normalzeit),183 | ||
| GenericMappingTools/GMT.jl,Thu Jan 09 2025 15:59:08 GMT+0100 (Mitteleuropäische Normalzeit),197 | ||
| GenericMappingTools/GMT.jl,Tue Oct 21 2025 11:38:42 GMT+0200 (Mitteleuropäische Sommerzeit),211 | ||
| GenericMappingTools/GMT.jl,Fri Nov 21 2025 15:15:06 GMT+0100 (Mitteleuropäische Normalzeit),212 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| Repository,Date,Stars | ||
| GenericMappingTools/gmtmex,Sat Jul 01 2017 03:18:20 GMT+0200 (Mitteleuropäische Sommerzeit),0 | ||
| GenericMappingTools/gmtmex,Sun Jul 02 2017 03:18:20 GMT+0200 (Mitteleuropäische Sommerzeit),1 | ||
| GenericMappingTools/gmtmex,Mon May 14 2018 22:46:28 GMT+0200 (Mitteleuropäische Sommerzeit),4 | ||
| GenericMappingTools/gmtmex,Wed Nov 14 2018 17:04:41 GMT+0100 (Mitteleuropäische Normalzeit),7 | ||
| GenericMappingTools/gmtmex,Sat Jul 20 2019 16:00:45 GMT+0200 (Mitteleuropäische Sommerzeit),10 | ||
| GenericMappingTools/gmtmex,Sat Jan 11 2020 06:41:28 GMT+0100 (Mitteleuropäische Normalzeit),13 | ||
| GenericMappingTools/gmtmex,Fri Jun 12 2020 21:09:26 GMT+0200 (Mitteleuropäische Sommerzeit),16 | ||
| GenericMappingTools/gmtmex,Sun Dec 13 2020 09:19:15 GMT+0100 (Mitteleuropäische Normalzeit),19 | ||
| GenericMappingTools/gmtmex,Wed Jan 27 2021 09:39:12 GMT+0100 (Mitteleuropäische Normalzeit),22 | ||
| GenericMappingTools/gmtmex,Mon Jun 28 2021 08:39:36 GMT+0200 (Mitteleuropäische Sommerzeit),25 | ||
| GenericMappingTools/gmtmex,Thu Apr 28 2022 16:01:03 GMT+0200 (Mitteleuropäische Sommerzeit),28 | ||
| GenericMappingTools/gmtmex,Sat Jun 18 2022 15:54:33 GMT+0200 (Mitteleuropäische Sommerzeit),31 | ||
| GenericMappingTools/gmtmex,Tue Nov 29 2022 21:38:50 GMT+0100 (Mitteleuropäische Normalzeit),34 | ||
| GenericMappingTools/gmtmex,Fri Jun 23 2023 14:39:56 GMT+0200 (Mitteleuropäische Sommerzeit),37 | ||
| GenericMappingTools/gmtmex,Sun Apr 14 2024 00:06:35 GMT+0200 (Mitteleuropäische Sommerzeit),40 | ||
| GenericMappingTools/gmtmex,Thu Nov 07 2024 09:32:06 GMT+0100 (Mitteleuropäische Normalzeit),43 | ||
| GenericMappingTools/gmtmex,Tue Feb 11 2025 01:43:13 GMT+0100 (Mitteleuropäische Normalzeit),46 | ||
| GenericMappingTools/gmtmex,Thu Jul 17 2025 14:13:40 GMT+0200 (Mitteleuropäische Sommerzeit),49 | ||
| GenericMappingTools/gmtmex,Fri Nov 21 2025 15:23:28 GMT+0100 (Mitteleuropäische Normalzeit),51 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| Repository,Date,Stars | ||
| GenericMappingTools/pygmt,Wed Mar 29 2017 18:55:38 GMT+0200 (Mitteleuropäische Sommerzeit),0 | ||
| GenericMappingTools/pygmt,Thu Mar 30 2017 18:55:38 GMT+0200 (Mitteleuropäische Sommerzeit),1 | ||
| GenericMappingTools/pygmt,Fri Dec 15 2017 05:43:03 GMT+0100 (Mitteleuropäische Normalzeit),56 | ||
| GenericMappingTools/pygmt,Thu Aug 16 2018 00:40:24 GMT+0200 (Mitteleuropäische Sommerzeit),111 | ||
| GenericMappingTools/pygmt,Thu Apr 04 2019 06:16:00 GMT+0200 (Mitteleuropäische Sommerzeit),166 | ||
| GenericMappingTools/pygmt,Sun Feb 09 2020 03:16:37 GMT+0100 (Mitteleuropäische Normalzeit),221 | ||
| GenericMappingTools/pygmt,Tue Sep 22 2020 16:42:43 GMT+0200 (Mitteleuropäische Sommerzeit),276 | ||
| GenericMappingTools/pygmt,Tue Apr 06 2021 06:11:27 GMT+0200 (Mitteleuropäische Sommerzeit),331 | ||
| GenericMappingTools/pygmt,Mon Sep 27 2021 08:17:59 GMT+0200 (Mitteleuropäische Sommerzeit),386 | ||
| GenericMappingTools/pygmt,Tue Feb 08 2022 17:27:56 GMT+0100 (Mitteleuropäische Normalzeit),441 | ||
| GenericMappingTools/pygmt,Sun Jun 19 2022 04:58:52 GMT+0200 (Mitteleuropäische Sommerzeit),496 | ||
| GenericMappingTools/pygmt,Thu Dec 01 2022 19:47:20 GMT+0100 (Mitteleuropäische Normalzeit),551 | ||
| GenericMappingTools/pygmt,Sun Jun 11 2023 18:13:29 GMT+0200 (Mitteleuropäische Sommerzeit),606 | ||
| GenericMappingTools/pygmt,Sun Nov 12 2023 06:54:04 GMT+0100 (Mitteleuropäische Normalzeit),661 | ||
| GenericMappingTools/pygmt,Fri May 10 2024 20:05:01 GMT+0200 (Mitteleuropäische Sommerzeit),716 | ||
| GenericMappingTools/pygmt,Mon Jan 06 2025 20:51:42 GMT+0100 (Mitteleuropäische Normalzeit),771 | ||
| GenericMappingTools/pygmt,Fri Nov 21 2025 15:13:34 GMT+0100 (Mitteleuropäische Normalzeit),825 |


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 also made a comment regarding the data source in the manuscript: Afaik it's not possible to directly load the data via URL? Would make the workflow much more professional than loading (outdated) individual csv's.
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 think the answer is no; however, Fig. 4 already demonstrates how to load a dataset via a URL, so reading CSV files in this example is not that bad.
In fact, I'm not happy with the star-history data, as the stars are unevenly sampled.
GitHub provides an API to retrieve star history. The Python script below returns the timestamp when each user starred the PyGMT project. The code is about 30 lines long, so it may be too long to include in the manuscript. Nevertheless, we could use the script to obtain the full history of project stars and then resample the data at every three-month intervals.
Uh oh!
There was an error while loading. Please reload this page.
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.
Would be nice, but for me it still looks like, it is only possilbe to get a link which creates an live-updated time chart for the project GitHub README. And the CSV files one can download contain the date of downloading in the file name. Also the temporal sampling is a bit interesting, as it is not equally spaced and different for different repos; would prefer to have the data points for all repos at the same dates.
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 guess @seisman means to group the data into 3-months buckets and just show for each project quarterly numbers. This would allow to have the same time-spacing for all repos.
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.
It seems like @seisman and I wrote our comments nearly at the same time 🙃, and we are both pointing out that the star-history data does not have an equal time spacing. And I am actually having the impression that the data points that are reported in the CSV file change over time.
Tried the request script from Dongdong. I do not think we have to show this directly in the manuscript. We can include it as a separate cell in the JN, but for the example itself, it should be OK to load the saved CSV files and focus on the plotting.
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'm thinking about which columns to store in the CSV file and what to include in the manuscript:
DateandStarsat three-month intervals. It can be plotted directly, so the example code can focus on PyGMT plotting.DateandStarsfor each GitHub user.Starsgo from 1 to the max. In the example code, we'd need to resample it to three-month intervals before plotting.UserNameandDatefor each GitHub user. This is basically the raw data. We need to do data processing to get the cumulative stars before plotting. This also makes the code follow a clearer read → process → visualize workflow.