2
$\begingroup$
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.

$\endgroup$
  • $\begingroup$ Inside Overlay should be {...}, but you don't even need Overlay, use Show - see my answer. $\endgroup$ – Vitaliy Kaurov Jan 30 '13 at 4:39
4
$\begingroup$
 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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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