# [✓] 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[[1]][x], lfX[[2]][x], lfX[[3]][x], lfX[[4]][x], lfX[[5]][x], lfX[[6]][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?
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}] 
 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}]