I need to plot data in Matlab, Excel or Python with a 3D bar graph. I need to account for 4 variables so three would be used in the x, y, and z-axis and the forth would ideally be color coded in the graph. A sample of the csv file is looks like:
"1, 0, 0.1"
"10, 0, 0.9"
"20, 0, 0.4"
"30, 0, 0.6"
"1, 3.6, 0.1"
"10, 1.1, 0.9"
"20, 1, 26.4"
"30, 1, 30.8"
"1, 3, 518.4"
"10, 3, 929.7"
"20, 3, 1099.2"
"30, 3, 1360.1"
"1, 5.1, 19.1"
"10, 5, 861.9"
"20, 5, 799.8"
"30, 5, 1328.7"
"1, 7, 805.2"
"10, 7, 1407.8"
"20, 7, 2645.1"
"30, 7, 1372.4"
Where the first value (x-axis) is Temperature, second value (y-axis) is Concentration, and third value (z-axis) is velocity.
My current code for Matlab is:
%# read file contents: temp,concentration,velocity
fid = fopen('data.csv','rt');
C = textscan('%f', '%f', '%f');
fclose('%f');
%# correctly reshape the data, and extract x/y labels
num = 5;
T = reshape(C{1},num,\[\]); T = T(1,:);
Con = reshape(C{2},num,\[\]); Con = Con(:,1);
V = reshape(C{3},num,\[\]);
%# plot 3D bars
bar3(Z)
xlabel('Temperature'), ylabel('Concentration'), zlabel('Velocity')
set(gca, 'XTickLabel',T, 'YTickLabel',Con)`
I am not sure how to best go about this. I wrote my code based on some other examples and I am sure there are several things wrong with this as I keep getting different errors when I try to address it. Does anyone have any suggestions for me?
I am trying to get my plot to look something like this:
If you know how to manipulate colors for individual values or how to account for a 4th variable in the data, it would be super helpful! The 4th variable just separates all the data above into 1 category. So the complete data set would have 4x the data as above with different values they are grouped into.