Plotting 2 x-axes against 1 y-axis
Mostrar comentarios más antiguos
Hi,
I am looking to add a second x-axis (measuring time) at the top of the plot seen below. The time corresponds to the number of cycles (approx 275 cycles per day) and should be reaching a maximum value of 20 years (tick mark every 1 or 2 year(s)). I would like to set up the second axis (measuring time) as an array such as: " x2 = 0:1:20; ".I have tried using some of the answers provided to other questions however it is not working for me.
My code for the plot is as follows:
figure(3)
plot(dN, ava)
title('Monte Carlo Simulation 200000','FontSize',14)
xlabel('Number of Cycles')
ylabel('Crack size (mm)')
ylim([0 20])
xlim([0 (total_cycles+50000)])

Thanks!
Respuesta aceptada
Más respuestas (1)
Aquatris
el 26 de Feb. de 2024
0 votos
I think this is what you are looking for, see the example for Display Data with Multiple x-Axes and y-Axes
1 comentario
Molly Monroy
el 26 de Feb. de 2024
Categorías
Más información sobre Data Distribution Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


