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

Heatmap does not show any colors if reverse=True #949

Closed
JoergVanAken opened this issue Oct 11, 2019 · 4 comments · Fixed by #951
Closed

Heatmap does not show any colors if reverse=True #949

JoergVanAken opened this issue Oct 11, 2019 · 4 comments · Fixed by #951

Comments

@JoergVanAken
Copy link

Describe the bug
A heatmap does not show any values if reverse is set to True

To Reproduce
The following code:

fig = plt.figure()
h = plt.heatmap(np.array([[1, 2], [3, 4]]), y=[0, 1])
plt.show()

shows up a heatmap. But after setting

h.scales['x'].reverse=True

the axis is reversed but all colors disappear, (changing y has the same effect)

Expected behavior
The colur should not disappear.

Environment (please complete the following information):

  • Operating System and Version: Windows 10
  • Browser: Chrome
@martinRenou
Copy link
Member

Thanks a lot for filling this issue, I'm looking into this

@SergioLoaiza
Copy link

Describe the bug
The bug seems to be more general. I experienced the same bug creating a simple bar graph; the bars disappeared if reverse is set to True at a LinearScale.

To Reproduce

from bqplot import OrdinalScale, Bars, LinearScale

quintes = np.array(
    ["0 - 4", "5 - 9", "10 - 14", "15 - 19", "20 - 24", "25 - 29", "30 - 34", "35 - 39",
     "40 - 44", "45 - 49", "50 - 54", "55 - 59", "60 - 64", "65 - 69", "70 - 74",
     "75 - 79", "80 - 84", "85 - 89", "90 - 94", "95 - 99", "> 100"])

men = np.array(
    [1915887, 2100931, 2494484, 2464805, 2361297, 2529633, 2669927, 2754129, 2753282,
     2552531, 2211649, 1697221, 1311024, 902675, 722246, 482686, 273915, 108639, 35867,
     10965, 1238])

x_ord = OrdinalScale()
y_linear = LinearScale()

bars = Bars(x=quintes, y=men,
           scales={'x':x_ord, 'y': y_linear},
           orientation="horizontal",
           colors=["deepskyblue"]
           )

# bars.scales['y'].reverse=True

ax_x = Axis(scale=x_ord, orientation = 'vertical', visible=False)

ax_y = Axis(scale=y_linear, tick_format="0.0f")

fig = Figure(marks=[bars], axes=[ax_x, ax_y])

fig

The bars graph is displayed. However, after uncommenting this line in the code:

bars.scales['y'].reverse=True

the bars disappear even though the axes is effectively reversed.

Expected behavior
The bars should be displayed in the same way of the axes, that is, from right to left.

Environment (please complete the following information):
Ubuntu 21.04
Python 3.9.5
JupyterLab 3.2.4
bqplot 0.12.32

@martinRenou
Copy link
Member

Thanks for commenting, would you like to open a new issue for that specifically?

@SergioLoaiza
Copy link

Thank you for your advice. I published it again in this new issue #1483

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.

3 participants