Why am I getting "Error using bar (line 127) Input arguments must be numeric, datetime, duration or categorical"?
Ältere Kommentare anzeigen
I am trying to create a stacked bar chart of revenue data by fiscal quarter using data from a table. The data I want to plot is in columns 2-6, while the quarter names (string) are in column 1.
Here is a cleaned version of the code:
clear
clc
close all
load table_data.mat
bar(quarterly_revenue(:,2:end),'stacked')
legend(quarterly_revenue.Properties.VariableNames(2:end))
title('Product Revenue Over Time')
x = 1:height(quarterly_revenue);
xticks(x)
xticklabels(quarterly_revenue(:,1))
ytickformat('usd')
When I run the code, I get an error:
Error using bar (line 127)
Input arguments must be numeric, datetime, duration or categorical.
Error in example_error_using_bar (line 5)
bar(quarterly_revenue(:,2:end),'stacked')
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Data Distribution Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!