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

조회 수: 2 (최근 30일)
Xiaohan Du
Xiaohan Du 2018년 9월 4일
댓글: dpb 2018년 9월 4일
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 2018년 9월 4일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by