-
Notifications
You must be signed in to change notification settings - Fork 27
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
enable user to increase the viewable length of the y-axis labels #125
enable user to increase the viewable length of the y-axis labels #125
Conversation
…o the top of the plot. This change now requires python library 'typing' to be installed
@@ -138,7 +146,8 @@ def da_barplot(output_dir: str, | |||
significance_threshold: float = 1.0, | |||
effect_size_threshold: float = 0.0, | |||
feature_ids: qiime2.Metadata = None, | |||
level_delimiter: str = None): | |||
level_delimiter: str = None, | |||
label_limit: Optional[int] = None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think Optional
is necessary here. Have you tried the following:
label_limit: Optional[int] = None): | |
label_limit: int = None): |
Providing a default should make it optional (this is what we do for several of the parameters above).
@@ -125,6 +128,11 @@ def _plot_differentials( | |||
cornerRadius=10, | |||
) | |||
|
|||
chart = chart.configure_axisY(titleAlign='left', titleY=-10, titleAngle=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move this into the new if
block below? I don't think it's needed by default (correct me if I'm wrong about that).
Can you also include a comment above this line describing why these modifications are needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not required, it just changes the way the plot axis label looks. Maybe worth keeping outside? For now, I will move it into the if statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I generated these with and without that, and I'm good with keeping it where you had it. It's more readable this way.
I pushed up a commit to move this back to where you had it. I also changed the y-axis title so it says "Feature ID" instead of "Feature ID (most specific, if taxonomic)". The parenthetical information is no longer relevant, and the label fits better at the top with this change (when the feature ids are shorter).
q2_composition/plugin_setup.py
Outdated
@@ -198,7 +199,8 @@ | |||
"this index."), | |||
'level_delimiter': ("If feature ids encode hierarchical information, " | |||
"split the levels when generating feature labels " | |||
"in the visualization using this delimiter.")}, | |||
"in the visualization using this delimiter."), | |||
'label_limit': ("Set labelLimit for y-axis labels")}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember that this documentation is intended for end users, not developers. In most cases end users won't know what labelLimit
is, so your documentation should describe the effect that setting this parameter will have rather than what is technically happening behind the scenes.
'label_limit': ("Set labelLimit for y-axis labels")}, | |
'label_limit': ("Set the maximum length that will be viewable for axis labels. " | |
"You can set this parameter if your axis labels are being cut off.")}, |
Thanks for the pull request @brett-van-tussler! ( I have a couple of comments, and tests are currently failing due to a lint error. To perform linting locally, you can install flake8. Then change to the top-level directory for this repository ( Can you also add a unit test for this new functionality? The easiest way to do that would be to copy one of the existing related tests, eg this one, rename it (e.g., |
@gregcaporaso It looks to me like the graphs decide how much of the label to cut off upon generation. I have attached the html file (renamed to allow upload) In the datasets, the full taxonomic assignment is there - "datasets": {"data-e916d9a522633a1ba63c02ad53bed60e": [{"id": "d__Bacteria;p__Actinobacteriota;c__Actinomycetia;o__Propionibacteriales;f__Propionibacteriaceae;g__Cutibacterium" but opening the html file in a browser shows - This complicates the testing, any ideas? |
…t yaxis configuration move to if block.
@brett-van-tussler, it looks like you can test for the presence of the label limit. For example, if you set it to 4242, you should have Note: I added a commit to this branch (see my comment above) so be sure to Also, we are behind in our release schedule as one of our developers is out sick this week. So if you get this additional test in in the next few days we should still be able to get this in the 2023.7 release. |
Looks great - thanks so much for this contribution @brett-van-tussler! |
Added label_limit parameter to y-axis of da_plot. Move y_axis label to the top of the plot. This change now requires python library 'typing' to be installed, which I believe is installed with qiime2
@gregcaporaso The label limit has a default of None, which required using the typing python package. I believe this in installed with qiime2, but I am not sure how to check.
Here is the zip file, I edited the file name to be able to upload to github, and a screen shot just in case.
Also, what does PR mean?
Thanks!
q2_update_da_plot.zip