Datetick at feather plot
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Robson Passos
el 1 de Abr. de 2018
Comentada: Star Strider
el 16 de Dic. de 2019
I've been used the following commands to plot a feather plot:
(OBS: u and v are the components of the wind, and the vectors date are: year, month and day)
t = datenum(year,month,day);
feather(u,v)
hold on
plot(t, zeros(size(u)))
datetick('x','dd/mm/yyyy','keepticks', 'keeplimits')
But that isn't working very well.
I'm getting the following figure:

I've been tried to use the quiver plot, with the following commands:
t = datenum(year,month,day);
quiver(t, zeros(size(u)), u, v);
datetick('x','dd/mm/yyyy','keepticks', 'keeplimits')
with that I get the following image (It seems better, but the intensity of the winds are wrong, so I guess that the quiver function don't is correct for the case):

Repare that using the feather function the intensity of the wind is plotted correctly, but the graph and the values of the date in the X axis is wrong, meanwhile, whith the quiver the date is correct and the plot is correct, but the intensity is wrong.
Can someone help me to find the error? Is there another way to plot that information?
2 comentarios
Star Strider
el 1 de Abr. de 2018
The year values seem wrong. The maximum year in the first plot is 2190, and in the second, 2020.
Are you plotting historical values, or predicting future values?
Respuesta aceptada
Star Strider
el 1 de Abr. de 2018
Apparently, feather and datetick don’t work and play well together.
This workaround is the best I can do:
t = datenum([1998 01 01]):datenum([2018 01 01]);
u = rand(size(t));
v = rand(size(t));
figure
feather(u,v)
set(gca, 'XLim',[0 numel(u)]) % Set X-Axis Limits
xt = get(gca,'XTick') % Get X-Tick Values
xt(1) = 1;
txt = t(xt); % Define ‘t’ Using ‘xt’
set(gca, 'XTick',xt, 'XTickLabel',datestr(txt,'dd/mm/yyyy'), 'XTickLabelRotation',30)
I rotated the tick labels so they wouldn’t crash into each other.
Experiment to get the result you want.
4 comentarios
Más respuestas (1)
Benjamin Gillard
el 16 de Dic. de 2019
This code is great!!
it did help me a lot and save me of a potential brain damage.
Work on 2019b.
Thank you very much,
1 comentario
Ver también
Categorías
Más información sobre Vector Fields en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
