-
Notifications
You must be signed in to change notification settings - Fork 23
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
009_paper_GR2020/Figure S10: Wrong colormap set up in colorwheel #13
Comments
Thanks @yvonnefroehlich for reporting this issue. Currently I'm revising all notebooks to update the required PyGMT/GMT versions, add missing content or fix issues, so your suggestions (hopefully) may be considered within the next few weeks 😉. |
An update on option 3 import numpy as np
import pygmt
# -----------------------------------------------------------------------------
# Select for your needs
# -----------------------------------------------------------------------------
# Scientific colourmaps by Fabio Crameri: romaO, bamO, brocO, corkO, vikO
# cmocean colormaps by Kristen M. Thyng: phase
cmap_colorwheel = "romaO"
rho_min = 1.0 # inner radius
rho_max = 2.5 # outer radius
# -----------------------------------------------------------------------------
# Set up rotated rectangle or bar data
# -----------------------------------------------------------------------------
# [[lon, lat, direction, width, height]]
# In polar coordinates lon refers to the angle and lat to the radius (rho)
# Location applies to the center of the bar -> shift by length/2
# Add quantity for fill color as second column (zero-based indexing)
# Direction of bar (j) is from North but still counter-clockwise -> negative sign
data_bars = np.zeros([360, 6])
for i_ang in range(0, 360, 1): # min, max], step
data_bars_temp = np.array([i_ang, rho_min+rho_max/2, i_ang, -i_ang, 0.05, rho_max-rho_min])
data_bars[i_ang,:] = data_bars_temp
# -----------------------------------------------------------------------------
# Create colorwheel plot
# -----------------------------------------------------------------------------
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, 0, rho_max],
# geographic azimuth instead of standard angle -> backazimuth
# clockwise from North instead of counter-clockwise from East
projection="P" + str(rho_max*2) + "c+a",
frame="rltb",
)
# Create colormap for direction (backazimuth)
pygmt.makecpt(cmap=cmap_colorwheel, cyclic=True, series=[0, 360, 1])
# Plot rotated rectangles with color-coding for direction (backzimuth)
fig.plot(data=data_bars, style="j", cmap=True)
fig.show()
# fig.savefig(fname="colorwheel_N_cw_pygmt_bar_" + cmap_colorwheel + ".png")
# fig.savefig(fname="colorwheel_N_cw_pygmt" + cmap_colorwheel + ".eps")
# fig.savefig(fname="colorwheel_N_cw_pygmt" + cmap_colorwheel + ".pdf") |
Again an update (2024/05/20) |
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
(notFalse
)(2) Adjust creation of colorwheel via Matplotlib
matplotlib.pyplot.savefig
. Error messageFigureCanvasPS._print_figure() got an unexpected keyword argument 'figsize'
(3) Use PyGMT instead of Matplotlib to create colorwheel
The text was updated successfully, but these errors were encountered: