MATLAB Answers

Plotting a bar graph with a large x-axis

20 views (last 30 days)
Brenden Sluyter
Brenden Sluyter on 27 Mar 2020 at 6:59
Commented: Mohammad Sami on 27 Mar 2020 at 8:11
I'm trying to plot a bar graph with a very large x-axis. When I do this, it makes my data at the end close to zero look very skinny. Below is what I want it to look like (graph taken from TestLab) and what Im getting in matlab. Is there a way to shrink the x-axis to only the values I need?
Thank you in advance.

  4 Comments

Show 1 older comment
Brenden Sluyter
Brenden Sluyter on 27 Mar 2020 at 7:09
How would it work if I were to skip parts of the axis?
Rik
Rik on 27 Mar 2020 at 7:20
You would need to make that yourself because it is probably not something you should be doing. You can either use multiple axes objects or adjust the x values and set the xlabels (so instead of plotting 1 2 10 11 you plot 1 2 3 4 and set the labels to 1 2 10 11).
Mohammad Sami
Mohammad Sami on 27 Mar 2020 at 8:11
If your bar charts are at discrete values, one way is to convert your x-axis into a categorical variable. Then plot against the categorical variable.

Sign in to comment.

Answers (0)

Sign in to answer this question.

Tags

Products


Release

R2019a