The color of the defined axis changes when I print the figure to PDF
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sven Ole Deist
el 21 de Feb. de 2023
Comentada: Sven Ole Deist
el 21 de Feb. de 2023
Hi everyone,
I need some help. The following shows a simple code plotting a curve into a defined figure. I want to change the axis color (in this case to white). Actually this is working perfectly when I am running the bold part seperatly. But when I am initializing a figure and print it in the end, my png file shows a plot with black axis again.
I hope some of you have a solution for my little problem.
Ty already
Sven
%Figure initialize
clear all; clc;
close all;
fig=figure (1);
width_single = 9;
figheight=10;
fig.Units = 'centimeters';
fig.PaperOrientation='Landscape';
fig.Position = [-50 2 width_single*3 figheight*3];
fig.PaperPosition = [0 0 width_single*3 figheight*3];
fig.PaperUnits = 'centimeters';
fig.PaperSize = [fig.PaperPosition(3) fig.PaperPosition(4)];
%Random Plot
X = 1 : 20;
Y = rand(1, 20);
plot(X, Y);
set(gca,'YDir','normal','XDir','normal', 'FontSize',18, 'XColor', 'w','YColor', 'w'); % Define axis color to white
%ENTER FOLDER PATH
printfolder=['E:\...\'];
if ~exist(printfolder)
mkdir (printfolder)
end
print_name=['Test'];
print(fig,'-dpng',[printfolder,print_name]);
Respuesta aceptada
Anton Kogios
el 21 de Feb. de 2023
Instead of using the print function, you can use exportgraphics:
exportgraphics(fig,[printfolder,print_name,'.png']);
exportgraphics(fig,[printfolder,print_name,'.pdf']);
Más respuestas (0)
Ver también
Categorías
Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!