Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11For two unrelated measurements that share an x variable, use Matplotlib’s Axes.twinx() to give each series its own y scale. If the right axis is a unit conversion of the same measurement, use secondary_yaxis() with forward and inverse conversion functions. When both series have the same units and fit one comparable range, plot them on a single y axis instead.
Choose the axis method that matches the data
| Data relationship | Recommended approach | Why |
|---|---|---|
| Same unit and comparable values | One Axes, one y scale | A second axis is unnecessary when both series can be read against the same valid scale. |
| Different measurements with a common x variable | Axes.twinx() |
It creates a second Axes with an independent y scale while sharing the x axis. |
| Same measurement shown in another unit | Axes.secondary_yaxis() |
The second scale expresses a defined conversion of the parent axis rather than an unrelated measurement. |
Matplotlib’s “Plots with different scales” example uses two Axes that share x, created with twinx(). The secondary-axis example demonstrates a converted scale with explicit forward and inverse functions.
As an Amazon Associate I earn from qualifying purchases.
Plot independent measurements with twinx()
Call twinx() on the original Axes. Plot each series on the Axes whose y-axis label and scale describe it. Give the lines and corresponding y-axis labels or tick labels matching colors so the mapping is easy to follow.
Recommended Free Tools
import matplotlib.pyplot as plt
fig, ax1 = plt.subplots()
ax1.plot(x, y1, color="tab:red")
ax1.set_xlabel("time (s)")
ax1.set_ylabel("quantity 1", color="tab:red")
ax1.tick_params(axis="y", labelcolor="tab:red")
ax2 = ax1.twinx()
ax2.plot(x, y2, color="tab:blue")
ax2.set_ylabel("quantity 2", color="tab:blue")
ax2.tick_params(axis="y", labelcolor="tab:blue")
fig.tight_layout()
plt.show()
The resulting right-hand y scale is independent of the left-hand scale. The x-axis autoscale setting is inherited from the original Axes. Use tight_layout() to help keep the right y-axis label from being clipped. These behaviors are documented in Matplotlib’s Axes.twinx API and its two-scales example.
#1 Best Overall
Make the scale mapping explicit
- Label both y axes with the measured quantity and its unit.
- Use line and axis colors consistently, as in the example above.
- Do not imply that two series are directly comparable merely because they share a chart. Independent scales can be adjusted separately, so the visual relationship between lines can be misleading unless the measurements and axis mappings are clear.
Align tick positions when needed
If the left and right y-axis tick positions should line up, Matplotlib’s API notes that a locator such as LinearLocator can be used. Matching tick positions does not make the values or units equivalent; explain what each scale represents.
Show a converted unit with secondary_yaxis()
For a true conversion—such as displaying radians on the main axis and degrees on the right—use secondary_yaxis(). Supply a forward function that converts the parent scale to the displayed scale, and an inverse function that converts back:
Rank #2
secax = ax.secondary_yaxis(
"right",
functions=(forward, inverse),
)
secax.set_ylabel("converted units")
Both functions must accept NumPy arrays. The API also permits an invertible Transform instead of a function pair. The secondary limits are derived from the parent Axes, so setting limits directly on the secondary axis has no effect. See Matplotlib’s secondary-axis example and its documentation.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
When separate subplots are a better choice
If two independent scales make it difficult to judge the data, put the measurements in separate subplots with a shared x axis. This keeps their time or category alignment while avoiding a single plot whose two y scales may suggest a stronger visual relationship than the data supports.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Version note
Matplotlib’s stable documentation cited here identified version 3.11.2 for the two-scales gallery example and the Axes.twinx API. Stable documentation can change over time; consult the documentation for your installed Matplotlib version if relying on version-specific behavior or optional parameters.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




