is there a way to put an image as a background on a 3d plot?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello
I have a plot with multiple spheres and I would like to add something(maybe stars) on the background of the plot.
I tried generating random numbers for x y and z and use scatter3 to plot it but it looked really weird.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/149267/image.png)
If its possible I would like to add an image of stars on the background. If not is there a way to make this plot look good with all the stars?
x = 10*rand(100,1); y = 10*rand(100,1); z = 10*rand(100,1);
scatter3(x,y,z,'w*')
For the sphere
v = [1;1;1]; r = 1;
[x y z] = sphere;
x = r*x+v(1); y = r*y+v(2);
z = r*z+v(3);
surf(x, y, z, 'Edgecolor', 'none')
Thank you.
댓글 수: 0
답변 (1개)
Image Analyst
2015년 4월 21일
Use imread() to read in an image of a star field or whatever background image you want. Use imshow() to display it. Then call "hold on". Then call your code to place spheres upon it.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!