subdivide the axis into a grid without using subplot

1 visualización (últimos 30 días)
vick Audi
vick Audi el 23 de Abr. de 2011
Hey Guys, I have 100 patch objects, p1,p2,..p100 [for eg. p1=sphere(1), p2=sphere(2) .. p(100)=sphere(100)]
I want to visualize these 100 objects simultaneously. As a starting point, I use the subplot using which I obtain 100 axes and I can render 1 patch object in each axis, as follows:
for i=1:100, p=subplot(10,10,i); sphere(i); end
This clearly gets very graphically exhausting for matlab. I would like to subdivide a single axis into 100 components and position each object into one position. I have a possible line of thought, set(gca,'position',....) but I'm unclear if there is a better solution than gluing an object to a predefined position. Any Ideas or Files out there that anyone may be aware of, I'd appreciate it.
Thanks

Respuestas (3)

Matt Fig
Matt Fig el 23 de Abr. de 2011
Are you certain that your patch objects wouldn't just stack and obscure each other? In your example (assuming appropriate adjustments were made), the only patch you would see is the last one because all spheres are unit spheres.
Could you give a better example of what you are trying to do?
%
%
%
%
EDIT In response to your comments below...
Every plotted object has x and y coordinates, right? So simply find the largest object (xmax-xmin and ymax-ymin) then make your grid larger than this. Next at each grid node to the xdata and ydata of the objects. For example, say you want to plot 3 circles of diameter 5,2,1 and each has origin as center. Then simply use a grid of 10 (or some number) to add to the xdata of the largest circle so its center is at (10,0). Then at 5 to the xdata of the second largest circle so its center is at (5,0). Then you can keep the smallest circle at the origin or move it over.
Do the same for the y coordinate to arrange your objects in a grid....
  2 comentarios
vick Audi
vick Audi el 23 de Abr. de 2011
Hey Matt, Thanks for your response. Specifically, I'm looking to render a complex patch object (of course not a simple sphere). This patch object (FV) has 2 fields - FV.faces and FV.vertices. Obviously, FV1 through FV100 gets generated in a for loop. I would like to visualize these simultaneously on a single axis, without using subplots (and so I can rotate them around together, etc. in addition to simplified graphics for matlab to handle)
Matt Fig
Matt Fig el 23 de Abr. de 2011
I am not sure how much this will actually help MATLAB. But why not try it and see? Just call patch in the loop and see what happens... You subdivide by simply centering your patch objects on a grid.

Iniciar sesión para comentar.


Jiro Doke
Jiro Doke el 23 de Abr. de 2011
Why don't you simply keep creating the patch object in a loop, without creating multiple axes. As long as the coordinates of the objects don't overlap, then you'll have them all in one axes.

vick Audi
vick Audi el 23 de Abr. de 2011
Hey Matt and Jiro, Thanks for your responses..
Well, I'm able to create the patch objects in the loop as you both are suggesting (so lets say I get P1.. P100, each having 2 fields i) faces and ii) vertices)
@ Jiro, my patch objects can have (actually most of the time have) similar coordinates. So, If I do the following: figure; hold on; P1=patch(P(1)); P2=patch(P(2)); P3=patch(P(3)); P4=patch(P(4)); .... I see my different patch objects getting rendered at similar locations on the same axis, overwriting each other. Issuing the following command: get(gca,'Children') returns indeed a handle structure with P1,P2,P3,P4. So, I indeed have the right patch object handles.
@ Matt, Can you please clarify how do I subdivide by simply centering patch objects on a grid? how do I define a grid without using subplot? Thanks!

Categorías

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