This blogs serves as my canvas to share from my learning experience through the years.
Matplotlib Operations
Get link
Facebook
X
Pinterest
Email
Other Apps
Matplotlib is a library for creating plots ,graphs and charts. It draws its influence from Matlab, and it works efficiently with NumPy and Pandas for good graphic visualization which enhances your data analysis projects. We start with importing matplotlib.pyplot library and using %matplotlib inline
You can view the documentation in more detail here: * [Documentation](https://matplotlib.org/tutorials/introductory/pyplot.html)
import matplotlib.pyplot as plt #The below line helps in presenting plots in Jupyiter notebook. %matplotlib inline
Lets createsome data for our first graph, A plot from two numpy arrays `x` `y` using `plot()`.
import numpy as np
x=np.arange(0,10) y=x**3+10
result = plt.plot(x, y) plt.xlabel("X") plt.ylabel("Y") plt.title("Example") plt.suptitle("Basic Plot from Matplotlib") plt.show()
In the above code, 1. We called the plot() function to plot the graph between the data we have created. 2. We named the x and the y labels using xlabel() and ylabel() 3. We named the graph with a title using title() 4. We showed the graph here using the show() function
From the graph above we saw that the boundary of x and y axis is selected automatically based on the data we have created. We can vary this using the plt.axis() functionwhere the we pass a list which has the x axis and y axis parameters
x=np.arange(0,10) y=x+10 result = plt.plot(x, y) plt.axis([2,10,10,19]) plt.xlabel("X") plt.ylabel("Y") plt.title("Example") plt.suptitle("Basic Plot from Matplotlib") plt.show()
While we are calling the plot function we can specify the color of the graph line, the types of points we can use and more using a formatted string passed to the plot function.
plt.plot( x, y, "r*" ) plt.xlabel("X") plt.ylabel("Y") plt.title("Formatted Data Points") plt.show()
**Colors**
|character| color | |--- | --- | | b | blue | | g | green | | r | red | | c | cyan | | m | magenta | | y | yellow | | k | black | | w | white |
**Line Styles**
|character| description | |--- | --- | |'-'| solid line| |'--'| dashed line | |'-.'| dash-dot | |':'| dotted line | |'.'| point marker | |','| pixel marker | |'o'| circle marker |
plt.plot( x, y, "r^" ) plt.xlabel("X") plt.ylabel("Y") plt.title("Formatted Data Points") plt.show()
We can plot the x and y of multiple graphs in the same plot using the optionof sequencing them as below : plot(x1,y1,format1,x2,y2,format2,x3,y3,format3)
We will be discussing the basics of using asyncio in python. Lets us first discuss this using an example. from time import perf_counter,sleep def function1 (): print ( "Call made to the second function....\n" ) sleep( 2 ) print ( "Second function1 execution completed...\n" ) s=perf_counter() print ( "The main function is starting...\n" ) function1() print ( "Hello World \n" ) print ( "The main function ending ...\n" ) print ( f"The total time taken is : {perf_counter()-s} " ) Now we will see the output of the program for us to see what has happened. The main function is starting... Call made to the second function .... Second function1 execution completed... Hello World The main function ending ... The total time taken is : 2.0017361999925924 Lets see the code execution one by one : The first function which is the main function is called. Then the 2nd function called function1() has been called, it st...
Information Security : Finding Documents Metadata A vast quantity of information is embedded in document files by the tools that corporations employ to create their papers. Naturally, the contents of the file comprise a large portion of this information. However, the file also contains a significant amount of metadata, which is information about information or information that describes other information. A large portion of the formatting and presentation of the other data in the file are related to this information. In addition to this formatting information, many applications for creating and modifying files contain other metadata items that penetration testers may find helpful during our reconnaissance stage, for example we can look at below information For password-guessing and exploitation assaults, penetration testers frequently require usernames which may be embedded in the metadata. Understanding the entire trajectory of the original file at the time of creatio...
Comments
Post a Comment