Re: Histogram: Show all y-axis labels
- To: mathgroup at smc.vnet.net
- Subject: [mg84597] Re: Histogram: Show all y-axis labels
- From: tomfabtastic at hotmail.com
- Date: Sun, 6 Jan 2008 05:56:08 -0500 (EST)
- References: <flk2ld$c37$1@smc.vnet.net> <flnjij$juk$1@smc.vnet.net>
On Jan 5, 8:44 pm, "David Park" <djmp... at comcast.net> wrote: > Even when one puts in an explicit PlotRange that includes 25 it still > doesn't work! That seems to say that with the Histogram plots one loses > control of PlotRange. I did it with the Presentations package by extracting > the rectangles and specifying the overall plot options outside of the > Histogram plot. > > Needs["Presentations`Master`"] > Needs["Histograms`"] > > dataMEL = {-4.83862134428094, -4.83351849578614, -4.83123661371209, \ > -4.81857651435823, -4.81697757870106, -3.63077685340039, \ > -3.61990031264591, -3.620454208474, -3.75255271241551, \ > -3.7486505523438, -3.74916778278202, -3.58883703915387, \ > -3.58852150625745, -3.58668274158127, -3.58621380313637, \ > -3.58379329218558, -3.58532018279469, -3.58168270891649, \ > -2.83638122975842, -2.83638122975842, -2.83638122975842, \ > -2.83638122975842, -2.83638122975841, -2.83638122975842, \ > -2.83638122975842, -2.83638122975842, -2.83244782284006, \ > -2.83244782284006, -2.83244782284005, -2.83244782284007, \ > -2.83244782284007, -2.83244782284006, -2.83244782284007, \ > -3.10024726246057, -3.10024726246058, -3.10024726246057, \ > -3.10024726246058, -3.10024726246057, -3.10024726246058, \ > -3.10024726246058, -3.03349306726057, -3.03349306726058, \ > -3.01775973392724, -12.0334297635584, -12.0021027632925, \ > -12.0126901267091, -12.0413883877193, -12.0899536741477, \ > -12.1140833164439, -12.1140833164439, -12.1041896779377, \ > -12.1074037093026, -12.009648655543, -11.9652667636422, \ > -12.0079380870759, -11.5326068667369, -11.5223548336914, \ > -11.0075839226891, -10.9744702929917, -10.9204761885454, \ > -10.9237709504502, -10.7225164034228, -10.7334579272323}; > > Draw2D[ > {Histogram[dataMEL, > HistogramCategories -> Range[-15, 0, 1], > HistogramRange -> {-15, 0}] // DrawGraphics}, > AspectRatio -> 1/GoldenRatio, > PlotRange -> {{-15, 0}, {0, 25}}, > Frame -> True, > FrameTicks -> {{Range[0, 25, 5], None}, {Range[-15, 0], None}}, > GridLines -> {None, Range[0, 25, 5]}, > ImageSize -> {600, 400}] > > -- > David Park > djmp... at comcast.nethttp://home.comcast.net/~djmpark/ > > <tomfabtas... at hotmail.com> wrote in message > > news:flk2ld$c37$1 at smc.vnet.net... > > > > > Hi, > > > I am using version 6.0.1. The below histogram works well, except that > > I want the y-axis labels to extend to 25 (and not stop at 20). I can > > achieve this with other graphs, but the options are slightly different > > with Histogram, so perhaps the order that the options are specified > > isimportant ? Can someone please suggest a solution. > > > dataMEL = {-4.83862134428094, -4.83351849578614, -4.83123661371209, \ > > -4.81857651435823, -4.81697757870106, -3.63077685340039, \ > > -3.61990031264591, -3.620454208474, -3.75255271241551, \ > > -3.7486505523438, -3.74916778278202, -3.58883703915387, \ > > -3.58852150625745, -3.58668274158127, -3.58621380313637, \ > > -3.58379329218558, -3.58532018279469, -3.58168270891649, \ > > -2.83638122975842, -2.83638122975842, -2.83638122975842, \ > > -2.83638122975842, -2.83638122975841, -2.83638122975842, \ > > -2.83638122975842, -2.83638122975842, -2.83244782284006, \ > > -2.83244782284006, -2.83244782284005, -2.83244782284007, \ > > -2.83244782284007, -2.83244782284006, -2.83244782284007, \ > > -3.10024726246057, -3.10024726246058, -3.10024726246057, \ > > -3.10024726246058, -3.10024726246057, -3.10024726246058, \ > > -3.10024726246058, -3.03349306726057, -3.03349306726058, \ > > -3.01775973392724, -12.0334297635584, -12.0021027632925, \ > > -12.0126901267091, -12.0413883877193, -12.0899536741477, \ > > -12.1140833164439, -12.1140833164439, -12.1041896779377, \ > > -12.1074037093026, -12.009648655543, -11.9652667636422, \ > > -12.0079380870759, -11.5326068667369, -11.5223548336914, \ > > -11.0075839226891, -10.9744702929917, -10.9204761885454, \ > > -10.9237709504502, -10.7225164034228, -10.7334579272323}; > > Needs["Histograms`"] > > Histogram[dataMEL, Frame -> True, > > HistogramCategories -> Range[-15, 0, 1], HistogramRange -> {-15, 0}, > > FrameTicks -> {{Range[0, 25, 5], None}, {Range[-15, 0], None}}, > > GridLines -> { None, Range[0, 25, 5]}, ImageSize -> {600, 400}]- Hide quoted text - > > - Show quoted text - Thanks for the suggestions. Could not get the Show method to work, but the below works well: dataMEL = {-4.83862134428094, -4.83351849578614, -4.83123661371209, -4.81857651435823, -4.81697757870106, -3.63077685340039, -3.61990031264591, -3.620454208474, -3.75255271241551, -3.7486505523438, -3.74916778278202, -3.58883703915387, -3.58852150625745, -3.58668274158127, -3.58621380313637, -3.58379329218558, -3.58532018279469, -3.58168270891649, -2.83638122975842, -2.83638122975842, -2.83638122975842, -2.83638122975842, -2.83638122975841, -2.83638122975842, -2.83638122975842, -2.83638122975842, -2.83244782284006, -2.83244782284006, -2.83244782284005, -2.83244782284007, -2.83244782284007, -2.83244782284006, -2.83244782284007, -3.10024726246057, -3.10024726246058, -3.10024726246057, -3.10024726246058, -3.10024726246057, -3.10024726246058, -3.10024726246058, -3.03349306726057, -3.03349306726058, -3.01775973392724, -12.0334297635584, -12.0021027632925, -12.0126901267091, -12.0413883877193, -12.0899536741477, -12.1140833164439, -12.1140833164439, -12.1041896779377, -12.1074037093026, -12.009648655543, -11.9652667636422, -12.0079380870759, -11.5326068667369, -11.5223548336914, -11.0075839226891, -10.9744702929917, -10.9204761885454, -10.9237709504502, -10.7225164034228, -10.7334579272323}; Needs["Histograms`"] hist = Histogram[dataMEL, Frame -> True, HistogramCategories -> Range[-15, 0, 1], HistogramRange -> {-15, 0}, FrameTicks -> {{Range[0, 25, 5], None}, {Range[-15, 0], None}}, GridLines -> {None, Range[0, 25, 5]}, ImageSize -> {600, 400}, PlotLabel -> Style["Histogram of ...", 14]] /. {(PlotRange -> _) -> (PlotRange -> {{-15, 0}, {0.5, 24.5}})}