how to plot a graph using matplotlib
from matplotlib import pyplot as plt
plt.plot([0, 1, 2, 3, 4, 5], [0, 1, 4, 9, 16, 25])
plt.show()
how to plot a graph using matplotlib
from matplotlib import pyplot as plt
plt.plot([0, 1, 2, 3, 4, 5], [0, 1, 4, 9, 16, 25])
plt.show()
matplotlib graph
matplotlib Graph
-------------------------------
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
height = [10, 20, 30, 40, 50]
tick_label = ['one', 'two', 'three', 'four', 'five']
plt.bar(x, height, tick_label = tick_label,
width = 0.5, color = ['red', 'green'])
plt.xlabel('x axis')
plt.ylabel('y axis')
plt.title('matplotlib Graph')
plt.show()
plot in python
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax1 = fig.add_axes((0.1,0.4,0.5,0.5))
ax1.set_title('Title of Plot')
ax1.set_xlabel('X')
ax1.set_ylabel('Y')
ax1.plot(X,Y,c='black',linestyle='--',linewidth=0.5)
ax1.scatter(X,Y,c='red',s=0.5)
ax1.legend(['Line','Scatter'])
ax1.xaxis.set_ticks([0.0,0.1,0.2,0.3])
ax1.yaxis.set_ticks([0.0,0.1,0.2,0.3])
ax1.grid(which='major')
ax1.tick_params(direction='in')
txt = 'Write something on the graph page\
\n over one or more lines.'
fig.text(0.5,0.05,txt,ha='center')
fig.savefig('Figure.pdf')
import matplotlib.pyplot as plt
from matplotlib import pyplot as plt
import matplotlib.pyplot as plt1
print(dir(plt) == dir(plt1))
True
python graph
The Python Graph Gallery
Link : https://python-graph-gallery.com/all-charts/
#This page displays all the charts currently present in the python
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us