0

I need to scale the left or right y-axis in order to have just one data point in the chart for each set of data.

This means that, I want the following solution: on the left y-axis 56 corresponds to 10.5 on the right y-axis, on the left y-axis 75,corresponds to 20.8 on the right y-axis, on the left y-axis 90,corresponds to 31.5 on the right y-axis, on the left y-axis 120,corresponds to 41.8 on the right y-axis,

Unfortunately, now I get multiple points. Here you can find the MWE

import numpy as np
import matplotlib.pyplot as plt

m =  np.array([0.5, 1, 1.5, 2 ])
N = np.array([56, 75, 90, 120])
Q = np.array([10.5, 20.8, 31.5, 41.8 ])

fig, ax1 = plt.subplots()

ax1.plot(m,N, 'ko')
ax1.set_ylabel('N channels', color='k')
ax1.set_xlabel('Mass flow rate [kg/s]')

ax2 = ax1.twinx()
ax2.plot(m,Q, 'ro')
ax2.set_ylabel('Heat exchanged [kW]')
ax1.grid()
plt.show()

I just want to overlap the red dots with the black dots

chrisis
  • 119
  • 1
  • 1
  • 9

0 Answers0