Giter Club home page Giter Club logo

Comments (2)

gedeck avatar gedeck commented on July 28, 2024

The shape of a histograms depends on how the bins are defined. You can see in the lets-plot graph that the left bin starts at around -2.5 and the right bin ends at about 40. For the pandas plot, the bins range from 0 to about 38. While it hardly changes the overall shape, the distribution of cases into the first two bins changes with the observed reversal in the column heights.

If I compare the two graphs, I would say that the bins that lets-plot chooses are not appropriate for the data set. If you look at the lets-plot graph, the left most bin from -2.5 to 2.5, the population count is however only a positive number, so half of the bin range is not representing data.

The documentation for geom_histogram (https://lets-plot.org/pages/api/lets_plot.geom_histogram.html) shows that there are keyword arguments that allow to control the positioning of the bins. Try using for example boundary=0 and see how that changes the overall shape.

If the datasets aren't too large, I like to use density plots. They often give a more informative picture of distributions.

Examples:

from practical-statistics-for-data-scientists.

hchen98 avatar hchen98 commented on July 28, 2024

Hi @gedeck, thanks for replying to the issue so quickly. Oh dear, how careless I am to miss that detail :( . I will close this issue since it's just my code error.

from practical-statistics-for-data-scientists.

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.