Enhance x-tick label customization: add font size, color, and rotatio…#2
Enhance x-tick label customization: add font size, color, and rotatio…#2
Conversation
…n options; improve handling of x-tick labels across subplots
Reviewer's GuideThis PR extends x-axis tick label customization in plot_peptigram by introducing font size, color, and rotation options, implements logic to apply these settings only on the bottom subplot while hiding labels on intermediate axes, and updates the default plot title in runner.py. Class diagram for updated plot_peptigram function parametersclassDiagram
class plot_peptigram {
+int x_lab_forntsize = 12
+int y_lab_forntsize = 12
+int xticks_font = 12
+str xticks_color = "#333333"
+int xticks_rotation = 0
+bool annotate = True
+Optional[float] min_intensity
+Optional[List[Tuple[int, int]]] highlight_regions
+float highlight_alpha = 0.25
+str highlight_color = "#FF8888"
+int dpi = 300
+Tuple[plt.Figure, List[plt.Axes]] plot_peptigram(...)
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @sanjaysgk - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `ProtPeptigram/viz.py:53` </location>
<code_context>
title: Optional[str] = None,
x_lab_forntsize: int = 12,
y_lab_forntsize: int = 12,
+ xticks_font: int = 12,
+ xticks_color: str = "#333333",
+ xticks_rotation: int = 0,
annotate: bool = True,
min_intensity: Optional[float] = None,
</code_context>
<issue_to_address>
Parameter naming is inconsistent between function signature and docstring.
The docstring uses 'x_ticks_rotation' while the parameter is 'xticks_rotation'. Please use the same name in both for clarity.
Suggested implementation:
```python
x_ticks_rotation: int = 0,
```
```python
"""
Create a PeptiGram visualization with protein-based coloring.
Font size for x-axis labels Amino acid positions(default: 12)
x_ticks_rotation: int
Rotation angle for x-axis tick labels (default: 0)
```
```python
# ... (usage in function body)
ax.set_xticklabels(labels, fontsize=xticks_font, color=xticks_color, rotation=x_ticks_rotation)
```
</issue_to_address>
### Comment 2
<location> `ProtPeptigram/runner.py:187` </location>
<code_context>
group_by='Sample',
color_by='protein',
figsize=(14, 12),
- title=f"Peptide Visualization - {prot}",
+ title=f"Peptide-Protein alignment visualisation - {prot}",
color_by_protein_and_intensity=False,
intensity_cmaps=["Blues", "Reds", "Greens", "Purples"],
</code_context>
<issue_to_address>
Title spelling is inconsistent with US/UK English conventions.
Consider updating the spelling to match the convention used elsewhere in the project.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
title=f"Peptide-Protein alignment visualisation - {prot}",
=======
title=f"Peptide-Protein alignment visualization - {prot}",
>>>>>>> REPLACE
</suggested_fix>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| xticks_font: int = 12, | ||
| xticks_color: str = "#333333", | ||
| xticks_rotation: int = 0, |
There was a problem hiding this comment.
suggestion: Parameter naming is inconsistent between function signature and docstring.
The docstring uses 'x_ticks_rotation' while the parameter is 'xticks_rotation'. Please use the same name in both for clarity.
Suggested implementation:
x_ticks_rotation: int = 0, """
Create a PeptiGram visualization with protein-based coloring.
Font size for x-axis labels Amino acid positions(default: 12)
x_ticks_rotation: int
Rotation angle for x-axis tick labels (default: 0) # ... (usage in function body)
ax.set_xticklabels(labels, fontsize=xticks_font, color=xticks_color, rotation=x_ticks_rotation)| group_by='Sample', | ||
| color_by='protein', | ||
| figsize=(14, 12), | ||
| title=f"Peptide Visualization - {prot}", |
There was a problem hiding this comment.
nitpick (typo): Title spelling is inconsistent with US/UK English conventions.
Consider updating the spelling to match the convention used elsewhere in the project.
| title=f"Peptide Visualization - {prot}", | |
| title=f"Peptide-Protein alignment visualization - {prot}", |
…n options; improve handling of x-tick labels across subplots
Summary by Sourcery
Enhance x-tick label customization in the Peptigram visualization by exposing font size, color, and rotation options, streamline x-tick label display across subplots, and adjust function signature and default titles for clarity.
New Features:
Enhancements:
Documentation: