decision tree in matlab - change font size - matlab

Could someone please assist:
Is there a way to change font size of classregtree in matlab?
How can I change the class labels?

Well, try this:
using an example from the docs:
load fisheriris;
t = classregtree(meas,species,...
'names',{'SL' 'SW' 'PL' 'PW'})
I was able to get the property-inspector:
tr=view(t)
inspect(tr)
..what didnt help a lot...
Now I took the handles of all children of tr, that are text-elements:
allHandles=findall(tr,'Type','text')
Next, I just changed the FontSize:
set(allHandles,'FontSize',16)
and there you go :) it is working!
To see and edit other properties, you could now use the inspect-method, as I was doing at my first try, but with the text-handles of course. normally, there should be all other properties available as for normal text-elements. Just check the docs for uicontrol + text.

Lucius's answer worked for me but instead of
tr=view(t)
I had to run this:
before = findall(groot,'Type','figure'); % Find all figures
view(t,'Mode','graph')
after = findall(groot,'Type','figure');
tr = setdiff(after,before); % Get the figure handle of the tree viewer
inspect(tr)

Related

QGIS: Get Layout's Grid CRS (QgsLayoutItemMapGrid)?

Still learning QGIS using Python, but getting there...thanks to this site!
I'm trying to extract the CRS of the GRID that my layout is using. I think the Class I need to use is QgsLayoutItemMapGrid but can't get there from my testing:
projectInstance = QgsProject.instance()
projectLayoutManager = projectInstance.layoutManager()
# I checked and mine is the 'first' layout, viz [0]
mylayout = projectLayoutManager.layouts()[0]
# found this method in the API reference, but doesn't seem to have CRS etc
mygrid = mylayout.gridSettings()
... but I can't get beyond this. Maybe a different starting point? Any tips? Thanks.

2 problem with minspantree.m in Matlab 2018a

2 problem with minspantree.m in Matlab 2018a
Hi dear all; I want to find a min-span-tree of a matrix. I figured that MATLAB's own minspantree.m may be the most efficient algorithm. So i use
open minspantree.m
And here comes Question:
1.The code in minspantree.m used G.EdgeProperties.Weight and G.Underlying. G is a graph object. But when I use G.EdgeProperties.Weight or G.Underlying in Command window, both returns error: Error using graph/subsref (line 15) No public property 'EdgeProperties' for class 'graph'. Why?
2.minspantree.m line 62:
[pred, edgeind] = primMinSpanningTree(G.Underlying, w, rootNode, restart);
Is primMinSpanningTree a function? But I can not find any: function [ ] = primMinSpanningTree() in minspantree.m, neither can I find primMinSpanningTree.m file in my whole disk. So what is primMinSpanningTree? What is its code? How can I find it and open it?
Thanks all very much.
Both EdgeProperties and Underlying are private properties of the graph class. They can only be accessed from within the class. Take a look at Graph.m. minspantree is a class method, so it has access.
primMinSpanningTree is a built-in method from matlab.internal.graph.MLGraph. You can see that with which primMinSpanningTree. So I believe the code might not be accessible.

how to move images in openoffice.org BASIC or LibreOfffice.org

After moving pictures in VBA using Shape.IncrementLeft and Shape.IncrementTop I would like to move pictures in openoffice.org BASIC code.
After searching internet with these keywords "move picture" and "openoffice.org" or "open BASIC" or "OOo BASIC" I did not find the answer.
I have found how to move pictures in Java, c++, android, but not in OpenOffice.org BASIC,
I read trough these guides
https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide
http://www.pitonyak.org/OOME_3_0.pdf
I tried to find the answer through LIBRE OFFICE also, but without success.
I tried to record a macro, insert a picture, move it with the mouse and stop the macro.
When looking into the code, the answer of my question take me to the dispatcher and one of the UNO methods, I believe is has something to do with these keywords:
Properties in the com.sun.star.awt.UnoControlImageControlModel service
com.sun.star.drawing.GraphicObjectShape
BorderBottom
BorderLeft
BorderRight
BorderTop
oPoint = oShape.Position
getPosition()
setPosition(Point)
but I cannot find a clear answer and I do not know how to combine them to make the image (or it can be a shape inserted also) to move.
can anybody guide me how to find the answer?
first of all: https://wiki.openoffice.org/wiki/Extensions_development_basic is a good starting point. In particular the XRAY tool is very helpfully.
The following Code changes the position of a selected Image on a Calc Worksheet:
Sub Test
dim aNewPosition as new com.sun.star.awt.Point
oDoc = thisComponent
oSelection = oDoc.CurrentSelection(0)
if oSelection.supportsService("com.sun.star.drawing.Shape") then
aPosition = oSelection.Position
x = aPosition.X
y = aPosition.Y
aNewPosition.X = x + 100
aNewPosition.Y = y + 100
oSelection.setPosition(aNewPosition)
endif
End Sub
Greetings
Axel

Keeping track of text position on pdf using FPDF and GetY

I am trying to keep track of the current Y position on a PDF page created using FPDF so that I can correctly start a new page ensuring tables do not cross a page break. Firstly am I right in using GetY to monitor this and if so what is the correct syntax. I am trying
$currentYposition = GetY();
but it does not seem to work. Any advice?
No idea why this works - but it does:
If you just grab Y after the call, it seems to be the value before the MultiCell.
Grabbing it before and after and taking the difference gives you the height.
$oldY = $this->getY();
$this->MultiCell(150, 4, utf8_decode($description), 0, "L");
$newY = $this->getY();
$multiCellHeight = $newY-$oldY;
This one worked for me.
$y = $pdf->GetY();
I came to this question when programming in python and using the fpdf module. I'll post in case anyone else need this, I could not find this solution in the official documentation but for me following worked:
from fpdf import FPDF
pdf = FPDF()
pdf.add_page()
current_y = FPDF.get_y(pdf)

How can I create an IDynamicDisplay obj in ArcObjects?

I am trying to draw a text glyph on the map and all the tutorials say I need a IDynamicDisplay, but I don't know how to get at one. Thanks in advance. ; )
edit: C# VS2010
First you need to set IDynamicMap::DynamicMapEnabled property from Map object to true.
IDynamicMap pDynamicMap = pMap as IDynamicMap;
pDynamicMap.DynamicMapEnabled = true
Then, there are two ways to get DynamicDisplay object. One is creating custom Layer with implement IDynamicLayer interface. Second one is hooking IDynamicMapEvents::BeforeDynamicDraw event or IDynamicMapEvents::AfterDynamicDraw event. I hope this best practice help you.
Best practices for using dynamic display
You have to wire up an event handler
ESRI.ArcGIS.Carto.IDynamicMapEvents_Event dynamicMapEvents = dynamicMap as ESRI.ArcGIS.Carto.IDynamicMapEvents_Event;
ESRI.ArcGIS.Carto.IActiveViewEvents_Event avEvents = activeView as ESRI.ArcGIS.Carto.IActiveViewEvents_Event;
avEvents.AfterDraw += new ESRI.ArcGIS.Carto.IActiveViewEvents_AfterDrawEventHandler(avEvents_AfterDraw);
dynamicMapEvents.AfterDynamicDraw += new IDynamicMapEvents_AfterDynamicDrawEventHandler(dynamicMapEvents_AfterDynamicDraw);