MathGroup Archive 2001

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

Search the Archive

Q: How can I force ListPlot to show all data in graphics?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28542] Q: How can I force ListPlot to show all data in graphics?
  • From: Xing Jing Li <xingjing at calvin.math.vt.edu>
  • Date: Wed, 25 Apr 2001 19:21:50 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

I had some data in some lists that I want to plot. While I was 
plotting them using LIstPlot I saw some of the graphics did not show 
all data in the Y-axes. I can not figure out which options to change 
to force the graphics to show all data? I have data and functions as 
following:

---------- snip -----------------------------------------------------
tcid = "000003";
date = "Apr-24-2001";
data = {{000003, 38916, 39863}, {000003, 38472, 40401}, {000003, 43777,
         45453}, {000003, 45265, 45808}, {000003, 44934, 46693}, {000003,
         48092, 50120}, {000003, 50662, 52348}, {000003, 54775,
         55639}, {000003, 54577, 56029}, {000003, 60948, 61788}, {000003,
         63202, 64775}, {000003, 63702, 65867}, {000003, 65480,
         66462}, {000003, 66328, 67054}, {000003, 66498, 67480}, {000003,
         66364, 67610}, {000003, 66739, 69041}, {000003, 69925,
         73104}, {000003, 72516, 73308}, {000003, 73087, 73350}, {000003,
         72888, 73592}, {000003, 75081, 76004}, {000003, 74249,
         76013}, {000003, 73930, 76211}, {000003, 79932, 81828}, {0, 32400,
         32400}};
eTestLoad[data] :=
     Module[{load, startTime, sh, sm, ss, endTime, eh, em, es, time, tnum, tp,
         tl, TickFunc, index}, load = {};
       startTime = Min[Table[data[[i, 2]], {i, 1, Length[data]}]];
       endTime = Max[Table[data[[i, 3]], {i, 1, Length[data]}]];
       sh = Floor[N[(startTime/3600)]];
       sm = Floor[N[startTime/3600 - sh]*60];
       ss = Floor[N[((startTime/3600 - sh)*60 - sm)*60]];
       If[StringLength[ToString[sm]] < 2, sm = "0" <> ToString[sm]];
       If[StringLength[ToString[ss]] < 2, ss = "0" <> ToString[ss]];
       eh = Floor[N[(endTime/3600)]];
       em = Floor[N[endTime/3600 - eh]*60];
       es = Floor[N[((endTime/3600 - eh)*60 - em)*60]];
       If[StringLength[ToString[em]] < 2, em = "0" <> ToString[em]];
       If[StringLength[ToString[es]] < 2, es = "0" <> ToString[es]];
       time = startTime;
       While[time == endTime, tnum = 0;
         For[index = 1, index < Length[data], index++,
           If[time =84 data[[index, 2]] && time == data[[index, 3]], tnum++
]];
         AppendTo[load, tnum];
         time = time + 60];
       AppendTo[load, 0];
       Print[
         "Starting Time: " <> ToString[sh] <> ":" <> ToString[sm] <> ":" <>
           ToString[ss] <> "\n" <> "Ending Time: " <> ToString[eh] <> ":" <>
           ToString[em] <> ":" <> ToString[es] <> "\n" <> "Number of tests:
 " <>
            ToString[Length[data] - 1] <> "\n" <>
           "Number of tests within a minute: " <> ToString[Max[load]]];
       If[0 == Max[load] == 10, testNum = Table[i, {i, 1, Max[load]}],
         If[10 < Max[load] == 20,
           tnLabel = Flatten[Table[{"", 2i}, {i, 1, Ceiling[Max[load]/2]}]
];
           tnPos = Table[i, {i, 1, Max[load]}];
           testNum = Table[{tnPos[[i]], tnLabel[[i]]}, {i, 1, Max[load]}],
           If[20 < Max[load] == 50, testNum = Automatic,
             If[50 < Max[load] == 100,
               tnLabel =
                 Flatten[
                   Table[{"", "", "", "", 10i}, {i, 1,
                       Ceiling[Max[load]/10]}]];
               tnPos = Table[2i, {i, 1, Ceiling[Max[load]/2]}];
               testNum =
                 Table[{tnPos[[i]], tnLabel[[i]]}, {i, 1,
                     Ceiling[Max[load]/2]}], testNum = Automatic]]]];
       tp = Table[60*i, {i, 1, eh - sh + 1}];
       tl = Table[sh + i, {i, 1, eh - sh + 1}];
       TickFunc = {Table[{tp[[i]], tl[[i]]}, {i, 1, Length[tp]}], testNum}
;
       ListPlot[load, PlotJoined -> True, ImageSize -> {450, 300},
         AxesLabel -> {"Day Time", "Number of Tests"}, PlotLabel -> date,
         Ticks -> TickFunc]];
eTestLoadCourse[data, tcid_String] :=
     Module[{course, courseData, load, startTime, sh, sm, ss, endTime, eh, em,
         es, time, tnum, tp, tl, TickFunc, index, testNum},
       course = Read[StringToStream[tcid], Number];
       courseData = {};
       For[index = 1, index == Length[data], index++,
         If[data[[index, 1]] == course, AppendTo[courseData, data[[index
]]]]];
       load = {};
       startTime = Min[Table[courseData[[i, 2]], {i, 1, Length[courseData]
}]];
       endTime = Max[Table[courseData[[i, 3]], {i, 1, Length[courseData]}]
];
       sh = Floor[N[(startTime/3600)]];
       sm = Floor[N[startTime/3600 - sh]*60];
       ss = Floor[N[((startTime/3600 - sh)*60 - sm)*60]];
       If[StringLength[ToString[sm]] < 2, sm = "0" <> ToString[sm]];
       If[StringLength[ToString[ss]] < 2, ss = "0" <> ToString[ss]];
       eh = Floor[N[(endTime/3600)]];
       em = Floor[N[endTime/3600 - eh]*60];
       es = Floor[N[((endTime/3600 - eh)*60 - em)*60]];
       If[StringLength[ToString[em]] < 2, em = "0" <> ToString[em]];
       If[StringLength[ToString[es]] < 2, es = "0" <> ToString[es]];
       time = startTime - Mod[startTime, sh*3600];
       While[time == endTime, tnum = 0;
         For[index = 1, index == Length[courseData], index++,
           If[time =84 courseData[[index, 2]] && time == courseData[[index,
 3]],
             tnum++]];
         AppendTo[load, tnum];
         time = time + 30];
       AppendTo[load, 0];
       Print[
         "Test Configuration ID: " <> tcid <> "\n" <> "Starting Time: " <>
           ToString[sh] <> ":" <> ToString[sm] <> ":" <> ToString[ss] <>
 "\n" <>
            "Ending Time: " <> ToString[eh] <> ":" <> ToString[em] <> ":" <>
           ToString[es] <> "\n" <> "Number of tests: " <>
           ToString[Length[courseData]] <> "\n" <>
           "Number of tests within a minute: " <> ToString[Max[load]]];
       If[0 == Max[load] == 10, testNum = Table[i, {i, 1, Max[load]}],
         If[10 < Max[load] == 20,
           tnLabel = Flatten[Table[{"", 2i}, {i, 1, Ceiling[Max[load]/2]}]
];
           tnPos = Table[i, {i, 1, Max[load]}];
           testNum = Table[{tnPos[[i]], tnLabel[[i]]}, {i, 1, Max[load]}],
           If[20 < Max[load] == 50, testNum = Automatic,
             If[50 < Max[load] == 100,
               tnLabel =
                 Flatten[
                   Table[{"", "", "", "", 10i}, {i, 1,
                       Ceiling[Max[load]/10]}]];
               tnPos = Table[2i, {i, 1, Ceiling[Max[load]/2]}];
               testNum =
                 Table[{tnPos[[i]], tnLabel[[i]]}, {i, 1,
                     Ceiling[Max[load]/2]}], testNum = Automatic]]]];
       tp = Table[60*i, {i, 1, 2*(eh - sh + 1)}];
       tl = Flatten[Table[{"", sh + i}, {i, 1, eh - sh + 1}]];
       TickFunc = {Table[{tp[[i]], tl[[i]]}, {i, 1, Length[tp]}], testNum}
;
       ListPlot[load, PlotJoined -> True, ImageSize -> {450, 300},
         AxesLabel -> {"Day Time", "Number of Tests"},
         PlotLabel -> "TCID:"; <> tcid <> "  Date:" <> date,
         Ticks -> TickFunc]];
eTestLoad[data];
eTestLoadCourse[data, tcid];

-------- snip ---------------------------------------------

Run the above code I can see a full closed graphics from the second 
function call but not the from the first one. How can I make the full 
graphics show from the first function?

Another question is that how can I change the ticks to make major 
ticks bigger than the minors. Specifically I want to make the ticks 
in second function at half hour smaller than the ones at full hour. 
How can I do that?

Thanks in advance for all your help,

Jing
-- 
******************************************************************
Xing Jing Li                          email: xingjing at math.vt.edu
Programmer                           Office: (540)231-2216
Department of Mathematics               Fax: (540)231-5960
                      


  • Prev by Date: Re: how to be as efficient as Mean[list] - efficient summing of function applied to list
  • Next by Date: Problem with selecting graphics
  • Previous by thread: Re: Getting stylized text with a palette button
  • Next by thread: Problem with selecting graphics