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

PREVIOUS NEXT
Code Example
Python :: pygame python3.8 
Python :: how to add an active class to current element in navbar in django 
Python :: extract name organization using nltk 
Python :: debconf: falling back to frontend: Readline Configuring tzdata 
Python :: reading a csv file in python 
Python :: ubuntu cant find python installation 
Python :: pandas column string first n characters 
Python :: p-norm of a vector python 
Python :: python read xml 
Python :: python get the elements between quotes in string 
Python :: django desc order 
Python :: lisy in python 
Python :: python requests header 
Python :: make python look good 
Python :: resample and replace with mean in python 
Python :: Goal Perser 
Python :: python program for simple interest 
Python :: python check if number is complex 
Python :: matplotlib transparency 
Python :: pandas create new column 
Python :: how to find the length of a list in scratch 
Python :: how to remove trackback on python when ctrl c 
Python :: how to get words from a string in python 
Python :: python test if number in string 
Python :: convert tibble to dataframe 
Python :: how to create a cube in ursina 
Python :: venv upgrade python 
Python :: python record screen 
Python :: python today plus 1 day 
Python :: ctx.save_for_backward 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =