Hi all,
I measured the growth of a group of animals roughly once a month for three months, and then let two months go by before I measured them a final time. I would like to graph the average growth over time. To do this, I will need to include a gap along the x-axis to represent the two month period when I didn't record growth. In other words, my x coordinates are January 9, 10, 11; February 11, 12, 13; March 29, 30; April 11, 12; and July 9, 10. (It took me several days to measure all the individuals in the population each time, so each "monthly" measurement actually consists of two or three days.) How do I get the program to recognize these as dates and space them accordingly along the x-axis when I construct a graph? Alternatively, how do I change the dates to Julian day? I'd rather display the actual dates with tick marks representing every day, or every 10 days or whatever, that provide the correct spacing in between the dates.
Thanks very much for your help.
Hi rrimler,
Suppose your data looks like this. Notice that the Measurement Date column is of text type, and the dates are in the form ddMonYYYY.
Right click on the empty column header next to the word "Growth" and select "New Column". Call this column Measurement Dt.
Set the format of the data to Date > ddMonYYYY
Click on Column Properties > Formula.
Click on the Edit Formula button
Double click inside the red box that says no formula and enter the following text: informat(:Measurement Date, "ddMonYYYY")
Click OK and the OK again.
Now your dataset has a numeric column that shows the date you entered in the first column.
Click on Graph > Graph Builder. Drag Measurement Dt to the X axis, and Growth to the Y axis.
hi
Proc SGPLOT supports time axis, see sample code below.
Assuming you use JMP, you need to use a continuous, date-formatted column as x-variable.
One way to convert your date strings into date-values is to use a column formula. In the jsl example below the strings are found in column "x" and the formula in column "Date" turn "x" into the corresponding date (here based on the first day of the measurement interval).
dt = New Table( "example",
Add Rows( 4 ),
New Column( "x",
Character,
Nominal,
Set Values( {"January 9, 10, 11", "February 11, 12, 13", "April 11, 12", "July 9, 10"} )
)
);
dt << New Column( "Date",
Numeric,
Continuous,
Format( "ddMonyyyy", 12 ),
Input Format( "ddMonyyyy" ),
formula( Parse Date( Words( :x, ", " )[2] || Left( :x, 3 ) || "2013", "ddMonyyyy" ) )
);
Thank you both for your replies. I am new to JMP and don't have experience with programming language. Could you walk me through these formulas? I guess my first question is (and I'm a little embarrassed to ask)-- where do I write all this stuff? Under column formula? Also, what does dt mean?
Hi rrimler,
Suppose your data looks like this. Notice that the Measurement Date column is of text type, and the dates are in the form ddMonYYYY.
Right click on the empty column header next to the word "Growth" and select "New Column". Call this column Measurement Dt.
Set the format of the data to Date > ddMonYYYY
Click on Column Properties > Formula.
Click on the Edit Formula button
Double click inside the red box that says no formula and enter the following text: informat(:Measurement Date, "ddMonYYYY")
Click OK and the OK again.
Now your dataset has a numeric column that shows the date you entered in the first column.
Click on Graph > Graph Builder. Drag Measurement Dt to the X axis, and Growth to the Y axis.
Thank you! It worked. Although when I try to make a chart instead of using graph builder, it doesn't work (it graphs the dates as categories instead of as a continuous variable.) If you have any advice about how to fix the problem in "chart", I'd appreciate it. However it works great in graph builder and that is a huge step forward for me!
Have you tried Overlay Plot?
Well, the thing is that I want to graph the mean growth including error bars, and as far as I can figure out the only way to do that is select Graph--> Chart. That dialogue box gives the option of running the "statistic" of the column. "Graph Builder" and "Overlay Plot" don't give you the option of running a statistic. Is there something I'm missing?
Yes, a column formula is added by adding the property Formula to a column, as PMroz shows nicely. In my example, the formula is just the expression within Formula(). You do not need to understand the rest of the code. The entire code was for demonstration only, and was supposed to make an example table and add a column with that particular formula. Try it! Copy the code to a JMP script window and hit run. You can copy the formula from the example table to your own data table if it seems to work the way you want.
Regarding dt, it is just a variable for for the data table.
Bruno's code is for SAS and will not work in JMP.
Thanks very much. Very helpful!