필터 지우기
필터 지우기

How can I plot a scatter graph with dates along the x-axis

조회 수: 7 (최근 30일)
Charlotte Evans
Charlotte Evans 2015년 4월 13일
답변: Onur Tavaslioglu 2019년 6월 17일
I have data of prices at certain dates stored in a 2 collum vector. I want to plot a scatter plot of this data, and have tried using datetick and datenum to try and rename the x-axis but I can't seem to get it to work. I have tried converting the dates (which are in ddmmyyyy form) into a string of dates but again it gives the incorrect graph labels.
Does anyone know how to do this, I have around 1000 data points

답변 (1개)

Onur Tavaslioglu
Onur Tavaslioglu 2019년 6월 17일
n = 1:10:100;
r = unidrnd(n);
d(10) = datetime;
gscatter(d,r);
I have created a random input vector with and a datetime vector.
gscatter plots them with dates on the x-axis. You can arrange the format of the datetime vector as you want.

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by