MathGroup Archive 2003

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

Search the Archive

RE: Multiple graphs with same x-axis but separate y-axis and space

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40977] RE: [mg40944] Multiple graphs with same x-axis but separate y-axis and space
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sat, 26 Apr 2003 03:26:26 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I made a fairly nice plot example of this using DrawGraphics. I will send
the notebook that made the plot to anybody who has DrawGraphics and wants to
see it, and I will send a .gif image to anyone else who wants to see the
image.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/



From: Nigel King [mailto:king at dircon.co.uk]
To: mathgroup at smc.vnet.net


Dear MathGroup,

Imagine graphs of different sets of data vs time. Say these were wind
speed, wind direction, temperature and humidity. Plotting these on one
graph overlayed upon one another is confusing. What would be nice is a
way to plot them on one graph but with each function in their own
vertical space with their own y-axis but all using the same time x-axis.
Has anybody achieved this?

Below is an illustration of the desired result.
     _________________________________________________________
   50|  |        |        |        |        |        |       |
     |  |        |        |        |        |        |       |
wind |  |        |        |        |        |        |       |
     |  |        |        |        |        |        |       |
    0|  |        |        |        |        |        |       |
     _________________________________________________________
   40|  |        |        |        |        |        |       |
     |  |        |        |        |        |        |       |
temp |  |        |        |        |        |        |       |
     |  |        |        |        |        |        |       |
  -10|  |        |        |        |        |        |       |
     _________________________________________________________
  100|  |        |        |        |        |        |       |
     |  |        |        |        |        |        |       |
humid|  |        |        |        |        |        |       |
     |  |        |        |        |        |        |       |
   20|  |        |        |        |        |        |       |
______________________________________________________________
        |        |        |        |        |        |       |
     23Apr03   12:00   24Apr03   12:00   24Apr03   12:00  24Apr03

I submit the functions below which do a tolerable job of creating the x-
axis labels and grid.
I would really like some simle functions to dived and conquer the y-axis
problem.

TIA
Nigel King

DateScale[minimum_, maximum_, n_Integer:8] :=
    Map[DateTicks,DateGrid[minimum, maximum, n]];

DateGrid[minimum_, maximum_, n_Integer:8] :=
    Module[{w, r = maximum - minimum, spacing},
	spacing = r/n;
w = First[Select[Join[{1, 2, 5, 10, 15, 20, 30}*60, {1, 2, 3,
4, 6, 12}*60*60, {1, 2, 3, 7, 14, 31, 62, 92, 123,
184, 366, 2 366,3 366, 4 366, 5 366}*24*60*60],
			(spacing <= #) &]];
	If[w < 28*24*60*60, Range[Round[minimum/w]*w,maximum, w],
	d1 = {};
	For[i = iMonth[minimum, w], i < maximum, i = iMonth[i + w],
          AppendTo[d1, i]]]];

DateString[x_] :=
	Module[{d = ToDate[Evaluate[Round[x]]]},
		If[d[[4]] === 0 && d[[5]] === 0,

ToString[d[[3]]] <> "" <>StringTake[
"JanFebMarAprMayJunJulAugSepOctNovDec",
			{d[[2]]*3 - 2, d[[2]]*3}] <>
"" <> StringTake[ToString[d[[1]]], -2],
        ToString[d[[4]]] <> ":"
<> StringTake["0" <> ToString[d[[5]]], -2]]];
 DateTicks[x_] := {x,
DateString[x]};
 iMonth[x_] :=
    Module[{y = ToDate[Round[x]]},

y = FromDate[{y[[1]], y[[2]], 1, 0, 0, 0}]];
 iMonth[x_, w_] := Module[{
y = ToDate[Round[x]], w1 = Round[w/24/60/60/30]},
	y = FromDate[{y[[1]],
Round[y[[2]]/w1]w1 + 1, 1, 0, 0, 0}]];



  • Prev by Date: RE: Something strange with Show.
  • Next by Date: Re: Elliptic Curves and Mathematica
  • Previous by thread: Multiple graphs with same x-axis but separate y-axis and space
  • Next by thread: put together all graphs