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.

I have a BarChart used to show traffic on a network interface. I have data for every 0.5s, upto 1 min, which gives a lot of points. Is there a way to make it look less chaotic and messy?

data = Import["/Users/matek/NetworkTest/without_use_in_and_out.csv", "Table"];

maxValues = 121;
labelValues = Range[0.0, maxValues*0.5, 0.5];
Show[
    BarChart[
        data[[1 ;; maxValues]],
        ChartLegends -> Placed[{"Outbound (TX)", "Inbound (RX)"}, {{0.5, 0}}],
        ChartLabels -> {labelValues, None},
        AxesLabel -> {"Duration [s]", "Bandwidth [byte/s]"}
    ],
     ImageSize -> 600,
     BaseStyle -> {12, FontFamily -> "Helvetica"},
     PlotRange -> All
 ]

The result

enter image description here

It's evident that the ticks and ChartLabels in the resulting BarChart look awful.

share|improve this question
    
I think this issue has often been discussed before - searching previous questions will save everyone's time! –  cormullion Jul 6 '13 at 17:16
1  
You might want to also try thinking about what you want to convey with your chart before plotting it. Just because you have data streaming in at a high sample rate does not necessarily mean that you need to also present it at the same rate. For example with car traffic, it makes sense to use a unit of time that is meaningful — for instance, "# of cars per minute" for the Los Angeles freeway in California or "# of cars per day" for a country road in England. In such cases, it is prudent to re-bin your data and then plot. If not, perhaps there are better representations than a barchart –  rm -rf Jul 6 '13 at 17:58
    
@rm-rf, i am thankful for your concern, but this chart and representation is exactly what i need. –  JavaCake Jul 6 '13 at 18:07
    
@JavaCake Ok, sounds good, and looks like cormullion's answer is what you were looking for :) I'll leave the comment up, as a general observation. –  rm -rf Jul 6 '13 at 18:14
    
@rm-rf, it is exactly what i needed, the only problem i have left is the axes values in the duration-axis which has to be from [0:60] representing 1min measurement. I am not certain how this can be modified. –  JavaCake Jul 6 '13 at 18:17

1 Answer 1

up vote 4 down vote accepted

With so much data, this is the best I could manage:

BarChart[RandomInteger[300, {120, 2}],
 ChartLegends -> Placed[{"Outbound (TX)", "Inbound (RX)"}, {{0.5, 0}}],
 ChartStyle ->
  {
   Directive[Orange, EdgeForm[None]],
   Directive[Blue, EdgeForm[None]]
   },
 Frame -> True,
 BarSpacing -> 2,
 FrameLabel -> {"duration (minutes:seconds)", "bandwidth"},
 ImageSize -> 500,
 BaseStyle -> {12, FontFamily -> "Helvetica"},
 TicksStyle -> Directive[Opacity[0]],
 FrameTicks -> {
   {Automatic, None},
   {Table[{x, DateString[x, {"Minute", ":", "Second"}]}, {x, 0, 360, 
      30}] , None}},
 PlotRange -> All]

new version

share|improve this answer
    
A world of difference. Is there a chance that i can change the axes numbers of duration to [0.5:60]? –  JavaCake Jul 6 '13 at 17:16
    
@JavaCake The online reference has lots of information about Ticks and FrameTicks, and there are many existing questions here about them too. Have a play with the options. –  cormullion Jul 6 '13 at 21:16
    
lastly i have a question. When i have data points for [1:120], why does the ticks value exceed 120? –  JavaCake Jul 7 '13 at 1:58
1  
@JavaCake Perhaps the BarSpacing option should be adjusted, eg to {1,1}? –  cormullion Jul 7 '13 at 7:21

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.