|
I am too much me <roberson@hushmail.com> wrote in message <ignjr0$mpu$1@nrc-news.nrc.ca>...
> On 11-01-13 01:06 PM, Andy wrote:
> > I'm currently using the following code to save a graph:
> >
> > g=figure;
> > p=copyobj(myAxes,g);
> > set(p,'Units','normalized','OuterPosition',[0 0 1 1]);
> > print(g,'-dbmp','tempfile.bmp');
> > close(g);
> >
> > This works pretty well, except that if the graph in myAxes has a datatip, this
> > datatip is not saved in the bitmap. Does anybody know a way to copyobj the
> > datatip along with the graph?
>
> I believe the datatip may be created within a different axes.
Some poking around with Yair's findjobj (http://www.mathworks.com/matlabcentral/fileexchange/14317-findjobj-find-java-handles-of-matlab-graphic-objects) suggests that this is not the case.
But I'm guessing everything about a data tip is nearly invisible from a programmatic point of view. For example, run the following:
x=linspace(0,10,100);
y=sin(x);
f=figure;
a=axes('parent',f);
p=plot(a,x,y);
% add a few data tips
findjobj(f)
Now if you right click on one of the datatips and "Export handle to findjobj_hdls", you'll have the handle for the data cursor in your workspace. I then renamed mine to dc. Then you can see all of the properties of the data cursor:
>> get(dc)
Annotation: [1x1 hg.Annotation]
DisplayName: ''
HitTestArea: 'off'
BeingDeleted: 'off'
ButtonDownFcn: []
Children: [0x1 double]
Clipping: 'on'
CreateFcn: []
DeleteFcn: []
BusyAction: 'queue'
HandleVisibility: 'off'
HitTest: 'on'
Interruptible: 'on'
Parent: 1109.00012207031
SelectionHighlight: 'on'
Tag: ''
Type: 'hggroup'
UserData: []
Selected: 'off'
FontAngle: 'normal'
FontName: 'Helvetica'
FontSize: 8
FontUnits: 'points'
FontWeight: 'normal'
EdgeColor: [0.8 0.8 0.8]
BackgroundColor: [1 1 0.933333333333333]
TextColor: [0 0 0]
Marker: 'square'
MarkerSize: 10
MarkerEdgeColor: [1 1 0.862745098039216]
MarkerFaceColor: [0 0 0]
MarkerEraseMode: 'normal'
Draggable: 'on'
String: [1x19 char]
Visible: 'on'
StringFcn: []
UpdateFcn: []
UIContextMenu: [1x1 uicontextmenu]
Host: [1x1 graph2d.lineseries]
Interpolate: 'off'
Draggable seemed like a pretty unique property name. I've never seen anything else with this property, and I'm sure this would uniquely identify data cursors in my program. But:
>> findobj('-property','Draggable')
ans =
Empty matrix: 0-by-1
I've also tried a lot of other properties, and none of them were found by findobj. So I don't know how I can programmatically find the data cursors. The findjobj results make it look like they're children of the axes object, but get(a,'children') will only return the handle for the lineseries object.
Any other ideas?
|