matplotlib intelligent axis labels for timedelta

Could you provide an example? Is this what you want: import datetime import numpy as np import pylab as plt import matplotlib fig = plt.figure() ax = fig.add_subplot(111) x = np.linspace(0, 300) # 5 minutes y = np.random.random(len(x)) ax.plot(x, y) def timeTicks(x, pos): d = datetime.timedelta(seconds=x) return str(d) formatter = matplotlib.ticker.FuncFormatter(timeTicks) ax.xaxis.set_major_formatter(formatter) plt.show() It uses … Read more

Plotting lines connecting points

I think you’re going to need separate lines for each segment: import numpy as np import matplotlib.pyplot as plt x, y = np.random.random(size=(2,10)) for i in range(0, len(x), 2): plt.plot(x[i:i+2], y[i:i+2], ‘ro-‘) plt.show() (The numpy import is just to set up some random 2×10 sample data)

matplotlib savefig in jpeg format

You can save an image as ‘png’ and use the python imaging library (PIL) to convert this file to ‘jpg’: import Image import matplotlib.pyplot as plt plt.plot(range(10)) plt.savefig(‘testplot.png’) Image.open(‘testplot.png’).save(‘testplot.jpg’,’JPEG’) The original: The JPEG image:

matplotlib values under cursor [duplicate]

You simply need to re-assign ax.format_coord. See this example from the documentation. (code lifted directly from example) “”” Show how to modify the coordinate formatter to report the image “z” value of the nearest pixel given x and y “”” import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm X = 10*np.random.rand(5,3) … Read more