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

采纳的回答

Star Strider
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.
  2 个评论
George
George 2016-1-8
Grateful for the answer. That's what I wanted.
George

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by