### Programming lesson and exercises - VIS 2h

87
views
0
5 months ago by
Assignment is: "Make line plots for all four data sets, superimposed in one axes object, including an appropriate legend."
I was able to do it in one line without 3 assignments to "ax" :aq1.plot(ax=aq2.plot(ax=aq3.plot(ax=aq4.plot()))), but momotor doesn't accept it. It doesn't become clear to me how to do make plots for all four in the same fashion as in one, like the example above. Thanks in advance!

1
5 months ago by
Please have a look at the instructions above the exercise and compare it to your solution (which also seems to work). In particular, these lines of code may be helpful:
ax = aq1.plot()
aq2.plot(ax=ax)​

Also, don't forget to add appropriate labels to the plot (in the legend). Good luck!
0
5 months ago by
That was what I meant by the example I didn't understand. I see the logic for only 2 plots, but best I could come up with is: ax = aq1.plot(ax=aq2.plot(ax=aq3.plot(ax=aq4.plot()))), which doesn't satisfy the "At least 4 expressions" requirement.
1
I must say that the example is indeed rather abstract. But basically, the idea is that you have 4 datasets (aq1, aq2, aq3 and aq4) where each of them contains two columns "x" and "y". In order to plot all 8 combinations (4*2) as a line chart in one plot you add the "ax" parameter to each of the 4 plots (like the example above). Otherwise you would end up with 4 separate charts.
written 5 months ago by Roy Klaasse Bos
1
Now I understand. Thank you.
written 5 months ago by Emiliyan Pavlov