emperor icon indicating copy to clipboard operation
emperor copied to clipboard

add option to constrain axis length

Open nbokulich opened this issue 6 years ago • 5 comments

see this QIIME2 forum thread

It would be very cool to constrain the axis lengths to produce uniform plots. Is there some way to set arbitrary dimensions? Would that make sense or is absolute axis length important? Since there is (or was at some time?) an option to weight axis length by PC % variation, I assume that relative ordination along the axis is all that matters — but perhaps I am overlooking something.

nbokulich avatar Apr 24 '18 13:04 nbokulich

@nbokulich thanks for bringing this up. The absolute axis length is important as the range of the data is meant to be preserved as it relates to the variation explained. More often than not, plotting systems will default to an aspect ratio of 1:1 and will modify the visual ranges of the data (some will even change the aspect ratio as you change the window size of the viewer). Doing this often leads to variable plots for the same data.

The scale by % variation has not been ported into the newest version (oversight on my end), but I also have not seen this feature be used/requested recently, and I don't personally know its original motivation.

Thinking this discussion might be getting into a deeper problem, that calls for the necessity of being able to create a number of plots programatically. This is a big limitation with the JavaScript frontend. There are some hacky solutions, like running a headless browser through the Python API. However doing something like that would still require that all visual aspects are user-controllable. Perhaps a more reasonable approach would be to have a translator between Emperor to Matplotlib.

As a sidenote in the images in this comment, I noticed that scaling the axes uniformly lead to noticeable differences in the plot, so I decided to stay away from that.

ElDeveloper avatar Apr 24 '18 15:04 ElDeveloper

Thinking this discussion might be getting into a deeper problem, that calls for the necessity of being able to create a number of plots programatically

(In my naive perspective) I do not think that is absolutely necessary for this issue — though making/saving emperor plots programmatically would be awesome. I was just imagining that axis length/aspect ratio could be defined by the user, and saved down as with other parameters to apply to other plots. NOT that plots necessarily need to be made/scaled in parallel, as was discussed in that forum post.

Perhaps a more reasonable approach would be to have a translator between Emperor to Matplotlib.

♥️

As a sidenote in the images in this comment, I noticed that scaling the axes uniformly lead to noticeable differences in the plot, so I decided to stay away from that.

These differences just seem to be due to a change in perspective, and at least in that example would not influence the conclusions. I could imagine examples where otherwise distinguishable clusters become compressed...

nbokulich avatar Apr 24 '18 16:04 nbokulich

I was just imagining that axis length/aspect ratio could be defined by the user, and saved down as with other parameters to apply to other plots.

I see, thanks for the explanation. Before adding something like this, I would like to hear other's opinions on this matter. I think it could lead to misinterpretations of some plots.

ElDeveloper avatar Apr 24 '18 19:04 ElDeveloper

Looking at this and the comments from the user in the original thread. I think one simple option will be to have an input parameter to adjust the x-axis to a given size in pixels (?) so this value can be used in all the plots. For example, imagine that you adjust the x-axis to 1000px, this will adjust all the other axis (by zooming?) and then you can use the same value in all. This will, at least assure that PC1/x is the same size. However, not sure if this is sufficient for the original issue/suggestion.

antgonza avatar Apr 24 '18 19:04 antgonza

I believe this wouldn't help, as the final intention (as far as I understand). Is to be able to align together a grid or series of plots. This is easy fo all the axes match in size and aspect ratios, but is hard when we preserve the original aspect ratio of the axes.

Perhaps a "good enough" trick, would be to extend the axis line length in all axes so they have the same size. Only odd thing about this is that some plots will look really awkward (when the variance is high in the first axis and very low in the subsequent ones).

On (Apr-24-18|19:41), Antonio Gonzalez wrote:

Looking at this and the comments from the user in the original thread. I think one simple option will be to have an input parameter to adjust the x-axis to a given size in pixels (?) so this value can be used in all the plots. For example, imagine that you adjust the x-axis to 1000px, this will adjust all the other axis (by zooming?) and then you can use the same value in all. This will, at least assure that PC1/x is the same size. However, not sure if this is sufficient for the original issue/suggestion.

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/biocore/emperor/issues/670#issuecomment-384055087

ElDeveloper avatar Apr 25 '18 17:04 ElDeveloper