|
From: Alan G I. <ala...@gm...> - 2012-07-12 14:43:21
|
This is essentially a query about why certain histogram types are not offered. I can see two possible answers: haven't gotten to them, or, don't want to offer them (e.g., they're bad practice). I will choose Stata as a point of comparison. http://www.stata.com/help.cgi?hist The types are density, fraction, frequency, and percent. Frequency corresponds of mpl's normed=False. Density corresponds of mpl's normed=True. Today I wanted the 'fraction' type, but mpl did not offer it. (Note that because of other elements of the graph, hacks like replacing the ticklabels won't work nicely.) If there is not sentiment against offering these types, I suggest that the `normed` keyword accept strings, including "fraction" and "percent", and that `hist` be extended to produce these types. Cheers, Alan Isaac |
|
From: Damon M. <dam...@gm...> - 2012-07-12 17:20:17
|
On Thu, Jul 12, 2012 at 10:42:59AM -0400, Alan G Isaac wrote: > This is essentially a query about why certain histogram types > are not offered. I can see two possible answers: haven't gotten > to them, or, don't want to offer them (e.g., they're bad practice). > > I will choose Stata as a point of comparison. > http://www.stata.com/help.cgi?hist > The types are density, fraction, frequency, and percent. > Frequency corresponds of mpl's normed=False. > Density corresponds of mpl's normed=True. > Today I wanted the 'fraction' type, but mpl did not offer it. > (Note that because of other elements of the graph, hacks like > replacing the ticklabels won't work nicely.) > > If there is not sentiment against offering these types, > I suggest that the `normed` keyword accept strings, > including "fraction" and "percent", and that `hist` > be extended to produce these types. > > Cheers, > Alan Isaac > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users +1. I think this adds more flexbility to the current histogram implementation. I wonder whether this would be worth a pull request? -- Damon McDougall http://damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom |
|
From: Daπid <dav...@gm...> - 2012-07-12 17:59:15
|
I don't know if there is any reason for not having it, but as a workaround, you could use np.hist to get the data (syntax is the same as mpl.hist and returns the same numbers, but without drawing) and then renormalise and plot with mpl.bars. On Thu, Jul 12, 2012 at 4:42 PM, Alan G Isaac <ala...@gm...> wrote: > This is essentially a query about why certain histogram types > are not offered. I can see two possible answers: haven't gotten > to them, or, don't want to offer them (e.g., they're bad practice). > > I will choose Stata as a point of comparison. > http://www.stata.com/help.cgi?hist > The types are density, fraction, frequency, and percent. > Frequency corresponds of mpl's normed=False. > Density corresponds of mpl's normed=True. > Today I wanted the 'fraction' type, but mpl did not offer it. > (Note that because of other elements of the graph, hacks like > replacing the ticklabels won't work nicely.) > > If there is not sentiment against offering these types, > I suggest that the `normed` keyword accept strings, > including "fraction" and "percent", and that `hist` > be extended to produce these types. > > Cheers, > Alan Isaac > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Benjamin R. <ben...@ou...> - 2012-07-12 18:52:22
|
On Thu, Jul 12, 2012 at 1:58 PM, Daπid <dav...@gm...> wrote: > I don't know if there is any reason for not having it, but as a > workaround, you could use np.hist to get the data (syntax is the same > as mpl.hist and returns the same numbers, but without drawing) and > then renormalise and plot with mpl.bars. > > On Thu, Jul 12, 2012 at 4:42 PM, Alan G Isaac <ala...@gm...> > wrote: > > This is essentially a query about why certain histogram types > > are not offered. I can see two possible answers: haven't gotten > > to them, or, don't want to offer them (e.g., they're bad practice). > > > > I will choose Stata as a point of comparison. > > http://www.stata.com/help.cgi?hist > > The types are density, fraction, frequency, and percent. > > Frequency corresponds of mpl's normed=False. > > Density corresponds of mpl's normed=True. > > Today I wanted the 'fraction' type, but mpl did not offer it. > > (Note that because of other elements of the graph, hacks like > > replacing the ticklabels won't work nicely.) > > > > If there is not sentiment against offering these types, > > I suggest that the `normed` keyword accept strings, > > including "fraction" and "percent", and that `hist` > > be extended to produce these types. > > > > Cheers, > > Alan Isaac > > > Alan, It is tricky to balance functionality, conciseness, and usability. It is both a shortcoming and a strength that we strive to provide a no-frills library that gives the user plenty of rope, while still trying to anticipate most users' needs so that they can get stuff prototyped and working. For most other plots, one would simply convert the data units themselves prior to plotting. However, hist() is a different beast from say, plot() or scatter(), because hist() inherently performs calculations upon the input data and displays the results of those calculations. Therefore, one can't simply perform a conversion on the data prior to calling hist() like one would for other functions. In that light, your idea makes a lot of sense and could essentially be considered as a way to "pretty print" what the graph would normally look like if normed=True. In other words, having normed='percent' would essentially perform the calculations exactly as it would if normed=True, but would multiply the y-coordinate system by 100. Is that what you are looking for? Cheers! Ben Root |
|
From: Eric F. <ef...@ha...> - 2012-07-12 18:34:40
|
On 2012/07/12 7:20 AM, Damon McDougall wrote: > On Thu, Jul 12, 2012 at 10:42:59AM -0400, Alan G Isaac wrote: >> This is essentially a query about why certain histogram types >> are not offered. I can see two possible answers: haven't gotten >> to them, or, don't want to offer them (e.g., they're bad practice). >> >> I will choose Stata as a point of comparison. >> http://www.stata.com/help.cgi?hist >> The types are density, fraction, frequency, and percent. >> Frequency corresponds of mpl's normed=False. >> Density corresponds of mpl's normed=True. >> Today I wanted the 'fraction' type, but mpl did not offer it. >> (Note that because of other elements of the graph, hacks like >> replacing the ticklabels won't work nicely.) >> >> If there is not sentiment against offering these types, >> I suggest that the `normed` keyword accept strings, >> including "fraction" and "percent", and that `hist` >> be extended to produce these types. >> >> Cheers, >> Alan Isaac >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > +1. I think this adds more flexbility to the current histogram > implementation. > > I wonder whether this would be worth a pull request? > Yes, please go ahead. The 'normed' Boolean is not a good design; accepting more descriptive strings would be an improvement. Eric |