필터 지우기
필터 지우기

I want to change a plot to a bar graph

조회 수: 1 (최근 30일)
Jean-Simon Larochelle
Jean-Simon Larochelle 2020년 1월 31일
댓글: Jean-Simon Larochelle 2020년 1월 31일
Hello,
I have two array (3006x1 double) that represent my X and my Y. When I'm using the plot function it's work well and my data are shown, but if I'm changing the plot function for a bar function, it's only produce a empty figure.
To you have a idea why? Are the argument in the two functions not the same?
Thank you.

답변 (1개)

Shekhar Vats
Shekhar Vats 2020년 1월 31일
편집: Shekhar Vats 2020년 1월 31일
Share your data here so that it's easier to check
var1 = rand(3006,1); var2 = rand(3006,1); % test variables
figure;
ax(1) = subplot(211); plot(var1, '.-'); hold on;
plot(var2, '.-'); grid on; legend ('var1', 'var2');
title ('Line plot');
ax(2) = subplot(212); bar(var1); hold on; bar(var2); grid on;
legend ('var1', 'var2'); title ('Bar plot')
It's working as expected for me for some test variables

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by