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

Matplotlib plot comes up empty, is it a scaling issue due to the huge difference in my y values?

This is data taken from a mat file, for which I am meant to apply interpolation techniques in various ways. I wanted to see what the graph looks like with no interpolation applied, but I keep getting blank plots as in the end. ca_i and t are both (1,25) numpy arrays. I’m thinking it may be an issue in how big the difference is in the ca_i scale. This class is in MATLAB, but I am using Python to get more accustomed to the syntax and the differences between them.

This is the code I used:

import numpy as np
import matplotlib.pyplot as plt


ca_i = np.array([0.0,0.0018600003438189192,0.0002590223247024505,4.2933247094276643e-05,1.01517329122632e-06,2.2000181987561245e-08,3.1829754066400425e-09,9.251619028714474e-12,1.3077449672199555e-12,3.6241917918406e-15,1.8421082461592794e-13,5.06566621963767e-16,9.840901934293446e-18,3.649674529308416e-21,9.64374923981959e-24,2.5298107231198704e-26,2.3519077811337855e-32,4.429035906892334e-34,1.1414882447414905e-36,4.016168548404073e-40,1.9241495055371506e-44,3.595405959272557e-46,9.170496181343466e-49,1.2525305730959068e-49,5.939334658820937e-54])


t = np.array([0.0,0.8,2.0,3.0,5.0,7.0,8.0,11.0,12.0,15.0,13.0,16.0,18.0,22.0,25.0,28.0,35.0,37.0,40.0,44.0,49.0,51.0,54.0,55.0,60.0])



plt.plot(t,ca_i)
plt.show()

thanks!!

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 :

Try setting different limits on the graph.

plt.ylim(0, 0.000025)

plt.show()

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