XTickLabelRotation for plotyy in MATLAB 2014bis not working.
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I need to plot data with two y-axis with common x-axis [date and time]. And later i would like to rotate the 'XTickLabel' by 60 degrees. Code:
x= [now-.5 now-.3 now];;
y1=[20 35 15];
y2 = [9 10 11];
plotyy(x,y1,x,y2);
datetick('x',31,'keepticks')
h=gca;
h.XTickLabelRotation = 60;
xlabel('Date&Time');
The 'xlabel' and some part of the XTickLabel are hidden. It is working perfectly for 'plot' and if I run the same code for 'plotyy' it is not working. How to solve this issue?
1 comentario
Sean de Wolski
el 23 de Feb. de 2015
Another model example of a well written question!
Clear reproduction steps, a description of the problem, etc.
Respuestas (1)
Sean de Wolski
el 23 de Feb. de 2015
Editada: Sean de Wolski
el 23 de Feb. de 2015
Plotyy creates two axes on top of each other, one of who's xtick labels is off. Since gca is non-deterministic, you're apparently setting the wrong one. Thus set both of them!
x= [now-.5 now-.3 now];
y1=[20 35 15];
y2 = [9 10 11];
ax = plotyy(x,y1,x,y2);
datetick('x',31,'keepticks')
[ax.XTickLabelRotation] = deal(60);
xlabel('Date&Time');
3 comentarios
Sean de Wolski
el 23 de Feb. de 2015
Editada: Sean de Wolski
el 23 de Feb. de 2015
The tick labels are just too long. Pick a different format, shrink the axes, or choose a different rotation.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/182099/image.png)
Ver también
Categorías
Más información sobre Two y-axis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!