How do i turn a line graph into a bar graph?

How can I turn this data into a bar chart?
figure('Color', [1, 1, 1]) % New figure
ax = plotyy(weeks, weight, weekMid, poundsPerWeek); % Save axes
xlabel(ax(1), 'Weeks') % Label x-axis of left axis
ylabel(ax(1), 'Fetal weight (lbs)') % Label y-axis of left axis
ylabel(ax(2), 'Fetal growth rate (lbs/wk)') % Label y-axis of right axis
title('Characterization of fetal weight during pregnancy') % Title one of the axes

Réponses (1)

Srivardhan Gadila
Srivardhan Gadila le 1 Mai 2020

0 votes

plotyy is not recommended. Use yyaxis instead. For more information, see Compatibility Considerations.
Refer to the Examples of yyaxis & replace the plot function with bar function.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by