I wrote a ruby function to display the contents of a Daru dataframe df
:
def plot_dataframe(df)
test = df.plot type: :line, x: :value, y: :depth
test.export_html(filename='test')
return
end
This outputs an html file named test.html
.
How can I flip the y axis (ordinate) so that the depth starts at 0 and increases downwards?
I am looking for an equivalent to Python's invert_yaxis().
At @Serge de Gosson de Varennes' request, here is a MRE:
require 'json'
require 'daru'
require 'nyaplot'
df = Daru::DataFrame.new(
value: [1.2, 1.4, 1.1, 1.0, 1.0],
depth: [0, 1, 2, 3, 4]
)
test = df.plot type: :line, x: :value, y: :depth, y_reverse: true
test.export_html(filename='MRE')
This outputs:
You can do this in one of two ways:
or