Skip to content Skip to sidebar Skip to footer

Plot Extremely Small Values In Matplotlib

I am trying to plot some extremely small values with matplotlib in jupiter notebook (on a macbook pro). However, regardless if I set the y-axis limits, all I get is a flat line. Wh

Solution 1:

Matplotlib (unlike, say Mathematica) expects you to supply the x- and y- values for all the points of interest in the plot. You could alter you code to evenly evaluate some function (say a gaussian) at even spacing in the unit interval

%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure(figsize=(13,6))
ax = fig.add_subplot(111)
plt.hold(True)


xs = np.linspace(0, 1, 101)
ys = 1e-300 * np.exp(-(xs-0.5)**2/0.01)
ax.plot(xs, ys, marker='.')

Which gives:

plot


Post a Comment for "Plot Extremely Small Values In Matplotlib"