Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

matplotlib object oriented

fig, ax1 = plt.subplots()

ax1.set_ylabel("distance (m)")
ax1.set_xlabel("time")
ax1.plot(time, distance, "blue")

ax2 = ax1.twinx() # create another y-axis sharing a common x-axis


ax2.set_ylabel("velocity (m/s)")
ax2.set_xlabel("time")
ax2.plot(time, velocity, "green")

fig.set_size_inches(7,5)
fig.set_dpi(100)

plt.show()
Comment

Matplotlib-Object oriented interface

ax = plt.axes()
ax.plot(x, np.sin(x))
ax.set(xlim=(0, 10), ylim=(-2, 2),
       xlabel='x', ylabel='sin(x)',
       title='A Simple Plot');
Comment

Matplotlib-Object oriented interface

plt.plot(x, np.sin(x), '-g', label='sin(x)')
plt.plot(x, np.cos(x), ':b', label='cos(x)')
plt.axis('equal')

plt.legend();
Comment

PREVIOUS NEXT
Code Example
Python :: how to split string into list conditionally+python 
Python :: Print the multiple data types in a single program in list data structures 
Python :: foreign key on delete arguments 
Python :: create new column pandas and order sequence 
Python :: how to read then overwrite a file with python with truncate 
Python :: highly correlated features python 
Python :: Rebinding a list stored in a Flask Session 
Python :: legend outside subplot not displayed 
Python :: Three-dimensional Contour Plots 
Python :: Capitalize first word of a phrase in python 
Python :: discord.py reply to message 
Python :: modeltranslation 
Python :: pls work 
Python :: pyglet key hold 
Python :: gizeh python 
Python :: can I activate a function inside the definition of the same function 
Python :: “no such column” after adding a field to the model 
Python :: python autotrader web 
Python :: Pandas automatic allignment of columns 
Python :: python ravel function output 
Python :: backslashing in an interactive session in python 
Python :: smallest string with a given numeric value 
Python :: Django is MVT Not MVC 
Python :: Count the number of Missing Values in the DataFrame 
Python :: how to get each word in a string in python 
Python :: python math.factorial algorithm 
Python :: os scan dir python 2 
Python :: preprocessing image (pixel to vector conversion) 
Python :: install robobrowser python 3 
Python :: how to install pygame for python 3.8.5 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =