plot area with different collar.
Afficher commentaires plus anciens
how plot graph like this.

Réponses (2)
Sulaymon Eshkabilov
le 27 Oct 2023
0 votes
VOLL = 1;
lat = 0.82;
DatI = 0.9;
dat = 1;
Dat = (-lat*DatI+VOLL*dat)/(VOLL-lat);
xmax = Dat*1.15;
ymax = VOLL*1.1;
figure()
ax = gca();
line( ...
'Parent',ax, ...
'XData',[0,DatI,Dat], ...
'YData',[VOLL,VOLL,0], ...
'Color','b', ...
'LineStyle','-', ...
'LineWidth',1.5)
line( ...
'Parent',ax, ...
'XData',[dat,dat,0], ...
'YData',[0,lat,lat], ...
'Color',[0.75,0.75,0.75], ...
'LineStyle','-.')
x = linspace(0,dat);
y = (exp(x/dat*2.6)-1)/(exp(2.6)-1)*0.75*lat;
patch( ...
'Parent',ax, ...
'XData',[x,dat,0,0], ...
'YData',[y,lat,lat,0], ...
'FaceColor',[204,204,255]/255, ...
'EdgeColor','none', ...
'FaceAlpha',0.6)
patch( ...
'Parent',ax, ...
'XData',[0,dat,DatI,0], ...
'YData',[lat,lat,VOLL,VOLL], ...
'FaceColor',[204,255,204]/255, ...
'EdgeColor','none', ...
'FaceAlpha',0.6)
line( ...
'Parent',ax, ...
'XData',[x,dat], ...
'YData',[y,VOLL], ...
'Color',[0,0,0], ...
'LineStyle','--')
x = dat*0.3+Dat*0.7+[0,0.05];
y = VOLL-(x-DatI)/(Dat-DatI);
line( ...
'Parent',ax, ...
'XData',x([1 2 2]), ...
'YData',y([1 1 2]), ...
'Color',[0,0,0], ...
'LineStyle','-')
text( ...
'Parent',ax, ...
'Position',[x(2),mean(y)], ...
'String','\it E', ...
'Interpreter','tex')
patch( ...
'Parent',ax, ...
'XData',xmax*[1,0.9825,0.9825], ...
'YData',ymax*[0,0.01,-0.01], ...
'FaceColor',[0,0,0], ...
'Clipping','off')
text( ...
'Parent',ax, ...
'Position',[0,ymax], ...
'String','Price', ...
'Interpreter','tex', ...
'HorizontalAlignment','right', ...
'VerticalAlignment','bottom')
patch( ...
'Parent',ax, ...
'XData',xmax*[0,0.01,-0.01], ...
'YData',ymax*[1,0.9825,0.9825], ...
'FaceColor',[0,0,0], ...
'Clipping','off')
text( ...
'Parent',ax, ...
'Position',[xmax,0], ...
'String','Demand', ...
'Interpreter','tex', ...
'HorizontalAlignment','center', ...
'VerticalAlignment','top')
ax.TickDir = 'both';
ax.Layer = 'top';
ax.Box = 'off';
ax.XAxis.TickLabelInterpreter = 'tex';
ax.YAxis.TickLabelInterpreter = 'tex';
ax.XTick = [0, DatI, dat, Dat];
ax.XTickLabels = strcat({'\it '},{'', 'D_{at}^I', 'd_{at}', 'D_{at}'});
ax.XLim = [0 xmax];
ax.YTick = [0, lat, VOLL];
ax.YTickLabels = strcat({'\it '},{'', '\lambda_{at}', 'VOLL'});
ax.YLim = [0 ymax];
Catégories
En savoir plus sur Line Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
