I would like to modidy the colors in this 2d plot, different from standard ones (e.g., 'b', 'k')
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Francesco Marchione
il 3 Apr 2023
Commentato: Dyuman Joshi
il 3 Apr 2023
T1 = readtable('variazione.xlsx', 'VariableNamingRule','preserve')
figure
plot(T1.('X'), T1.('S'), '-r',T1.('X_1'), T1.('S_1'), '-b',T1.('X_2'), T1.('S_2'), '-k', 'Linewidth', 1.3)
grid
xlim([-10 10])
ylim([0 25])
set(gca,'xticklabel',num2str(get(gca,'xtick')','%.0f'))
L=legend('E=x MPa','E=y MPa','E=z MPa', 'Location','northwest');
set(L,'Interpreter','latex')
set(gca,'TickLabelInterpreter','latex')
xlabel('$x$ [mm]', 'Interpreter','latex');
ylabel('$\tau$ [Pa]', 'Interpreter','latex');
I would like to choose #D95319 and #A2142F and #77AC30 for the three differend plots
0 Commenti
Risposta accettata
Antoni Garcia-Herreros
il 3 Apr 2023
Hello,
You could separate the plot and specify the colors individually.
D95319=[217,83,25]/255;
A2142=[162, 20, 47]/255;
AC30=[119, 172, 48]/255;
plot(T1.('X'), T1.('S'), 'Color',D95319, 'Linewidth', 1.3)
hold on
plot(T1.('X_1'), T1.('S_1'), 'Color',A2142, 'Linewidth', 1.3)
plot(T1.('X_2'), T1.('S_2'), 'Color',AC30, 'Linewidth', 1.3)
1 Commento
Dyuman Joshi
il 3 Apr 2023
You can directly use the color code OP mentioned -
x=0:0.01:10;
plot(x, sin(x), 'Color', '#D95319')
hold on
plot(x, cos(x), 'Color', '#A2142F')
plot(x, sin(x).*cos(x), 'Color', "#77AC30")
ylim([-1.75 1.75])
legend({'sin', 'cos', 'sin*cos'})
Più risposte (1)
Image Analyst
il 3 Apr 2023
You can define your own colors. For example if you wanted an RGB of 40, 50, 90, you can do
plot(T1.('X'), T1.('S'), '-', 'Color', [40, 50, 90]/255);
or
darkBrown = [120, 50, 20] / 255;
plot(x, y, '-', 'Color', darkBrown);
0 Commenti
Vedere anche
Categorie
Scopri di più su Scatter Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!