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 issues with new versions of pandas and matplotlib #117

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 6 additions & 3 deletions energy_pandas/energypandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,8 @@ def plot3d(
y = z.index.values

x, y = meshgrid(x, y)
# Remove edgecolors from kwargs
kwargs.pop("edgecolors", None)
ax.contour3D(x, y, z.values, 150, cmap=cmap, **kwargs)
else:
raise NameError('plot kind "{}" is not supported'.format(kind))
Expand Down Expand Up @@ -767,16 +769,16 @@ def plot2d(

offset_n = f"{offset.n}-" if offset.n > 1 else ""
ylabel = (
f"{offset_n}{RESOLUTION_NAME[offset.name]} of "
f"{RESOLUTION_NAME[yperiod.resolution_string][0:-1]}"
f"{offset_n}{RESOLUTION_NAME[str(offset.name).upper()]} of "
f"{RESOLUTION_NAME[yperiod.resolution_string.upper()][0:-1]}"
)

stacked, timeindex = tsam.unstackToPeriods(
copy.deepcopy(self), int(periodlength)
)
if xlabel is None:
xperiod = (periodlength * offset).delta
xlabel = f"{RESOLUTION_NAME[xperiod.resolution_string]}"
xlabel = f"{RESOLUTION_NAME[xperiod.resolution_string.upper()]}"
cmap = plt.get_cmap(cmap)
if vcenter is not None:
norm = TwoSlopeNorm(vcenter, vmin=vmin, vmax=vmax)
Expand Down Expand Up @@ -820,6 +822,7 @@ def plot2d(
D="Days",
H="Hours",
T="Minutes",
MIN="Minutes",
S="Seconds",
L="Milliseconds",
U="Microseconds",
Expand Down
4 changes: 2 additions & 2 deletions energy_pandas/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ def _plot_surface(ax, x, y, z, cmap=None, **kwargs):
**kwargs:
"""
if cmap is None:
cmap = cm.gist_earth
cmap = plt.get_cmap("gist_earth")

ls = LightSource(270, 45)
# To use a custom hillshading mode, override the built-in shading and pass
# in the rgb colors of the shaded surface calculated from "shade".
rgb = ls.shade(z, cmap=cm.get_cmap(cmap), vert_exag=0.1, blend_mode="soft")
rgb = ls.shade(z, cmap=plt.get_cmap(cmap), vert_exag=0.1, blend_mode="soft")
surf = ax.plot_surface(
x,
y,
Expand Down
Loading