How can I plot a circle over an interval (range of values)

조회 수: 3 (최근 30일)
Jorge Zambrano
Jorge Zambrano 2021년 12월 13일
댓글: Jorge Zambrano 2021년 12월 13일
Hi guys, good morning.
I have a litte problem here. I need plot results of the week for a portfolio. I think about an interval for min/max possible values (calculated at begin of the week) and last day of the week, I plot its value as a circle over the interval.
I did it in MS Excel with scatter plot but It is very manual and I would like do it in matlab.
Thanks in advance!
Jorge

채택된 답변

dpb
dpb 2021년 12월 13일
hL=plot([-1327,0],[0 0],'LineWidth',8,'Color',[1 1 1]*0.5);
xlim([-1500 200]); ylim([-20 20])
xticks([]),yticks([])
hold on
hL(2)=plot(-900,0,'Marker','o','MarkerSize',16,'MarkerEdgeColor',[1 1 0.9]*0.5,'MarkerFaceColor',[1 1 1]*0.5);
hR=rectangle('Position',[min(xlim)+100, -5, max(xlim)-min(xlim)-200, 10],'Curvature',[1 1],'LineWidth',3,"EdgeColor",'r');
hTxt=text(-900,2,num2str(-900),'HorizontalAlignment','center','VerticalAlignment',"baseline","FontSize",12);
Results in
just to demonstrate pieces. You'll need to adjust parameters to match your actual figure.

추가 답변 (1개)

Image Analyst
Image Analyst 2021년 12월 13일
Check out the drawellipse() or patch() functions.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by