How could I move my xlabel in the center to the right?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
As you can see "Grados" is on the lower left, I would like to move it to the center. I mean in the same line but towards the center, how could it? thank you very much
function arduinomatlab
v1=zeros(1,1000);
v2=zeros(1,1000);
delete(instrfind({'Port'},{'COM3'}));
s = serial('COM3','BaudRate',9600,'Terminator','CR/LF');
warning('off','MATLAB:serial:fscanf:unsuccessfulRead');
fopen(s);
muestras=1;
figure('Name','Captura');
xlh = xlabel ( 'Grados' );
xlh.Position (2) = xlh.Position (2) - 1.1;
ylim([-1 1]);
xlim([0 369]);
ax = gca;
ax.XAxisLocation = 'origin';
ylabel('Y')
title('Onda Sinouidal')
grid on
hold on
while 1
xticks([30,60,90,120,150,180,210,240,270,300,330,360])
try
valor=fscanf(s, '%f,%f')';
v2(muestras)=(valor(2));
v1(muestras)=(valor(1));
plot(v2(1:muestras),v1(1:muestras),'-k')
drawnow
muestras=muestras+1;
catch
break
end
end
fclose(s);
delete(s);
clear s;
end
0 commentaires
Réponses (1)
Image Analyst
le 3 Déc 2019
Delete the line where you manually position it:
xlh.Position (2) = xlh.Position (2) - 1.1;
then I think it should remain at its automatically-determined location (i.e. centered).
2 commentaires
Image Analyst
le 3 Déc 2019
It seems to be caused by this line:
ax.XAxisLocation = 'origin';
If you comment that out it will be centered. You can use line() to draw an x axis but the tick labels won't be there:
line(xlim, [0, 0], 'Color', 'k', 'LineWidth', 2);
Voir également
Catégories
En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!