Adjust the axis of bar3 plot

18 vues (au cours des 30 derniers jours)
CSCh
CSCh le 5 Avr 2023
Commenté : Dyuman Joshi le 30 Sep 2023
Hi,
if I plot bar3(myMatrix) I got the result in the attached picture.
MyMatrix size is 70x15.
1.) How can make the y-axis (1:15) more broader, by keeping the other axis as it is. I think "daspect" is not appropriate.
2) Is ist possible to change y-axis to e.g. 30:45?
Thank you.

Réponse acceptée

Adam Danz
Adam Danz le 5 Avr 2023
Use this syntax to specify y-coordinates: bar3(y,z)
z = rand(4,20);
y = [30 35 40 50];
bar3(y,z)
ylabel('y axis')
  2 commentaires
CSCh
CSCh le 6 Avr 2023
Thanks that works.
Dyuman Joshi
Dyuman Joshi le 7 Avr 2023
If this answer solved your problem, please consider accepting it.

Connectez-vous pour commenter.

Plus de réponses (2)

Samyuktha
Samyuktha le 5 Avr 2023
Hi CSCh,
I understand that you want to change the width and y-axis of the plot obtained from 'bar3' command.
You can change the width of the bars by changing the 'width' input argument. By default, width property is set to 0.8 and the bars have a slight separation.
You can change the labels of the axis by using the 'xticklabel', 'yticklabel' and 'zticklabel' properties of the bar3 plot.
Please refer to the following documentation link for more information:
Hope this helps!!
  1 commentaire
CSCh
CSCh le 5 Avr 2023
Thank you for you help,
if ich change the wdth, this does not broaden the axis. See the image (right width=5, left 0.8). i just want to pull it apart a little bit.)

Connectez-vous pour commenter.


Alon Slapak
Alon Slapak le 30 Sep 2023
ax = gca;
ax.PlotBoxAspectRatio = [1 0.5 1];
  1 commentaire
Dyuman Joshi
Dyuman Joshi le 30 Sep 2023
This does not do what OP wants to do.

Connectez-vous pour commenter.

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by