Posts

Showing posts from July, 2022

Plotting- Simple plots,setting limits,subplot, semilog, loglog plots

Image
data—plotting—is one of the most important tools for evaluating and understanding scientific data and theoretical predictions. Plotting is not a part of core Python, however,but is provided through one of several possible library modules. The most highly developed and widely used plotting package for Python is matplotlib ( http://matplotlib.sourceforge.net/ ). It is a powerful and flexible program that has become the defacto standard for 2D plotting with Python. Because matplotlib is an external library—in fact it’s a collection of libraries—it must be imported into any routine that uses it. matplotlib makes extensive use of NumPy so the two should be imported together. Therefore, for any program that is to produce 2D plots, you should include the lines import numpy as np import matplotlib.pyplot as plt plot function.   It is used to plot x-y data sets and is written like this plot(x, y) where x and y are arrays (or lists) that have the same size. If the x array is omitted, that is,