Skip to content

009_paper_GR2020/Figure S10: Wrong colormap set up in colorwheel #13

@yvonnefroehlich

Description

@yvonnefroehlich

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.
compare_SuppMat_JN_GR2020_FigS10

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

  • limitation: Not the same color-coding as used for the maps in the Supp Material
  • cell 11, line 4: 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

  • limitation: Problem to save the new colorwheel as (eps) file via 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

  • limitation: Running time of the code
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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions