# Multiple plots using dynamics

I am studying Dynamic and DynamicModule, and I have tried to make a simple plot of a family of real functions. The number of functions should be a dynamic variable controlled by a slider. So I have tried something like this

{Slider[Dynamic[z], {1, 4, 1}], Plot[Evaluate[Dynamic[Table[Sin[i*t], {i, 1, z}]]], {t, 0, 2 Pi}]}


In this case variable t is highlighted in red and the output is empty. But if you do it outside of Plot[], then you get a correct list of functions

{Slider[Dynamic[z], {1, 4, 1}], Evaluate[Dynamic[Table[Sin[i*t], {i, 1, z}]]]}


So, how one plots this kind of things?

The Plot has to be within Dynamic, as the Plot needs to be updated when z is changed. You can't just update the content of Plot without making a new Plot.

{Slider[Dynamic[z], {1, 4, 1}],
Dynamic@Plot[Evaluate[Table[Sin[i*t], {i, 1, z}]], {t, 0, 2 Pi}]}


The syntax highlighting is due to the Head of your command inside Plot being Dynamic

Evaluate[Dynamic[Table[Sin[i*t], {i, 1, z}]]] // Head

Dynamic

• right, thank you)
– Ivan
Aug 16, 2014 at 12:01
{"ft_lang_label":"__label__en","ft_lang_prob":0.7811298,"math_prob":0.8934075,"size":588,"snap":"2022-40-2023-06","text_gpt3_token_len":174,"char_repetition_ratio":0.11815068,"word_repetition_ratio":0.0,"special_character_ratio":0.2993197,"punctuation_ratio":0.17391305,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99498284,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-09-26T08:49:15Z\",\"WARC-Record-ID\":\"<urn:uuid:d888ab52-730c-45e7-8e6b-9c5204884c3f>\",\"Content-Length\":\"226495\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:6ec497fe-af01-41e5-b35f-dfcbdfc1c441>\",\"WARC-Concurrent-To\":\"<urn:uuid:f2c66d7d-bab7-4049-86c1-7a6d88b894e2>\",\"WARC-IP-Address\":\"151.101.129.69\",\"WARC-Target-URI\":\"https://mathematica.stackexchange.com/questions/57481/multiple-plots-using-dynamics\",\"WARC-Payload-Digest\":\"sha1:TODYGXWNKFHYKO2VZA7CBW42WUIGPFXK\",\"WARC-Block-Digest\":\"sha1:LAD43OAYFBIHXRL6BSCX6FG24QAFKC7Y\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-40/CC-MAIN-2022-40_segments_1664030334855.91_warc_CC-MAIN-20220926082131-20220926112131-00612.warc.gz\"}"}