Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added x and y axis titles to add_trace function #5058#5141

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
mpatrikios wants to merge4 commits intoplotly:main
base:main
Choose a base branch
Loading
frommpatrikios:main
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletionsCHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- Fix third-party widget display issues in v6 [[#5102]https://github.com/plotly/plotly.py/pull/5102]

### Added
- Added `xaxis_title` and `yaxis_title` parameters to `add_trace()` method for more concise subplot creation

## [6.0.1] - 2025-03-14

### Updated
Expand Down
29 changes: 26 additions & 3 deletionsplotly/basedatatypes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2028,7 +2028,14 @@ def _validate_rows_cols(name, n, vals):
BaseFigure._raise_invalid_rows_cols(name=name, n=n, invalid=vals)

def add_trace(
self, trace, row=None, col=None, secondary_y=None, exclude_empty_subplots=False
self,
trace,
row=None,
col=None,
secondary_y=None,
exclude_empty_subplots=False,
xaxis_title=None,
yaxis_title=None,
):
"""
Add a trace to the figure
Expand DownExpand Up@@ -2072,6 +2079,12 @@ def add_trace(
exclude_empty_subplots: boolean
If True, the trace will not be added to subplots that don't already
have traces.
x_axis_title: str or None (default None)
The title of the x-axis for the subplot at the specified row and
col.
y_axis_title: str or None (default None)
The title of the y-axis for the subplot at the specified row and
col.
Returns
-------
BaseFigure
Expand DownExpand Up@@ -2123,17 +2136,27 @@ def add_trace(
col=c,
secondary_y=secondary_y,
exclude_empty_subplots=exclude_empty_subplots,
xaxis_title=xaxis_title,
yaxis_title=yaxis_title,
)
return self

return self.add_traces(
result = self.add_traces(
data=[trace],
rows=[row] if row is not None else None,
cols=[col] if col is not None else None,
secondary_ys=[secondary_y] if secondary_y is not None else None,
exclude_empty_subplots=exclude_empty_subplots,
)

if row is not None and col is not None:
if xaxis_title is not None:
self.update_xaxes(title_text=xaxis_title, row=row, col=col)
if yaxis_title is not None:
self.update_yaxes(title_text=yaxis_title, row=row, col=col)

return result

def add_traces(
self,
data,
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp