MATLAB Answers

Logscale x axis of stacked bar chart, how to make the chart shows clearer results?

조회 수: 3(최근 30일)
Xiaohan Du
Xiaohan Du 4 Sep 2018
Commented: dpb 4 Sep 2018
Hi all,
I have some data, and I'd like to plot them into horizontal bar charts with log scale on x-axis. I wrote some code like this:
data1a = 63752;
data1b = 14122;
data1c = 48066 - 239;
data1d = 452 + 239;
data1e = data1a - data1b - data1c - data1d;
data2b = 10609 - 10193;
data2d = 10193;
data3 = data2d / 1620 * 1089 * 20;
dataAll = [data2d data2b 0 0; data3 data2b 0 0; data1d data1b data1e data1c ];
h = barh(dataAll, 'stacked');
set(gca,'xscale','log')
Among these variables, value and sequence of them cannot be changed. The plot is like this:
As you can see, data2b in bar 1 and 2 are tiny (invisible in bar 2), as well as data1e in bar 3, but data1e is not too bad. I know their values are small and it's plotted in log scale, but can I plot it better, i.e. make data2b more visible?
Many thanks!

  댓글 수: 1

dpb
dpb 4 Sep 2018
When relative magnitudes are <1:1000, it's just not going to show up much any way you try to display it with the full range of the data on one axes. You could set
ylim([100 2E5])
to at least use what blank space there is on the RH side of the present figure, but that isn't enough to make a significant difference in the overall appearance.
Only thing I think of that you could try would be to "blow up" a subsection of the x-axis as an inset (difficult to do w/ Matlab, unfortunately as an illusion of magnifying glass) and set the xlim([1.3E5 1.4E5]) for that small section.

로그인 to comment.

답변 수 (0)

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by