Exporting a plot where the line color is a gradient
3 views (last 30 days)
Show older comments
Hi,
I am having some trouble exporting my figures to a vectorised format to use in Adobe Illustrator. I am using plots where the color of the line is a gradient. These work well on the matlab figure, but don't look good in illustrator. Basically illustrator is splitting each segment of the line with a different colour into a separate layer. Does anybody have any suggestions what I can do?
Here is an example bit of code:
n = length(x);
p = plot(x,y,'r', 'LineWidth',5); hold on;
cd = [uint8(ColorFade)' uint8(255*linspace(0,1,n))'].'; %cd is a 4x100 uint8 matrix
drawnow
set(p.Edge, 'ColorBinding','interpolated', 'ColorData',cd)
Thanks
1 Comment
Pierre
on 5 Oct 2018
I hit that wall too. I finally had to resort to bitmap export of specific parts of the figure, as suggested below, although I hate it because it's non-editable. I recombine them with parts of an EPS/SVG export of the full figure to get a hybrid document with editable text.
Overall, graphical export is something Matlab does decently for simple graphics, but complex 3D graphics with gradients and transperencies are beyond their mastery.
Answers (1)
Rajesh Balagam
on 19 Sep 2017
Edited: Rajesh Balagam
on 19 Sep 2017
It seems there is no direct way to export color gradients and transparency in vector format.
If you want to use the image as it is, you can try rasterizing the image in high resolution (600 dpi) as shown below:
print('-dpdf','test.pdf','-r600','-opengl')
However, you cannot edit the exported the image.
0 Comments
See Also
Categories
Find more on Printing and Saving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!