Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

second y axis matplotlib

import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 10, 0.1)
y1 = 0.05 * x**2
y2 = -1 *y1

fig, ax1 = plt.subplots()

ax2 = ax1.twinx()
ax1.plot(x, y1, 'g-')
ax2.plot(x, y2, 'b-')

ax1.set_xlabel('X data')
ax1.set_ylabel('Y1 data', color='g')
ax2.set_ylabel('Y2 data', color='b')

plt.show()
Comment

plot second y axis matplotlib

#We create a secondary y-axis for the definded column
df.plot(secondary_y='name_of_column')
plt.show()
Comment

matplotlib plot in second axis

fig,ax = plt.subplots()
ax.plot(y1)
ax2=ax.twinx()
ax2.plot(y2)
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: delimiter pandas 
Python :: python program to find second largest number in a list 
Python :: empty list in python 
Python :: python threading return value 
Python :: tqdm description 
Python :: PY | websocket - client 
Python :: python __repr__ 
Python :: sklearn train test split 
Python :: find average with sum and len in python 
Python :: NumPy unique Example Get unique values from a 1D Numpy array 
Python :: most repeated character in a string python 
Python :: python random number generator no duplicates 
Python :: pyton recognize any datetime format 
Python :: python tkinter messagebox 
Python :: one line if statement python without else 
Python :: how to use assert in python 
Python :: make_response is not defined django 
Python :: keras model save 
Python :: deep learning with python 
Python :: plt delete space before axis 
Python :: max between two numbers python 
Python :: create column with values mapped from another column python 
Python :: how to get the most common number in python 
Python :: re python3 
Python :: python slicing 
Python :: python variable scope 
Python :: current working directory in python 
Python :: Javascript rendering html 
Python :: pandas value in series 
Python :: python min key 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =