Filter löschen
Filter löschen

How to represent bar plots efficiently?

1 Ansicht (letzte 30 Tage)
Kalasagarreddi Kottakota
Kalasagarreddi Kottakota am 13 Aug. 2023
Beantwortet: Star Strider am 13 Aug. 2023
I have a set of data, where the 2nd value is very very small compared to the first. Thus, it is very difficult to visually see. So is there any way to tweak the plot for visual experience? or any suggestions apart from bar plot?
% Example data (replace with your data)
values = [0.0159, 0.00005];
% Create a bar plot with log scale y-axis
figure;
bar(values, 'FaceColor', [0.5 0.5 0.5], 'EdgeColor', 'none');
ylabel('Values ');
xticks(1:length(values));
xticklabels({'Value 1', 'Value 2'});

Akzeptierte Antwort

Star Strider
Star Strider am 13 Aug. 2023
One option is to use a logarithmic scale on the y-axis, and then tweak the ylim limits —
% Example data (replace with your data)
values = [0.0159, 0.00005];
% Create a bar plot with log scale y-axis
figure;
bar(values, 'FaceColor', [0.5 0.5 0.5], 'EdgeColor', 'none');
Ax = gca; % <— ADDED
Ax.YScale = 'log'; % <— ADDED
ylim([1E-5 max(ylim)]) % <— ADDED
ylabel('Values ');
xticks(1:length(values));
xticklabels({'Value 1', 'Value 2'});
grid
.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by