Plot 3 variables on 2D plot

18 ビュー (過去 30 日間)
Joel Schelander
Joel Schelander 2021 年 4 月 23 日
回答済み: Raghava S N 2024 年 2 月 20 日
I have three variables that are stored like this:
The growth in rated power when adding EVs for the combination of 1,2,3...36 households
AAG: 36x1 cell that contains 36 1x1000 cells, every of these cells contains 1x1000 double
(This variable I want on the yaxis)
The number of households that are combined: 1-36
(This I want on the x-axis)
How many inhabitants in total the combination has
AAI: 36x1 cell containing 36 1x1000 double
(This I want represented as a color scale)

回答 (1 件)

Raghava S N
Raghava S N 2024 年 2 月 20 日
Hi Joel,
The “scatter” function in MATLAB has a functionality by which you can pass a third parameter along with the x-axis and y-axis variables. This third parameter is mapped to a colour scale and the plotted x-axis and y-axis values are coloured accordingly.
This example on the documentation page of “scatter” shows the same functionality - https://in.mathworks.com/help/matlab/ref/scatter.html#:~:text=Create%20a%20scatter%20plot%20and%20vary%20the%20circle%20color.
In your use-case, you need to set the following variables like so:
“x”: The number of households that are combined.
“y”: “AAG”
“c”: “AAI”
You can then use the “colorbar” command to display the colour scale graph on your plot - https://www.mathworks.com/help/matlab/ref/colorbar.html.

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by