Answers for "add points to matplotlib plot"

4

python add a point to a plot

# Basic syntax
plt.plot(x, y, 'marker')

# Example usage:
import matplotlib.pyplot as plt
import numpy as np

# Data to plot
x = np.linspace(0, 10, 100)

# Plot figure
fig = plt.figure()
plt.plot(x, np.sin(x), '-')

# Add point
plt.plot(5, 0, 'ro')

# Note, see all marker styles here:
#    https://matplotlib.org/stable/api/markers_api.html
Posted by: Guest on April-26-2021
1

how to plotting points on matplotlib

import matplotlib.pyplot as plt 
import numpy as np

data = np.random.rand(1024,2)
plt.scatter(data[:,0],data[:,1])
plt.show()
// Don't be
// fooled by this simplicity— plt.scatter() is a rich command.
Posted by: Guest on June-13-2020

Code answers related to "add points to matplotlib plot"

Python Answers by Framework

Browse Popular Code Answers by Language