Unable to copy plot3 image as vector

13 views (last 30 days)
Ahmed Rehan
Ahmed Rehan on 5 Nov 2023
Answered: Shreshth on 23 Nov 2023
Hi there,
I'd like to use an image for editing in Illustrator, and it works perfectly when the image is in 2D format. I utilize the metafile option for the clipboard, and it functions seamlessly for 2D images. However, when attempting to use the same approach with a 3D plot generated using the plot3() command, it doesn't seem to work as expected. Could you please provide some guidance or assistance to resolve this issue? Thank you!
  1 Comment
Cedric Kotitschke
Cedric Kotitschke on 16 Nov 2023
Moved: Dyuman Joshi on 16 Nov 2023
What exactly does not work?
This works for me
phi = 0:0.01:5*pi;
x = cos(phi);
y = sin(phi);
z = linspace(1,10,numel(phi));
plot3(x,y,z)
exportgraphics(gcf, 'myplot.pdf', 'ContentType', 'vector')

Sign in to comment.

Answers (1)

Shreshth
Shreshth on 23 Nov 2023
Hello Ahmed,
When using MATLAB to copy 3D plots to other software like Illustrator, there are a few considerations to keep in mind. The issue you are encountering is due to the difference in handling 3D data compared to 2D data.
To copy a 3D plot from MATLAB to Illustrator, you can follow these steps:
1.Exporting 3D Plot as an Image File:
Instead of using the clipboard, you can export the 3D plot as an image file directly from MATLAB. This can be done using the saveas function. For example:
figure;
% Create your 3D plot using plot3() command
plot3(x, y, z, 'b', 'LineWidth', 2);
% Save the plot as an image file
saveas(gcf, '3D_plot.png');
Replace x, y, and z with your actual data and adjust the plot settings as needed.
2.Importing the Image into Illustrator:
After saving the image file, you can import it into Adobe Illustrator using the "File" > "Place" option. This will allow you to use the 3D plot in your Illustrator project.
3.Using MATLAB's Simulink 3D Animation:
If you want to work with interactive 3D content, you can consider using MATLAB's Simulink 3D Animation capabilities. Simulink 3D Animation provides tools to create and animate 3D scenes, which can be exported to various formats for use in other applications.
By following these steps, you should be able to effectively use 3D plots from MATLAB in Adobe Illustrator.
You can also refer to MATLAB’s documentation for exporting graphics at the below link.
Thank you,
Shubham Shreshth.

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!