Hi. I have a plot without an axis and I want to add a background around my plot. I want to do something like this plot in a picture
t=0:0.1:10;
y=sin(t);
plot(t,y);
xlim([-1,11]);
ylim([-1.1,1.1]);
axis off
set(gcf,'InvertHardCopy','off','Color','white');
saveas(gcf,'plot_test.jpg','jpeg')
plot_test.jpg

 Akzeptierte Antwort

madhan ravi
madhan ravi am 15 Dez. 2018

1 Stimme

t=0:0.1:10;
hFig = figure;
y=sin(t);
plot(t,y);
color = get(hFig,'Color');
set(gca,'XColor',color,'YColor',color,'TickDir','out')

1 Kommentar

linus shen
linus shen am 7 Feb. 2020
That's a great answer. However, I was still able to see the axis even though it's very faint. Alternatively, you can set color = 'none', and it might work better.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by