Importing and plotting with

4 ビュー (過去 30 日間)
George
George 2016 年 1 月 8 日
コメント済み: Star Strider 2016 年 1 月 8 日
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
Star Strider
Star Strider 2016 年 1 月 8 日
My pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by