How to plot multiple y axes using function that is compatible with R2018b?

Hi,
I am trying to plot 4 different data sets of different scales. I know plotyy can plot 2 y-axes but I need to plot 4 axes. I have also tried plotyn.m, addaxis6.m and few more but they are not compatible with R2018b. They are giving errors. Would anyone please receommend something that's compatible with R2018b?

 채택된 답변

Mark Sherstan
Mark Sherstan 2019년 3월 1일

0 개 추천

Check out the file exchange. For example this works: https://www.mathworks.com/matlabcentral/fileexchange/67349-plot-with-multiple-y-axes. You could also consider normalizing your data.

댓글 수: 4

I will definitely look into the file. I'm curious to know how to normalise the data if the maximum of the data is, for example, 35*10^4, 5000, 5, and 0.5 respectively.
You could loop through the 4 different data sets but this should put you on the right path:
A = randi(100,[10,10]); % Some random matrix of postive integers
maxVal = max(A(:)); % Get the largest value
B = A./ maxVal % Divide each element by max value (normalize between 0 and 1)
The file you suggested worked well. A few questions:
(1) How can I rotate the labels of y-axes?
(2) Is it possible to reduce the space between the y-axes bars to make the plot smaller?
(3) Is it possible to change the thickness of the border of the box and of the additional y-axes?
I also tried the normalization. It was not appropriate for my problem because most of the data was either close to 1 or close to 0. So there was a huge difference. I am not sure if there is a way out.
In the directory where you saved the file exchange function run:
help plotNy
You will get a list of arguments for customizing the plots. If the options you want arent there I would reccomend checking out a different user made function.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

VR
2019년 3월 1일

댓글:

2019년 3월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by