In this post, I discuss one easy plot in Python (using Matplotlib). To plot the function y=exp(x) in the range [0., 1.], one can do the following: >>> from pylab import * >>> a = arange(0,1,.02) >>> b = exp(a) >>> plot(a,b,'r-') # 'r' means with red color and '-' means with dashed line style

### It is ready at this point, but we would like to add error bars:

>>> e = 0.2*abs(randn(len(b))) # prepare errorbar from random numbers >>> errorbar(a, b, e, fmt='o', label='y=exp(x)') # vertical symmetric## Now, we plan to add a legend and axes labels:

>>> legend() # the label command in errorbar contains the legend>>> xlabel('x') >>> xlabel('y')>>> show()

## The following plot will appear on your screen:

You can save image in a few formats like PNG, EPS, etc using a save button in the image box.In a following post, I will show how to create a map and overlay contour of another map on it.

Advertisements

## Leave a Reply