nschloe/tikzplotlib

Figure should not be empty when exporting a colorbar

JasonGross opened this issue · 0 comments

# %%
import matplotlib as mpl
import matplotlib.pyplot as plt
import tikzplotlib
# example from https://matplotlib.org/stable/users/explain/colors/colorbar_only.html#basic-continuous-colorbar
fig, ax = plt.subplots(figsize=(6, 1), layout='constrained')

cmap = mpl.cm.cool
norm = mpl.colors.Normalize(vmin=5, vmax=10)

fig.colorbar(mpl.cm.ScalarMappable(norm=norm, cmap=cmap),
             cax=ax, orientation='horizontal', label='Some Units')
print(tikzplotlib.get_tikz_code(fig))

gives

% This file was created with tikzplotlib v0.10.1.
\begin{tikzpicture}

\end{tikzpicture}

But it should produce some colorbar