Last active
February 15, 2023 16:42
-
-
Save CodeMaster7000/9384860f99a9e58a1a0653e9eccb6ab8 to your computer and use it in GitHub Desktop.
A Python graph coded with matplotlib to visualise a sine wave.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
x = np.linspace(-np.pi,np.pi,100) | |
y = np.sin(x) | |
fig = plt.figure() | |
ax = fig.add_subplot(1, 1, 1) | |
ax.spines['left'].set_position('center') | |
ax.spines['bottom'].set_position('center') | |
ax.spines['right'].set_color('none') | |
ax.spines['top'].set_color('none') | |
ax.xaxis.set_ticks_position('bottom') | |
ax.yaxis.set_ticks_position('left') | |
plt.plot(x,y, 'b-') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment