Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs - dendogram margin #422

Open
danton267 opened this issue Oct 20, 2021 · 1 comment
Open

docs - dendogram margin #422

danton267 opened this issue Oct 20, 2021 · 1 comment

Comments

@danton267
Copy link
Member

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

@danton267 danton267 changed the title docs - dendogram margin [documentation]- dendogram margin Oct 20, 2021
@danton267 danton267 changed the title [documentation]- dendogram margin docs - dendogram margin Oct 20, 2021
gilbertogalvis pushed a commit that referenced this issue Nov 1, 2021
@gilbertogalvis
Copy link
Contributor

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 chart
  • h: 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:

Screen Shot 2021-11-01 at 4 46 47 PM

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:

  • xo will be scaled by a factor of 0.2
  • yo will scale by a factor of 1 (it will stay the same)
  • w: the width of the chart will be scaled by a factor of 0.9
  • h: the height of the chart will be scaled by a factor of 0.9

Here I share the result:

Screen Shot 2021-11-01 at 4 47 26 PM

gilbertogalvis added a commit that referenced this issue Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants