Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

plotting a model based on data

I want to plot a velocity versus depth model using the given data.

import matplotlib.pyplot as plt
import numpy as np

depth=np.array((0.0,5.0,30.0,40.0,50.0))
velocity=np.array((5.5,6.5,6.8,9.0,10.0))
plt.plot(velocity,depth)
plt.show()

But this script doesnot give the plot as i expected
I need something like example_plot

I hope experts may help me overcoming this problem. Thanks in advance.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Result

You have to use matplotlib.pyplot.step

depth=np.array((0.0,5.0,30.0,40.0,50.0))*-1
velocity=np.array((5.5,6.5,6.8,9.0,10.0))
plt.step(velocity,depth)
plt.show()

EDIT:

depth=np.array((0.0,5.0,30.0,40.0,50.0))
velocity=np.array((5.5,6.5,6.8,9.0,10.0))

fig, ax = plt.subplots()
ax.step(velocity,depth)
ax.invert_yaxis()
fig.show()

New picture without minus signs

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading