Unrecognized method, property, or field 'value' for class 'matlab.graphics.chart.primitive.Bar'.
104 views (last 30 days)
Show older comments
I am getting the following error for the code below: Unrecognized method, property, or field 'orig_short_position' for class 'matlab.graphics.chart.primitive.Bar'. I don't know how to fix this, does anyone have any suggestion? You can find origBar_input attached
% Displaying the 20 position dates with the highest frequency of appearance
origBar_input = orig_short_positionFrequency(1:20, [1 3]);
bar(origBar_input.orig_short_position, origBar_input.percentage);
origBar_input.Parent.XTick = 1:size(origBar_input, 1);
origBar_input.Parent.XTickLabel = origBar_input.orig_short_position;
origBar_input.Parent.XTickLabelRotation = 35; % rotate labels
origBar_input.Parent.XAxis.FontSize = 7; % reduce font size fo better visualization
ylabel('%')
title('Distribution of orig short position Frequency')
0 Comments
Accepted Answer
Cris LaPierre
on 26 Oct 2021
It looks like the code shared here is not the same code that created that error. Can you check that you copied the correct code? Also, please copy the entire error message (all the red text).
What version of MATLAB are you using?
I can recreate your error message if I create a graphics object to the bar plot using the same variable name as your table. If that is what you did, giver your bar object a different name.
load origBar_input.mat
%vvvvvvvvvvvv -----> Use a unique variable name
origBar_input = bar(origBar_input.orig_short_position, origBar_input.percentage);
origBar_input.Parent.XTick = 1:size(origBar_input, 1);
%vvvvvvvvvvvv <----------------> vvvvvvvvvvvvv Using same name
origBar_input.Parent.XTickLabel = origBar_input.orig_short_position;
2 Comments
Cris LaPierre
on 26 Oct 2021
load origBar_input.mat
b = bar(origBar_input.orig_short_position, origBar_input.percentage);
b.Parent.XTick = 1:size(origBar_input, 1);
b.Parent.XTickLabel = origBar_input.orig_short_position;
b.Parent.XTickLabelRotation = 35; % rotate labels
b.Parent.XAxis.FontSize = 7; % reduce font size fo better visualization
ylabel('%')
title('Distribution of orig short position Frequency')
More Answers (0)
See Also
Categories
Find more on Discrete Data 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!