Scale right y-axis to the values on the left y-axis

5 ビュー (過去 30 日間)
Noah Stam
Noah Stam 2021 年 2 月 27 日
コメント済み: Noah Stam 2021 年 2 月 27 日
Hello everybody,
I'm trying to plot 3 different arrays in a 2D figure:
figure(100)
yyaxis left
plot(IR_range/1000,angle)
yyaxis right
plot(IR_range/1000,distance/1000)
Both plots look remotely the same, but not quiet:
As you can see both y axes are almost proportional to one another, but not 100%. I'd like to make the orange curve fit the blue curve (into one curve) and let the right y-axis (orange) scale change accordingly. Anybody that can help me

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 2 月 27 日
I don't see how changing the scale of your Y Axis is going to help you. No amount of uniform stretching or compressing is going to make these two curves overlap. For the first half, your orange curve is above the blue, but for the second half, it is below. This means you will have to amply a non-uniform transformation to get the curves to overlap.
In the process, you are then modifying your data. So in the end, you might end up with curves that overlap, but no longer represent the event they were recorded from.
  5 件のコメント
Cris LaPierre
Cris LaPierre 2021 年 2 月 27 日
While you can place your ticks anywhere you want, axes must have a uniform scale. This means to achieve what you want, you will have to modify the actual x and/or y data values. That makes this a data manipulation question, and not something related to axis scaling.
Noah Stam
Noah Stam 2021 年 2 月 27 日
Okay, fair enough. Thanks for the help! I guess ill have to find another way to represent this data in a nice way then.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by