How to estimate best position(or location) for a small plot in a main plot?

1 回表示 (過去 30 日間)
Zeshan Ali
Zeshan Ali 2021 年 9 月 8 日
回答済み: Image Analyst 2021 年 9 月 8 日
I have small plot (inset) in a main plot as shown in Figure below. In this example, I have added the small plot using observation.
Question:
Is there any way to know the size of empty or available unused area in main plot programmatically?

回答 (1 件)

Image Analyst
Image Analyst 2021 年 9 月 8 日
What I'd do is to convert the graph to an image, like with exportgraphics. Then convert it to a binary image. Then use bwdist() in the Image Processing Toolbox to find the place with the max value which is where the circle with the biggest radius could fit into the white space of the graph. Something like (untested)
rgbImage = imread(filename);
grayImage = rgb2gray(rgbImage);
binaryImage = grayImage < 255;
edtImage = bwdist(binaryImage);
maxValue = max(edtImage(:));
[row, column] = find(edtImage == maxValue)
Adapt it as needed. Like once you have the row and column you'll have to figure out how that calibrates to the x and y of your axes.

カテゴリ

Help Center および File ExchangeCamera Calibration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by