フィルターのクリア

I would like to modidy the colors in this 2d plot, different from standard ones (e.g., 'b', 'k')

2 ビュー (過去 30 日間)
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

採用された回答

Antoni Garcia-Herreros
Antoni Garcia-Herreros 2023 年 4 月 3 日
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)
Unable to resolve the name 'T1.X'.
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 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 4 月 3 日
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'})

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2023 年 4 月 3 日
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);

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by