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

Figure should not be empty when exporting a colorbar #606

Open
JasonGross opened this issue Apr 26, 2024 · 0 comments · May be fixed by #608
Open

Figure should not be empty when exporting a colorbar #606

JasonGross opened this issue Apr 26, 2024 · 0 comments · May be fixed by #608

Comments

@JasonGross
Copy link

JasonGross commented Apr 26, 2024

# %%
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

JasonGross added a commit to JasonGross/tikzplotlib that referenced this issue Apr 26, 2024
JasonGross added a commit to JasonGross/tikzplotlib that referenced this issue Apr 26, 2024
JasonGross added a commit to JasonGross/tikzplotlib that referenced this issue Apr 26, 2024
JasonGross added a commit to JasonGross/tikzplotlib that referenced this issue Apr 26, 2024
Fixes nschloe#606

Not sure if this is the best way to do it, since it seems a bit kludgy,
but it seems to work.
JasonGross added a commit to JasonGross/tikzplotlib that referenced this issue Apr 26, 2024
Fixes nschloe#606

Not sure if this is the best way to do it, since it seems a bit kludgy,
but it seems to work.
@JasonGross JasonGross linked a pull request Apr 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant