Hello! I would like to recreate a matplotlib plot displaying geological lithology data in plotly.
In matplotlib it can be done with this code (I guess the key point is fill_betweenx() method).
How can it be done in plotly?
lithology_numbers = {30000: {'lith':'Sandstone', 'lith_num':1, 'hatch': '..', 'color':'#ffff00'},
65030: {'lith':'Sandstone/Shale', 'lith_num':2, 'hatch':'-.', 'color':'#ffe119'},
65000: {'lith':'Shale', 'lith_num':3, 'hatch':'--', 'color':'#bebebe'},
80000: {'lith':'Marl', 'lith_num':4, 'hatch':'', 'color':'#7cfc00'},
74000: {'lith':'Dolomite', 'lith_num':5, 'hatch':'-/', 'color':'#8080ff'},
70000: {'lith':'Limestone', 'lith_num':6, 'hatch':'+', 'color':'#80ffff'},
70032: {'lith':'Chalk', 'lith_num':7, 'hatch':'..', 'color':'#80ffff'},
88000: {'lith':'Halite', 'lith_num':8, 'hatch':'x', 'color':'#7ddfbe'},
86000: {'lith':'Anhydrite', 'lith_num':9, 'hatch':'', 'color':'#ff80ff'},
99000: {'lith':'Tuff', 'lith_num':10, 'hatch':'||', 'color':'#ff8c00'},
90000: {'lith':'Coal', 'lith_num':11, 'hatch':'', 'color':'black'},
93000: {'lith':'Basement', 'lith_num':12, 'hatch':'-|', 'color':'#ef138a'}}
fig, ax = plt.subplots(figsize=(15,10))
# Lithology track
ax.plot(well["LITHOLOGY"], well['DEPTH_MD'], color = "black", linewidth = 0.5)
ax.set_xlabel("Lithology")
ax.set_xlim(0, 1)
ax.xaxis.label.set_color("black")
ax.tick_params(axis='x', colors="black")
ax.spines["top"].set_edgecolor("black")
for key in lithology_numbers.keys():
color = lithology_numbers[key]['color']
hatch = lithology_numbers[key]['hatch']
ax.fill_betweenx(well['DEPTH_MD'], 0, well['LITHOLOGY'], where=(well['LITHOLOGY']==key),
facecolor=color, hatch=hatch)