Choose Language Hide Translation Bar

## Custom function over limited x range?

I am adding a function to a graphic (e.g., fit y- by- x) via "Customize Graph": Y Function(_function_of_x_, x);

Can I limit the range of the x's that go into the function such that the function only plots over part of the range of the plot?  So if my x-axis spans from 0 to 100 I only want my function to plot say from x=  50 to 100.

1 ACCEPTED SOLUTION

Accepted Solutions

## Re: Custom function over limited x range?

You should be able to add an IF function around your "_function_of_x_". In other words:

Y Function( If( 50<x<100, _function_of_x_ ), x );

If x is not in that range, no value is produced.

3 REPLIES 3

## Re: Custom function over limited x range?

You should be able to add an IF function around your "_function_of_x_". In other words:

Y Function( If( 50<x<100, _function_of_x_ ), x );

If x is not in that range, no value is produced.

## Re: Custom function over limited x range?

Try the optional Min() and Max() arguments.

dt = Open("\$SAMPLE_DATA/Big Class.jmp");

biv = dt << Bivariate(Y(:Weight), X(:Height));

Report(biv)[Framebox(1)] << add graphics script(Y Function(3 * x - 90, x, Min(60), Max(70)));

## Re: Custom function over limited x range?

Excellent, both methods work as does

Y Function (If ( (x>50) & (x<100), function_of_x,) x);

I think I like the Min/Max solution best as the parentheses structure is easier to follow (i.e., less prone to error).

Y Function (function_of_x, x, Min(a), Max(b));
{"ft_lang_label":"__label__en","ft_lang_prob":0.77363175,"math_prob":0.9816165,"size":1189,"snap":"2019-43-2019-47","text_gpt3_token_len":340,"char_repetition_ratio":0.16624473,"word_repetition_ratio":0.29411766,"special_character_ratio":0.3313709,"punctuation_ratio":0.16853933,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.987576,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-11-15T03:29:12Z\",\"WARC-Record-ID\":\"<urn:uuid:d860f6c7-9667-4eb7-94da-cb431f2aae63>\",\"Content-Length\":\"704934\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:41a9feff-562a-4f29-9145-6001251666c3>\",\"WARC-Concurrent-To\":\"<urn:uuid:c6fc2587-b4a4-4641-8186-ae5c525baedd>\",\"WARC-IP-Address\":\"208.74.205.23\",\"WARC-Target-URI\":\"https://community.jmp.com/t5/Discussions/Custom-function-over-limited-x-range/td-p/11447\",\"WARC-Payload-Digest\":\"sha1:2KPDWFJYNEH7H2T4YNM6YS76DQIITYQT\",\"WARC-Block-Digest\":\"sha1:54A64DMAJUUYQ5XDXSC7IVV56RZQEUXQ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-47/CC-MAIN-2019-47_segments_1573496668561.61_warc_CC-MAIN-20191115015509-20191115043509-00375.warc.gz\"}"}