-
Notifications
You must be signed in to change notification settings - Fork 0
Update scatter plot to align with the Plotly API #21
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
Changes from 7 commits
b50511b
6a9c0f6
454280b
c6929db
d3f22c1
6a149ed
81472b1
a2861b7
7feeb16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,38 +41,19 @@ def create_scatter_plot( | |
| Raises | ||
| ------ | ||
| pydantic.ValidationError | ||
| If the provided kwargs do not match the `ScatterConfig` schema. | ||
| If the provided keyword arguments do not conform to the `ScatterConfig` schema, | ||
| e.g., a required parameter is missing or a value has an incorrect type. | ||
sayalaruano marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ValueError | ||
| If columns specified in the configuration do not exist in the DataFrame. | ||
| Raised by the plotting engine if a column specified in the configuration is not | ||
| found in the provided DataFrame. | ||
|
|
||
| Examples | ||
| -------- | ||
| >>> import pandas as pd | ||
| >>> sample_df = pd.DataFrame({ | ||
| ... 'gene_expression': [1.2, 2.5, 3.1, 4.5, 5.2, 6.8], | ||
| ... 'log_p_value': [0.5, 1.5, 2.0, 3.5, 4.0, 5.5], | ||
| ... 'regulation': ['Up', 'Up', 'None', 'Down', 'Down', 'Down'], | ||
| ... 'significance_score': [10, 20, 5, 40, 55, 80], | ||
| ... 'gene_name': ['GENE_A', 'GENE_B', 'GENE_C', 'GENE_D', 'GENE_E', 'GENE_F'] | ||
| ... }) | ||
| >>> | ||
| >>> # Create a simple scatter plot and save it to HTML | ||
| >>> fig = create_scatter_plot( | ||
| ... data=sample_df, | ||
| ... x='gene_expression', | ||
| ... y='log_p_value', | ||
| ... group='regulation', | ||
| ... size='significance_score', | ||
| ... text='gene_name', | ||
| ... title="Gene Expression vs. Significance", | ||
| ... x_title="Log2 Fold Change", | ||
| ... y_title="-Log10(P-value)", | ||
| ... colors={'Up': '#d62728', 'Down': '#1f77b4', 'None': '#7f7f7f'}, | ||
| ... file_path="my_scatter_plot.html" | ||
| ... ) | ||
| >>> | ||
| >>> # The returned `fig` object can be displayed in a notebook or further modified | ||
| >>> # fig.show() | ||
| For detailed examples and usage, please refer to the documentation: | ||
|
|
||
| * **Jupyter Notebook:** `docs/api_examples/scatter_plot.ipynb` - | ||
| https://vuecore.readthedocs.io/en/latest/api_examples/scatter_plot.html | ||
| * **Python Script:** `docs/api_examples/scatter_plot.py` | ||
|
||
| """ | ||
| # 1. Validate configuration using Pydantic | ||
| config = ScatterConfig(**kwargs) | ||
|
|
||
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.
So you will add all plotly arguments per default?
Uh oh!
There was an error while loading. Please reload this page.
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.
No, I added the most important ones, but also enabled passing extra arguments from plotly express. Do you think that would be better to just add all of them?