michaelgrund / gmt-plotting Goto Github PK
View Code? Open in Web Editor NEWCollection of GMT (Generic Mapping Tools) scripts, jupyter notebooks (using PyGMT) and files (including digitized map content, colormaps, grid files etc.)
Collection of GMT (Generic Mapping Tools) scripts, jupyter notebooks (using PyGMT) and files (including digitized map content, colormaps, grid files etc.)
Hi,
reproducing the code at least in the first two examples the same error arise:
mapproject [ERROR]: Cannot specify -J option with selected form of -G
Thank you
In Figure S10 (009_paper_GR2020), the colormap represented by the colorwheel does not match the color-coding used for the bars of the splits. The plots in the Supplementary Material of Grund & Ritter (2020) shown up on page 28 look correct.
Suggestions to fix this issue
This Jupyter Notebook seems not completely finished. However, maybe the code snippets below can serve as an orientations, in case further work on this JN is planed.
(1) Adjust colormap used for plotting the data points
reverse=True
(not False
)# generate colormap for values between 0 and 360 degrees
pygmt.makecpt(
cmap="romaO",
series=[0 ,360 , 1],
reverse=True, # not False
output="cmapmod.cpt",
)
(2) Adjust creation of colorwheel via Matplotlib
matplotlib.pyplot.savefig
. Error message FigureCanvasPS._print_figure() got an unexpected keyword argument 'figsize'
# define plotting range
theta = np.linspace(0, 2*pi, 360) # no shift by 0.5*pi anymore
rho = ([1.22, 2])
# plot in polar projection, loop over the whole range 0 to 360 degrees
for ii in range(360):
# backazimuth in seismology
# from North (0 deg)
ax.set_theta_offset(pi/2)
# clockwise, i.e. to East (90 deg)
ax.set_theta_direction(-1)
plt.polar(
[theta[ii], theta[ii]],
rho,
color=[cmapa[0][ii], cmapa[1][ii], cmapa[2][ii]],
linewidth=2,
)
(3) Use PyGMT instead of Matplotlib to create colorwheel
import pygmt
cmap_colorwheel = "romaO"
rho_min = 1.22
rho_max = 2
fig = pygmt.Figure()
pygmt.config(
# make area outside of plot transparent
PS_PAGE_COLOR="white@1",
# make frame outline white
MAP_FRAME_PEN="white",
)
fig.basemap(
region=[0, 360, rho_min, rho_max],
# geographic azimuth instead of standard angle
# clockwise from North instead of counter-clockwise from East
projection="P5c+a",
frame="rltb",
)
pygmt.makecpt(
cmap=cmap_colorwheel,
cyclic=True,
series=[0, 360, 1],
)
# takes some time
for i_ang in range(0,360,1): # min, max], step
rho = [rho_min, rho_max]
fig.plot(
x=[i_ang, i_ang],
y=rho,
zvalue=i_ang,
pen="2p+z",
cmap=True,
)
fig.show()
# fig.savefig(fname="colorwheel_N_cw_pygmt" + cmap_colorwheel + ".png")
# fig.savefig(fname="colorwheel_N_cw_pygmt" + cmap_colorwheel + ".eps")
# fig.savefig(fname="colorwheel_N_cw_pygmt" + cmap_colorwheel + ".pdf")
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.