Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

plt.yticks(

# import the libraries
import numpy as np
from matplotlib import pyplot as plt

# create the data values to plot the graph
x = np.array([1, 2, 3, 4, 5, 6])
y = np.array(2 * x + 2)
z = np.array(2 * y + 1)
yticks = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]
Y = 5

# plot the graph using matplotlib

plt.title('Line graph for the equation y=2x+2')
plt.xlabel('X_axis')
plt.ylabel('Y_axis')
plt.plot(x, y, linewidth=2, color='red', marker='.', markersize=7)
plt.yticks(np.arange(min(yticks), max(yticks) + 1, Y))
plt.grid()
plt.show()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
4+9 =