Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.
data = Flatten[Import["speedtest1B.csv"]];
distrib = HistogramDistribution[data];
histogram = Histogram[data, ChartStyle -> {Blue}];
Export["speedtest1B.pdf", 
    Overlay[{ 
    Histogram[
        data, 
        ChartStyle -> {Blue},
        ImageSize -> {500,500},
        AxesLabel -> {"start-up time [ms]", "number of samples"}
        ],
    DiscretePlot[
        CDF[distrib, x], 
        {x, 0, Max[data]},
        ImageSize -> {500,500},
        Axes -> False
        ]
        }
    ]
];

From the above I get:

enter image description here

I would like the plots to be properly aligned. Displaying the CDF x-axis on the right side of the plot would be a big plus. Also I don't realy get color-theaming so could someone please explain how to easily change the color od CDF to red.

share|improve this question
    
Inside Overlay should be {...}, but you don't even need Overlay, use Show - see my answer. –  Vitaliy Kaurov Jan 30 '13 at 4:39
add comment

1 Answer

up vote 4 down vote accepted
 data = 1000 RandomVariate[GammaDistribution[3, .5], 10^4];
 distrib = HistogramDistribution[data];
 Overlay[{DiscretePlot[CDF[distrib, x], {x, 0, Max[data]},
  ImageSize -> {600, 400}, Frame -> {{False, True}, {False, False}},
  FrameTicks -> {{None, Range[0.1, 1, .1]}, {None, None}},
  ImagePadding -> {{50, 100}, {15, 25}}],
 Histogram[data, ChartStyle -> Opacity[.5, Blue],
  ImageSize -> {600, 400}, ImagePadding -> {{50, 100}, {15, 25}},
  AxesLabel -> {Style["start-up time [ms]", 12],
     Style["number of samples", 12]}]},
  Alignment -> Center]

enter image description here

share|improve this answer
    
awesome! thank you! Any idea how to label the axes? Simple AxesLabel doesnt really work. –  JohnnyM Jan 30 '13 at 5:55
    
@JohnnyM, please see the update. (You need to adjust the values for the ImagePadding option to see the axes labels.) –  kguler Jan 30 '13 at 6:12
    
thanks! maybe you could help with my other question: mathematica.stackexchange.com/questions/18733/… I think it is quite basic. –  JohnnyM Jan 30 '13 at 6:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.