Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

matplotlib plot data

import matplotlib.pyplot as plt
import numpy as np

x=np.array([0,1,2,3,4,5,6,7], dtype=np.float)
y=np.array([0,1,2,3,3,2,1,0], dtype=np.float)
# if you don't have subfigures
plt.plot(x, y)
plt.xlabel("x")
plt.ylabel("y")
plt.xlim((1,6))
plt.title("Title")
plt.show()


# if you have subfigures
fig, axs = plt.subplots(2, 1, figsize=(10,7))

axs[0].plot(x, y)
axs[0].set_xlabel("x")
axs[0].set_ylabel("y")
axs[0].set_xlim((1,6))
axs[0].set_title("Plot of y as function of x")

axs[1].plot(x, 2*y)
axs[1].set_xlabel("x")
axs[1].set_ylabel("2*y")
axs[1].set_xlim((1,6))
axs[1].set_title("Plot of 2y as function of x")
fig.tight_layout()
plt.show()
Comment

plot data python

import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.show()
Comment

python plot get data

line = gca().get_lines()[n]
xd = line.get_xdata()
yd = line.get_ydata()
Comment

PREVIOUS NEXT
Code Example
Python :: _set in django 
Python :: fakultät python 
Python :: discord.py clear status 
Python :: Spotify API Authentication in Python 
Python :: User serializer in django rest framework 
Python :: webdriverwait python 
Python :: python string to list new line 
Python :: Python DateTime Timedelta Class Syntax 
Python :: python pretty print list of tuples 
Python :: django orm group by month and year 
Python :: save to xlsx in python 
Python :: connect mongodb with python 
Python :: django signals post_save not working 
Python :: is vs == python 
Python :: closedxml hide column 
Python :: distance matrix gogle map python 
Python :: pandas invert a boolean Series 
Python :: plot neural network keras 
Python :: python loop shorthand 
Python :: How to get the date from week number in Python? 
Python :: python how to draw a circle 
Python :: private instance attribute python 
Python :: List Delete a Element 
Python :: torch tensor to pandas dataframe 
Python :: How can write event for textbox in tkinter 
Python :: python re.search() 
Python :: jupyter notebook GET 500 
Python :: python stack data structure 
Python :: how get 1st column in all rows of a 2d matrix in python 
Python :: convert pandas group to dict 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =