Datatips does not work with rectangle

7 次查看(过去 30 天)
Hi there,
I am trying to highlight a specific area of my plots. I use a rectangle to do this. After drawing the rectangle, the datatips do not work in the area of the rectangle.
My Code:
plot(filtered_CN0.Var1,filtered_CN0.Var9,'DisplayName',string(unique_satID(j)));
rectangle('Position',[epvt_csv_table.tow(areaStarts(i)), 0, epvt_csv_table.tow(areaEnds(i)) - epvt_csv_table.tow(areaStarts(i)), 50],'FaceColor', [0.6350 0.0780 0.1840 0.2]')
Also, plotting the rectangle first and then plotting the data does not work. Is there a better way to solve this problem?
Thanks for your help.

采纳的回答

Dyuman Joshi
Dyuman Joshi 2023-8-28
编辑:Dyuman Joshi 2023-8-28
figure()
%Draw the rectangle first
rectangle('Position',[3 3 3 3],'FaceColor',[1 0 0]);
%hold on - to add the plot to the same figure on top of the rectangle
hold on
%Then plot the curve
plot(1:10); % Plots the line

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by