MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Axes not connected at the origin

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103797] RE: [mg103766] Axes not connected at the origin
  • From: "David Park" <djmpark at comcast.net>
  • Date: Tue, 6 Oct 2009 08:02:16 -0400 (EDT)
  • References: <1812813.1254743201853.JavaMail.root@n11>

For those who have the Presentations package the following make a plot like
the one shown in the link.

Needs["Presentations`Master`"]

data = RandomReal[NormalDistribution[0, 1], 10000];
accumulatedCount[bins_, counts_] := Accumulate[counts]

h1 = Histogram[data, {.5},
   AspectRatio -> 1,
   Axes -> None,
   PlotRange -> {{-4, 4}, {0, 2000}},
   PlotRangePadding -> 0];

h2 = Histogram[data, {.5}, accumulatedCount,
   AspectRatio -> 1,
   Axes -> None,
   PlotRange -> {{-4, 4}, {0, 10000}},
   PlotRangePadding -> 0];

Draw2D[
 {Inset[h1, {0, 0}, {Left, Bottom}, {1, 1}],
  XTickLine[{0, 1, -.05}, {-4, 4}, {-4, 4, 2}, 1,
   XLabTickSpecs -> {0, .03},
   XTextSpecs -> {{0, 1}, {1, 0}, .03}],
  YTickLine[{0, 1, -.05}, {0, 2000}, {0, 2000, 500}, 1,
   YLabTickSpecs -> {0, .02},
   YTextSpecs -> {{1, 0}, {1, 0}, .02}],
  
  Inset[h2, {1.5, 0}, {Left, Bottom}, {1, 1}],
  XTickLine[{1.5, 2.5, -.05}, {-4, 4}, {-4, 4, 2}, 1,
   XLabTickSpecs -> {0, .03},
   XTextSpecs -> {{0, 1}, {1, 0}, .03}],
  YTickLine[{0, 1, 1.45}, {0, 10000}, {0, 10000, 2000}, 1,
   YLabTickSpecs -> {0, .02},
   YTextSpecs -> {{1, 0}, {1, 0}, .02}],
  
  Text[Style["Ordinary Histogram", 14, Bold, 
    FontFamily -> "Helvetica"], {.5, 1.2}],
  Text[Style["Cumulative Histogram", 14, Bold, 
    FontFamily -> "Helvetica"], {2.0, 1.2}],
  Text["morm(10000)", {.5, -.25}],
  Text["morm(10000)", {2, -.25}]},
 
 AspectRatio -> Automatic,
 PlotRange -> {{-.3, 2.7}, {-.4, 1.3}},
 BaseStyle -> {FontSize -> 12},
 ImageSize -> 550]

Peter Lindsay at St. Andrews University http://www.mcs.st-and.ac.uk/
maintains and archive of Presentations solutions to MathGroup questions at

http://blackbook.mcs.st-and.ac.uk/~Peter/djmpark/html/ 

This solution should appear in a few days with a Mathematica notebook and a
PDF showing the plot.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  



From: Alexey [mailto:lehin.p at gmail.com] 

Hello,
Is there a way to create in Mathematica a plot styled like these:
http://en.wikipedia.org/wiki/File:Cumulative_vs_normal_histogram.svg ?
I mean that axes of a plot are not connected at the origin and Y axis
starts from 0 and the "0" is shown as "0".
Additionally, a possibility to have two plots both shown with X axes
at one level is also desirable.




  • Prev by Date: Re: Colorfunction + parametricplot3d + plotrange = ?
  • Next by Date: Re: Simple Optimization Problem: Using BinCounts within
  • Previous by thread: Axes not connected at the origin
  • Next by thread: Solving differential equations in the complex plane