Skip to content

plot_2d_hist set log Z #119

Answered by 0ctagon
alozar-si asked this question in Q&A
Discussion options

You must be logged in to vote

Hello!

Thank you for your question.
It does support this feature through the pcolormesh_kwargs and its norm argument (see doc here). You'll need to specify the color scale using a LogNorm (doc here).

If we take the 2d_hist_simple.py example from the documentation, this is how it is implemented:

from plothist import get_dummy_data

df = get_dummy_data()

from plothist import make_2d_hist, plot_2d_hist
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
import numpy as np

name_x = "variable_0"
name_y = "variable_1"

h = make_2d_hist([df[name_x], df[name_y]])

norm = LogNorm(vmin=1, vmax=10000) # Here we define the log scale. We could also use np.max(h.values()) to get the…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by cyrraz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants