docs - dendogram margin
danton267 opened this issue · 1 comments
Would it be possible to remove margin (on the left side of the plot), because it makes the plots in the online docs function badly.
When you open the plot in the browser you can see the dendogram plots are shifted to the right, with big white gap on the left. This causes the plot to be shifted right when embedded, and the plot controls disappear.
link: https://github.com/plotly/plotly.matlab-docs/blob/main/matlab/2021-08-04-dendrogram.md
This issue was fixed by PR #469
To fix this I have proposed a new optional parameter called 'DomainFactor'. This parameter scales each of the domain components of the plotly chart.
The domain or position of a chart box is defined by a 4-element vector, namely:
domain = [xo, yo, w, h]
where:
xo: the initial x-coordinate of the chart (referred to the left-bottom)yo: the initial y-coordinate of the chart (referred to the left-bottom)w: is the width of the charth: is the height of the chart
Then the 'DomainFactor' parameter must be a vector of 4-elements at most, in which each of its elements will scale to each of the elements of the chart's domain.
Example: Without scaling
rng('default')
X = rand(10,3);
tree = linkage(X,'average');
dendrogram(tree)
fig2plotly(gcf);
In this example we have not set the optional DomainFactor parameter, therefore, the domain of the chart will not be scaled, which will result in:
Example: set DomianFactor to scaling
rng('default')
X = rand(10,3);
tree = linkage(X,'average');
dendrogram(tree)
domainFactor = [0.2, 1, 0.9, 0.9];
fig2plotly(gcf, 'offline', offline, 'DomainFactor', domainFactor);
In this case we have set the 'DomainFactor' parameter as [0.2, 1, 0.9, 0.9] and like this:
xowill be scaled by a factor of0.2yowill scale by a factor of1(it will stay the same)w: the width of the chart will be scaled by a factor of0.9h: the height of the chart will be scaled by a factor of0.9
Here I share the result:

