toddheitmann/PetroPy

log_viewer doesn't work as expected in Jupyter notebook

thoth291 opened this issue · 4 comments

Here is the versions of pandas, numpy and matplotlib I'm using.

numpy                     1.16.3           py37he5ce36f_0    conda-forge
matplotlib                3.1.0                    py37_0    conda-forge
matplotlib-base           3.1.0            py37h5f35d83_0    conda-forge
pandas                    0.24.2           py37hf484d3e_0    conda-forge
petropy                   0.1.6                    pypi_0    pypi

And here is what I'm getting:
image

Any help would be greatly appreciated.

The LogViewer is working somewhat correctly. When initialized without providing the top of the viewer, it will show the top of the log. For the example log, the data is mainly null at the top. Specify a depth when intializing with top = 6900 to have the beginning of the viewer start at 6900 FT. The screenshot below is the code reproduced in cell 1. Cell 2 provides the top of the viewer to see data at the beginning of Wolcamp A.

viewer_with_top = ptr.LogViewer(log, top = 6900)

Graphs

Please try this and see how the graph responds. There also appears to be something going on with the depth axis as it is not inverted as it should be.

@toddheitmann - thank you - this is really helping! Don't know how I missed that parameter. I also don't know why my depths are off - I tried to get latest commit in the master branch - still the same issues with depth. What versions of matplotlib do you use? How can I replicate your experience?
P.S. I use Linux to run your code - don't know if that matters.

I have mainly used Windows and macOS to run this, so thank you for the update and using it on linux. Line 781 is where I invert the y-axis for the plot. Maybe try this code:

import petropy as ptr
log = ptr.log_data('WFMP')
viewer = ptr.LogViewer(log, top = 6900)
ax_zero = viewer.axes[0]
ax_zero.invert_yaxis()
viewer.show()

The LogViewer class keeps the log, matplotlib figure, and matplotlib axes as attributes to customize the appearance after the main graph is created. See this example where a logo is added to the upper left and log information is added to the upper right.

Yep - it did the trick. I wonder why it's an issue in Linux. Here is how I changed the code in my private version of it - to make it work. Don't know if I need it to be done for all axis and if this way of doing it has any drawbacks - but it works:

#plt.gca().invert_yaxis()
for ax in self.axes:
    ax.invert_yaxis()