Figure properties update when exporting

Background
I was trying to solve this question ( link ), by using some undocumented axes properties. This question is not about triple y-axis but an issue I stumbled upon when trying to export the figure. Here is the code to reproduce my figure (see attached image 1):
fig1=figure(1);
%%Create two axes and add second y-axis to one
h1=axes;
h2=copyobj(h1,fig1)
yyaxis(h2,'right')
%%Plot here...
%%Fix some properties
set([h1 h2],'xlim',[0 1],'Color','none')
set(h1,'XColor','none');
%%Move one y-axis (first undocumented feature)
h2.YRuler.FirstCrossoverValue = .9;
drawnow
%%Reduce apparent length of x-axis (second undocumented feature)
h2.XRuler.Axle.VertexData=single([0 .9;0 0;0 0]);
drawnow
The problem
When exporting the figure, the XRuler.Axle.VertexData resets and the full length of the x-axis appear in the output image (compare attached image 1 and 2). The same thing has happened to me once before, when attempting to export a transparent colorbar and FaceAlpha kept resetting to its initial value. I've tried the following:
  • Saving as eps, png, jpg, pdf
  • Using saveas, print, export_fig
The only thing that actually worked was exporting by print and pdf, while export_fig and pdf did not work. Any idea how to properly export the figure without altering its properties?

Respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Productos

Versión

R2018a

Preguntada:

el 24 de Jul. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by