0

This is a followon to Semi-transparent markers in Matlab Figures , where one answer shows how to use patch to generate semitransparent circles at each data point. What I want to do is use the axes' limits to adjust the circles so that they plot as circles when the x and y ranges are significantly different, causing true circles to plot as ellipses. For the record, I don't have MATLAB 2014/15 so can't use the "hidden" handles discussed at the linked question.

So, here's the problem: I want to query the current axes for their limits via xlim and ylim and use the results to adjust the patch circle shapes. But if there is no figure window, xlim creates a new one. Is there a command in MATLAB that I can use to determine whether there is a figure window in existence ? My intent is to plot the patch objects in an existing graph when one exists.

If my approach is worthy of thedailywtf, please suggest a more sensible way to do what I want to do, i.e. plot objects which are visually circles in a graph with arbitrary x- and y- axis ranges.

Community
  • 1
  • 1
Carl Witthoft
  • 20,573
  • 9
  • 43
  • 73

1 Answers1

4

To answer the explicit question, see findall

A simple test:

h.myfig = figure();
figures = findall(0,'type','figure');

And h.myfig == figures returns 1, so it's finding our figure window.

Answering whether or not it's the best approach would require some example code showcasing your methodology.

sco1
  • 12,154
  • 5
  • 26
  • 48