Datatips does not work with rectangle

16 Ansichten (letzte 30 Tage)
Dominik Coenen
Dominik Coenen am 28 Aug. 2023
Bearbeitet: Dyuman Joshi am 28 Aug. 2023
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.

Akzeptierte Antwort

Dyuman Joshi
Dyuman Joshi am 28 Aug. 2023
Bearbeitet: Dyuman Joshi am 28 Aug. 2023
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

Weitere Antworten (0)

Kategorien

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

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by