Giter Site home page Giter Site logo

Comments (5)

mwaskom avatar mwaskom commented on June 9, 2024

I'm not sure I understand what the problem is here. This is what I see when I run your code:

image

Your rows are ≈93% NaN. Why wouldn't you expect the resulting heatmap to be fairly sparse?

from seaborn.

dansteiert avatar dansteiert commented on June 9, 2024

image
Oh your Image looks more like what I would expect, but mine is quite a bit sparse - maybe about 20 hits.

Is there a difference in how Linux vs Windows vs Mac could behave?

from seaborn.

dansteiert avatar dansteiert commented on June 9, 2024

To remove the randomness, I select now a specific poistion in all four groups.
I selected 300 elements to be shown in regular intervals, but only a couple are shown

`import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import os
import pandas as pd

new_dict = {}
for k in ["a", "b", "c", "d"]:
v = {str(idx): None for idx in range(30000)}
rand_ints = [int(i) for i in np.linspace(0, 30000, 300)] # CHANGE HERE
for v_hits in rand_ints:
v[str(v_hits)] = v_hits / 30000
new_dict[k] = v

df_heatmap_hits = pd.DataFrame(new_dict).transpose()
sns.heatmap(df_heatmap_hits)
plt.show()`

Figure_1

from seaborn.

mwaskom avatar mwaskom commented on June 9, 2024

The difference in our results is probably that I have "Retina" scaling turned on in the notebook where I made the plot.

When you render a plot to a raster image, there's going to be a limit on the resolution that you can show. e.g. if you are making a 72 dpi figure with a 4 inch width, you only have 288 pixel columns. That's requires some lossy downsampling if you're trying to plot a matrix with tens of thousands of columns.

If you're curious about the details, this is a question that comes up occasionally on the matplotlib issue tracker, so you could search there fore context / tips. But I don't think there is anything seaborn can do to avoid it.

from seaborn.

dansteiert avatar dansteiert commented on June 9, 2024

Thank you for your quick responses and your insights into the matplotlib universe!

That meant for me the solution is just increasing the dpi
e.g. with either of the two lines where i is the required dpi number:
plt.rcParams['figure.dpi'] = i plt.rcParams['savefig.dpi'] = i

I attached some images showing this effect on 100, 300, and 600 dpi

figure_test_100
figure_test_300
figure_test_600

from seaborn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.