ads legend to plot

조회 수: 9 (최근 30일)
Aaron Petersen
Aaron Petersen 2022년 4월 14일
답변: Lokesh 2023년 9월 26일
Hallo, meinMatlab möchte diese Legende nicht darstsellen und ich finde den Fehler nicht.
Legendtitel = {'Messung Flussdichte','SIM Flussdichte','FEM Flussdichte','Analyse Flussdichte','Messung Abreiskraft','SIM Abreiskraft','FEM Abreiskraft','Analyse Abreiskraft'}
legend(Legendtitel)
Danke im Voraus!
Grüße, Aaron
  댓글 수: 1
Aaron Petersen
Aaron Petersen 2022년 4월 14일
yyaxis left
ylabel('Flussdichte /mT')
plot(Magnete.AnzMagnete,Magnete.Flussdichte_mT,'-');
yyaxis right
ylabel('Abreiskraft /N')
plot(Magnete.AnzMagnete,Magnete.Abreiskraft_N,'-');
Und warum wird mir hier keine yAchsenbeschriftung ausgegeben?

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

답변 (1개)

Lokesh
Lokesh 2023년 9월 26일
Hi Aaron,
I understand from your query that your MATLAB code is not displaying the legend and ylabel correctly.
However, there are a few issues with the code you provided. The possible reasons for the issue and their fixes are mentioned below:
  • The “legend” and “ylabel” functions are used to display legend and plot for the previously plotted data series. So, ensure that you have plotted the data before calling the legend and ylabel function.
I have provided an example code snippet below that adds ylabel and legend to the plot:
yyaxis left
plot (Magnete.AnzMagnete,Magnete.Flussdichte_mT,'-');
ylabel('Flussdichte /mT')
yyaxis right
plot(Magnete.AnzMagnete,Magnete.Abreiskraft_N,'-');
ylabel('Abreiskraft /N')
Legendtitel = {'Messung Flussdichte', 'Messung Abreiskraft'}
legend(Legendtitel)
You can refer to the below mentioned documentation to know more about the usage of “ylabel” and “legend”:
Hope this helps in resolving the issue.
Best Regards,
Lokesh

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!