Borrar filtros
Borrar filtros

Shift data on a figure without reploting

81 visualizaciones (últimos 30 días)
Mary el 15 de Jul. de 2020
Comentada: Mehmed Saad el 17 de Jul. de 2020
I lost my data. However, I have the plot of data. I realize that x data should be shifted of one unit. If I had the data, it would have been easy to change the code and do the shift by doing something as: x_new = x_old + ones(size(x_old)). But, unfortunately, it is not the case.
Do you know how the data can be shifted on the figure ?
thanks in advance.

Respuesta aceptada

Mehmed Saad
Mehmed Saad el 15 de Jul. de 2020
Editada: Mehmed Saad el 15 de Jul. de 2020
Suppose that i have a figure
fig = figure,
ax = axes(fig);
Now i dont know what is my data
Suppose that i have just the figure, let us extract data from figure
Line_Obj = findobj(gca,'Type','Line')
X = Line_Obj.XData;
Y = Line_Obj.YData;
Now i add an offset in it
hold on,plot(gca,X,Y+0.5)
Remember that this demonstration is for Line object, if your plot contains any other object like scatter, histrogram etc, you have to change it in findobj


if you dont want to plot it, just use copyobj for that purpose
h = copyobj(Line_Obj,gca);
h.Color = 'g';
h.YData = h.YData-0.4;
  3 comentarios
Walter Roberson
Walter Roberson el 15 de Jul. de 2020
data = cat(1, image_patches,labels);
That code is overwriting all of data each iteration.
It looks to me as if data will not be a vector, but I do not seem to be able to locate any hellopatches() function so I cannot tell what shape it will be. As you are not doing imresize() I also cannot be sure that all of the images are the same size, so I cannot be sure that data will be the same size for each iteration. Under the circumstances you should be considering saving into a cell array.
Note: please do not post the same query multiple times. I found at least 9 copies of your query :(
Mehmed Saad
Mehmed Saad el 17 de Jul. de 2020
walter sir, please delete your comment as the questioner deleted his question xD

Iniciar sesión para comentar.

Más respuestas (0)


Más información sobre Graphics Object Properties 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!

Translated by