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 :: measure time per line python 
Python :: string formatting in python 
Python :: how to find last index of list in python 
Python :: copy directory from one location to another python 
Python :: how to make an ai 
Python :: plot second axis plotly 
Python :: python matplt 
Python :: venv 
Python :: root mean squared error python 
Python :: most common value in a column pandas 
Python :: python logger to different file 
Python :: python how to print input 
Python :: color python 
Python :: remove nans and infs python 
Python :: python sum array 
Python :: python convert float to decimal 
Python :: pandas profile report python 
Python :: click ok on alert box selenium webdriver python 
Python :: django get form data from post 
Python :: reverse range in python 
Python :: sending whatsapp message using python 
Python :: python get unique pairs from two lists 
Python :: python timedelta to seconds 
Python :: only keep rows of a dataframe based on a column value 
Python :: schedule computer shutdown python 
Python :: string count substring occurences pytohn 
Python :: get subscriber count with python 
Python :: print( n ) in python 
Python :: declare empty array of complex type python 
Python :: round decimal to 2 places python 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =