agilescientific / striplog

Lithology and stratigraphic logs for wells or outcrop.

Home Page:https://code.agilescientific.com/striplog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set text label x-position in striplog axes

EvanBianco opened this issue · comments

Labels and descriptions should be plotted using the striplog axes object ax instead of plt.text(). In the case of multi axes plots, this may cause issues.

Also, we should allow the user to set the xposition of the text labels. Perhaps with an option to specify whether this is in data coordinates (which it is currently), or as a fraction of the x-axis (axis coordinates).

Currently an otherwise unspecified striplog will get a width of 1.5, so a label placement at 1.6 would correspond to a axis coordinate of 1.066. Using Axes coordinates could mean transforming the y-value from data coordinates (depth) into axes coordinates (0-1). So I'm not sure if that's unnecessarily complicated?

Relevant lines of code starts here.

plt.text(1.6,

To avoid cluttering strip.plot(), perhaps it's best done as another method, say strip.plot_text(ax, xpos, name, size, wrap_width) ?
i.e.
[ax.text(xpos, iv.middle, iv.primary['formation'], ha='left', va='center', size=10) for iv in w.data['strip']]

Thanks for raising this issue @DougiB!