
Python for Finance
By :

The best way to understand the usage of the matplotlib
module is through examples. The following example could be the simplest one since it has just three lines of Python code. The objective is to link several points. By default, the matplotlib
module assumes that the x axis starts at zero and moves by one on every element of the array. The following command lines illustrate this situation:
>>>from matplotlib.pyplot import * >>>plot([1,2,3,10]) >>>show()
After we press the Enter key after typing the last command of show()
, the following graph will appear:
At the bottom of the graph, we can find a set of icons, and based on them, we could adjust our image and other functions, such as saving our image. After closing the preceding figure, we could return to Python prompt. On the other hand, if we issue show()
the second time, nothing will happen. To repeat the preceding graph, we have to issue both plot([1,2,3,10])
and show()
.
We...
Change the font size
Change margin width
Change background colour