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

fix issue #422 #469

Merged
merged 1 commit into from
Nov 1, 2021
Merged

fix issue #422 #469

merged 1 commit into from
Nov 1, 2021

Conversation

gilbertogalvis
Copy link
Contributor

This PR fix the issue #422

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 gilbertogalvis merged commit a559526 into master 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

Successfully merging this pull request may close these issues.

2 participants