How do I set the limit for one axis on 3D plot?

Seems like a simple question but I cant get it figured out. I have a data set from experiment which looks vaguely like:
  • two columns of data:
  • first column = 'sets' of data range 200 to 750 with 70 interval steps. Approx 300 consecutive sets.
  • second column = associated reading for value in column one.
  • So basically I would like to plot y-axis with second column, z-axis of set number (i.e from 1 to 300), and x-axis of 400 to 750 instead of 200 to 750.I have tried every xlimit function I can find, and the plot tool has no problem setting the axis, however it plots the outlying data outside the axis!Please help, it is really frustrating as I have spent days trying to fix it already :-/

10 comentarios

José-Luis
José-Luis el 11 de En. de 2013
Could you show an example of your data. I am sorry, but I have a hard time understanding your description of the data.
Sorry its a bit complicated - I tried to type it in columns but the preview didn't show what I wanted at all. I'll type simple example as a code since it is easier to format it as a table that way.
if true
1 | 200 | 2
1 | 210 | 2.7
1 | 220 | 2.4
1 | 230 | 2.5
1 | ... | ...
1 | 750 | 2.8
2 | 200 | 5.1
2 | 210 | 4.9
2 | ... | ...
2 | 750 | 5.2
3 | 200 | 8.3
3 | 210 | 8.1
3 | ... | ...
3 | 750 | 8.2
etc for about 300 repeats until:
300 | 750 | 10.5
end
Is that easier to visualise? (First column doesn't actually exist, that is simply how I picture the data as sets.) So I want to plot column 2 vs column 3 vs column 1, with a range of 400 to 750 for column 2.
José-Luis
José-Luis el 11 de En. de 2013
Editada: José-Luis el 11 de En. de 2013
lH = plot3(col1,col2,col3,'k.');
aH = ancestor(lH,'axes');
set(aH,'XLim',[400 750])
Frances
Frances el 11 de En. de 2013
Thanks for replying so fast! it is having difficulty with the last line. Parse error at 'XLim'[400 750]
José-Luis
José-Luis el 11 de En. de 2013
Editada: José-Luis el 11 de En. de 2013
Missed a colon.
Frances
Frances el 11 de En. de 2013
Sorry I just fixed that error. Same problem as before :-/
Frances
Frances el 11 de En. de 2013
Tried to put the image on here but not sure how to
Frances
Frances el 11 de En. de 2013
Basically it is still plotting outide the axis limits.
Frances
Frances el 11 de En. de 2013

Iniciar sesión para comentar.

Respuestas (1)

José-Luis
José-Luis el 11 de En. de 2013
Editada: José-Luis el 15 de En. de 2013
If col1 is your x data:
idx = col1>=400 && col1 <=750;
lH = plot3(col1(idx),col2(idx),col3(idx),'k.');
aH = ancestor(lH,'axes');
set(aH,'XLim',[400 750])

1 comentario

Frances
Frances el 14 de En. de 2013
Hi, I tried this too and had to change it about a bit for my data but it still wont work. I'm using the surf plot so maybe that is where the issue lies? I think I will re-write the code and start from the beginning!

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 11 de En. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by