How to draw graph in Python
08:09Plot in Python
After the installation of python, we can use the app to create the graph that can be used for scientific data representation. To make plot, we need special library called matplotlib.pyplot that will translate the code into 2d graph. Below is step to step tutorial how to launch the jupyter notebook and how to use the matplotlib library.Activate Jupyter Notebook
First we need to activate the environment that have the Jupyter Notebook. Type conda info --envs to view the environment that was installed in the computer. As you can see in the example below, we have two environment
which is root and py3k. So the py3k environment is the environment that have multiple library and other useful stuff. To activate py3k environment simply type activate py3k and type jupyter notebook. Then the jupyter notebook will launch itself in the default browser.
Using matplotlib.pyplot to draw graph
Now we moved to the second part which is how to plot using this library. To use this library, we need to import it first into the Jupyter Notebook. We can import the library into the Jupyter Notebook by typing import matplotlib.pyplot as plt. After we import the library, we can proceed to draw a graph.Below is the example of the graph that can be drawn by using the Jupyter Notebook.
We can edit more and more by manipulating the code to produce varieties of graph that fulfilled our needs. You can view the code to edit the graph more on http://matplotlib.org/api/pyplot_summary.html
This webpage will provide you the full code for editing the graph.
Ok now enjoy plotting your graph :)
0 comments