Importing and plotting with
2 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Star Strider
on 8 Jan 2016
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.
More Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!