-
Notifications
You must be signed in to change notification settings - Fork 16
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
Adding function ctd_plot and solving conflicts #115
Merged
Merged
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
b3a5d1f
Add new function plot_ctd
FloraSauerbronn aa566d5
Add new test function plot_ctd
FloraSauerbronn d6af191
Add new baseline image plot_ctd
FloraSauerbronn d4d575f
Adjusting errors
FloraSauerbronn 3499664
Add tolerance to image compare test
FloraSauerbronn ead3af8
changing back test_plotting
FloraSauerbronn 2cc887d
Update test_plotting.py
FloraSauerbronn e7e25d5
updating ctd_plot with idx param
FloraSauerbronn 4398cf9
updating test_plotting
FloraSauerbronn 2f55d9e
Adding test_plot_ctd
FloraSauerbronn e909a38
creating new figure for image test compare plot_ctd
FloraSauerbronn 65e4ef2
Merge branch 'main' of github.com:ioos/gliderpy into ctd_plots
FloraSauerbronn 1e7eb20
Merge branch 'ctd_plots' of https://github.com/FloraSauerbronn/glider…
FloraSauerbronn 32c5fa9
fix ruff tests
FloraSauerbronn 1ed0776
fix import order
FloraSauerbronn 4edd36d
fix end of file
FloraSauerbronn 9232e5c
positive pressure
FloraSauerbronn 5240abb
Fixing ax in plot_ctd and creating new baseline image
FloraSauerbronn dae31ba
Removing ax object in excess
FloraSauerbronn 51f9685
Removing unnecessary ax features from plot_ctd
FloraSauerbronn f03cbf0
Solving problems from pre-commit and image
FloraSauerbronn 0babf90
Removing unecessary features from plot_ctd
FloraSauerbronn 4fdf02b
Removing legend
FloraSauerbronn 223bd4c
updating image
FloraSauerbronn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 should be an if-check block outside of the ax creation. We had it before if I'm not mistaken.
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.
The problem occurs when calling the legend while using the twiny axis. We have three scenarios:
1. When using just one axis (not referring to a second one like ax2), the legend will only display the last variable plotted if twiny is used, so we need to create twoo box one for each legend and specify where they should be placed.
`
@register_dataframe_method
def plot_ctd(
df: pd.DataFrame,
profile_number: int,
var: str,
ax: plt.Axes = None,
color: str | None = None,
) -> tuple:
"""Make a CTD profile plot of pressure vs property
depending on what variable was chosen.
fig, ax = plot_ctd(df, 0, var="temperature", color="blue")
fig, ax = plot_ctd(df, 0, var="salinity", ax=ax, color="red")`
2. Or calling the legend inside each clouse (if ax is none and else) without defining each ax they would overlap eachother.
3. Or we defined each ax and call the legens like this so they can be in the same box
`@register_dataframe_method
def plot_ctd(
df: pd.DataFrame,
profile_number: int,
var: str,
ax: plt.Axes = None,
color: str | None = None,
) -> tuple:
"""Make a CTD profile plot of pressure vs property
depending on what variable was chosen.
Example usage:
fig, ax = plot_ctd(df, 0, var="temperature", color="blue")
fig, ax = plot_ctd(df, 0, var="salinity", ax=ax, color="red")
`