Skip to content

Commit

Permalink
Correction to automatic text placement
Browse files Browse the repository at this point in the history
Fixed text placement. Will now be automatically placed based of figure dimensions / latitude extent, and longitude.
  • Loading branch information
thurinj committed Mar 5, 2024
1 parent 2a413de commit 0b68624
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mtuq/graphics/attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,14 @@ def _pygmt_backend(filename, values, active_stations, origin,
text_line_val = 1
header_lines = PyGMTUtilities.get_header(label, origin, filename, process)

# Add the header text to the plot
# Text spacing is based on longitude range and latitude buffer size.
lon_mean = np.max(longitudes) - (np.max(longitudes) - np.min(longitudes)) / 2
text_spacing = lat_buffer / 1.5
for header_line in header_lines:
fig.text(x=-148, y=(max(latitudes) + lat_buffer)+(text_line_val)*0.25, text=header_line, font="14p,Helvetica-Bold,black", justify="MC", no_clip=True)
fig.text(x=lon_mean,
y=max(latitudes) + lat_buffer + text_line_val*text_spacing,
text=header_line, font="14p,Helvetica-Bold,black", justify="MC", no_clip=True)
text_line_val += 1

# Saving the figure
Expand Down

0 comments on commit 0b68624

Please sign in to comment.