Scatter plot matrix data while keeping it considered as one data series?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
PetterS
el 28 de Abr. de 2015
Comentada: Star Strider
el 28 de Abr. de 2015
I have two variables, variable A contains information about the orientation of a surface for each minute of a day, variable B contains information about its horizontal tilt. In a perfect world that would mean that they are vectors of size 1440x1. However, at times when the tilt is 0° my program is unable to define a single optimal orientation since all horizontal orientations are equal, so it returns all orientations, making my variables 1440x180 matrices. Where sometimes variable B contains 180 repetitions of tilt = 0° and variable A counts all orientations 1,2,3..180.
I want to scatter plot these so that I have orientation on the X-axis and tilt on the Y-axis. But if I just type:
scatter(A,B);
I get “error using scatter, X and Y must be vectors of the same length.”. Is that because the scatter command doesn’t work with matrices or could it be that I have nans inside the matrices or something else?
If I instead plot it like this:
for i=1:size(A,1)
scatter(A(i,:),B(i,:)); hold on
end
then it doesn’t complain and It plots it like I want but this takes a lot of time and if I turn the legend on I now have 1440 data names since each plot is considered a new set of data. And since it’s considered 1440 individual plots I can’t for example apply a gradient color across the data to represent things that I want.
Does anyone know how to scatter plot a situation like this without using the loop and keeping it one timeseries?
thanks
0 comentarios
Respuesta aceptada
Star Strider
el 28 de Abr. de 2015
I’m not certain this is an acceptable option for you, but instead of 0° for ‘tilt’, I would substitute it with a very small number (perhaps 1E-8).
2 comentarios
Star Strider
el 28 de Abr. de 2015
I misunderstood.
Since scatter only wants vectors, and all your other data are in a vector, I see two options: don’t plot 0° data, or plot them as [0,0]. (My preference would be to not plot the data at 0°, since the orientation there is essentially undefined.)
Más respuestas (0)
Ver también
Categorías
Más información sobre Discrete Data Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!