Importing and plotting with
2 次查看(过去 30 天)
显示 更早的评论
I'm trying to import into Matlab the attached data. The data along the Y axis are labelled ('electrostatic, vanderWaals, Polarsolv, etc). The data along the X axis are labelled (DE3-L73, DE3-etc) I'm trying to plot a 2- or 3D stacked bar.
If I import as a table, and then do bath(Y) I get the following error. Error using barh (line 40) Input arguments must be numeric.**
If I import as numeric matrix, I lose the X and Y axes labelling information.
I'd be grateful for any suggestions regarding how to go around this problem.
Regards George
0 个评论
采纳的回答
Star Strider
2016-1-8
I’m not quite sure what you want, but this code using bar3 will get you started:
[d,s,r] = xlsread('George DE3-DE4.csv');
Forces = s(1,2:6);
DE3s = s(2:14,1)';
figure(1)
bar3(d)
grid on
yt = get(gca, 'YTick');
% xt = get(gca, 'XTick');
set(gca, 'YTick',yt, 'YTickLabel',DE3s, 'YTickLabelRotation',30)
set(gca, 'XTick',[1:length(Forces)], 'XTickLabel',Forces, 'XTickLabelRotation',-30)
It imports your data, creates your axis labels, and plots the bar3 graph, producing:
You can modify this code to get the type of bar plot you want.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!