[✓] Shorthand to represent multiple expressions in a Plot[] function?

Posted 1 month ago
233 Views
|
3 Replies
|
1 Total Likes
|
 There are 6 different calculated regressions on a data set. They are stored in a list labeled 'lfX'. Currently, these regressions are plotted with: Plot[{lfX[][x], lfX[][x], lfX[][x], lfX[][x], lfX[][x], lfX[][x]}, {x, 0, 30}] Is there an expression that would compact the multiple lfX[[i]] terms into something like lfX[[1..6]] or lfX[[All]]? All the plots must appear together in one chart, so a Do[] loop performing one Plot[] at a time wouldn't work.A 6 element list of regressions is trivial, but the compaction would be very useful if the small 1 dimension list were expanded into a bigger, multi-dimension matrix. Could the compaction handle a SPARSE matrix of regression expressions? Answer
3 Replies
Sort By:
Posted 1 month ago
 Of course function heads can be arguments as well! For the one dimensional case try e.g.: Plot[Evaluate[#[x] & /@ lfX], {x, 0, 30}] Answer
Posted 1 month ago
 Fantastic, Magnificent, wie, total wunderbarI had no idea how to use Evaluate[] and Map[] for functions rather than parameters. This is definitely an educational episode. Now I believe I see how to process a density-1 2D matrix with a lvlspec (3rd param) on Map. A sparse matrix will be messier, but "Wait, Wait, Don't tell me"...THANK YOU! Answer
Posted 1 month ago
 Glad you liked my answer! Just for completeness: Evaluate is only needed because Plot has the attribute HoldAll. And the more 'official' way would read: Plot[Evaluate@Through[lfX[x]], {x, 0, 30}] Answer