Logscale x axis of stacked bar chart, how to make the chart shows clearer results?
2 次查看(过去 30 天)
显示 更早的评论
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195131/image.png)
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
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 Center 和 File Exchange 中查找有关 Graphics Object Properties 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!