Skip to content
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

fix dg color scatter plotting for newer pandas versions #335

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Changes from all 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
24 changes: 12 additions & 12 deletions pyhdx/plot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from contextlib import contextmanager
from copy import copy
from pathlib import Path
from typing import Type, Union
from typing import Optional, Type, Union

import matplotlib as mpl
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -869,16 +869,16 @@ def rainbowclouds(
# todo this should also take Pd.Series?
def colorbar_scatter(
ax,
data,
y="dG",
yerr="covariance",
data: pd.DataFrame,
y:str="dG",
yerr:str="covariance",
cmap=None,
norm=None,
cbar=True,
cbar_kwargs=None,
invert_yaxis=None,
symmetric=False,
sclf=1e-3,
cbar:bool=True,
cbar_kwargs:Optional[dict]=None,
invert_yaxis:bool=False,
symmetric:bool=False,
sclf:float=1e-3,
**kwargs,
):
# todo make error bars optional
Expand All @@ -903,9 +903,9 @@ def colorbar_scatter(
ax.scatter(data.index, data[y] * sclf, color=colors, **scatter_kwargs)
with autoscale_turned_off(ax):
ax.errorbar(
data.index,
data[y] * sclf,
yerr=data[yerr] * sclf,
np.array(data.index),
np.array(data[y] * sclf),
yerr=np.array(data[yerr] * sclf),
zorder=-1,
**errorbar_kwargs,
)
Expand Down