Cannot saveas SVG file with error "using alternatePrintPath"

조회 수: 8 (최근 30일)
ZHUOZHI ZHANG
ZHUOZHI ZHANG 2023년 5월 31일
답변: AKennedy 2024년 8월 20일
I would like to plot a graph with four similar type of subplots (grouped barh, with categorical x-axis, renderer was set as 'painters'), but was not able to export .svg vector image.
Error message as below:
Error using alternatePrintPath
Unrecognized method, property, or field 'Exponent' for class 'matlab.graphics.axis.decorator.CategoricalRuler'.
Error in alternatePrintPath
Error in print (line 83)
pj = alternatePrintPath(pj);
Error in saveas (line 181)
print( h, name, ['-d' dev{i}] )
I have encountered this problem (cannot export) several times, but the error messages were not the same. Can anyone conclude what is the major problem? Thanks!

답변 (1개)

AKennedy
AKennedy 2024년 8월 20일
To resolve the error when exporting a .svg from MATLAB with grouped bar charts and a categorical x-axis:
  • Switch Renderer: Use opengl instead of painters:
set(gcf, 'Renderer', 'opengl');
exportgraphics(gcf, 'output.svg', 'ContentType', 'vector');
  • Try to simplify the plot by reducing the complexity or number of elements.
  • If all else fails, try using a newer version of MATLAB.

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by