Exporting a plot where the line color is a gradient

4 Ansichten (letzte 30 Tage)
SeanC
SeanC am 15 Sep. 2017
Kommentiert: Pierre am 5 Okt. 2018
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 Kommentar
Pierre
Pierre am 5 Okt. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Rajesh Balagam
Rajesh Balagam am 19 Sep. 2017
Bearbeitet: Rajesh Balagam am 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.

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by