Borrar filtros
Borrar filtros

How can I change the colour of the axes?

8 visualizaciones (últimos 30 días)
Andrew
Andrew el 7 de Mzo. de 2024
Comentada: Voss el 8 de Mzo. de 2024
TL;DR - Can't change axes colour, but can manually change in axes properties (not ideal).
No matter what I try, the colour of the axes on the figure below cannot be changed. I do not want the default gray colour, as I am trying to export it in tikz format. I have used this to try change the axes:
ax = gca;
ax.XColor = 'k';
ax.YColor = 'k';
Here is the current code:
hfig = figure; % save the figure handle in a variable
num = [1];
den = [1 20 20];
sys = tf(num, den);
ts = 0.01;
sys_d = c2d(sys, ts, 'zoh');
step(10, sys, 'b-', sys_d, 'r--');
title('System Step Response - $T_{c}=10$')
legend()
grid("minor")
% fname = 'lab-1-prac-1-step-resp';
%
% picturewidth = 20; % set this parameter and keep it forever
% hw_ratio = 0.65; % feel free to play with this ratio
% set(findall(hfig,'-property','FontSize'),'FontSize',17) % adjust fontsize to your document
%
% set(findall(hfig,'-property','Box'),'Box','off') % optional
% set(findall(hfig,'-property','Interpreter'),'Interpreter','latex')
% set(findall(hfig,'-property','TickLabelInterpreter'),'TickLabelInterpreter','latex')
% set(hfig,'Units','centimeters','Position',[3 3 picturewidth hw_ratio*picturewidth])
% pos = get(hfig,'Position');
% set(hfig,'PaperPositionMode','Auto','PaperUnits','centimeters','PaperSize',[pos(3), pos(4)])
%
% print(hfig,fname,'-dpdf','-vector','-fillpage')
% %print(hfig,fname,'-dpng','-painters')
% matlab2tikz( 'lab-1-prac-1-step-resp.tikz', 'height', '\fheight', 'width', '\fwidth' );
Long story short, I am a newbie here and used Octave GNU for plots, however it does not produce LaTeX plots that nicely, in short it either crashes or produces blank pdf's.

Respuesta aceptada

Voss
Voss el 7 de Mzo. de 2024
hfig = figure; % save the figure handle in a variable
num = [1];
den = [1 20 20];
sys = tf(num, den);
ts = 0.01;
sys_d = c2d(sys, ts, 'zoh');
step(10, sys, 'b-', sys_d, 'r--');
title('System Step Response - $T_{c}=10$')
legend()
grid("minor")
ax = findall(hfig,'Type','axes');
set(ax,'XColor','k','YColor','k')
  2 comentarios
Andrew
Andrew el 8 de Mzo. de 2024
This works, thank you!
Voss
Voss el 8 de Mzo. de 2024
You're welcome!

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 7 de Mzo. de 2024
ax.GridColor = 'k';
ax.GridAlpha = 1;
  1 comentario
Voss
Voss el 7 de Mzo. de 2024
hfig = figure; % save the figure handle in a variable
num = [1];
den = [1 20 20];
sys = tf(num, den);
ts = 0.01;
sys_d = c2d(sys, ts, 'zoh');
step(10, sys, 'b-', sys_d, 'r--');
title('System Step Response - $T_{c}=10$')
legend()
grid("minor")
ax = gca();
ax.GridColor = 'k';
ax.GridAlpha = 1;

Iniciar sesión para comentar.

Categorías

Más información sobre Stability Analysis en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by