Skip to content

Commit 7080ad2

Browse files
fix issues with new versions of pandas and matplotlib (#117)
* fix issues with new versions of pandas and matplotlib * support MIN as a key
1 parent a9cbbb8 commit 7080ad2

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

energy_pandas/energypandas.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,8 @@ def plot3d(
549549
y = z.index.values
550550

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

768770
offset_n = f"{offset.n}-" if offset.n > 1 else ""
769771
ylabel = (
770-
f"{offset_n}{RESOLUTION_NAME[offset.name]} of "
771-
f"{RESOLUTION_NAME[yperiod.resolution_string][0:-1]}"
772+
f"{offset_n}{RESOLUTION_NAME[str(offset.name).upper()]} of "
773+
f"{RESOLUTION_NAME[yperiod.resolution_string.upper()][0:-1]}"
772774
)
773775

774776
stacked, timeindex = tsam.unstackToPeriods(
775777
copy.deepcopy(self), int(periodlength)
776778
)
777779
if xlabel is None:
778780
xperiod = (periodlength * offset).delta
779-
xlabel = f"{RESOLUTION_NAME[xperiod.resolution_string]}"
781+
xlabel = f"{RESOLUTION_NAME[xperiod.resolution_string.upper()]}"
780782
cmap = plt.get_cmap(cmap)
781783
if vcenter is not None:
782784
norm = TwoSlopeNorm(vcenter, vmin=vmin, vmax=vmax)
@@ -820,6 +822,7 @@ def plot2d(
820822
D="Days",
821823
H="Hours",
822824
T="Minutes",
825+
MIN="Minutes",
823826
S="Seconds",
824827
L="Milliseconds",
825828
U="Microseconds",

energy_pandas/plotting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ def _plot_surface(ax, x, y, z, cmap=None, **kwargs):
144144
**kwargs:
145145
"""
146146
if cmap is None:
147-
cmap = cm.gist_earth
147+
cmap = plt.get_cmap("gist_earth")
148148

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

0 commit comments

Comments
 (0)