I want to show plots inside a module (maybe recursive):
m = Module[{i, j}, i = 3; Plot[Sin[t], {t, 0, 1}]; j = 4]
Even
m = Module[{i, j}, i = 3; Show[Plot[Sin[t], {t, 0, 1}]]; j = 4]
not work. Why is this, and how to plot correctly?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The only reason a plot is normally displayed in Mathematica is that the
Plotfunction returns the graphics object representing the plot, and Mathematica displays the return value of whatever you run in a notebook. However, when you follow the statement with a semicolon, you prevent it from returning a value.What you can do if you need to display something from within the middle of a module is
Print[Plot[...]];. ThePrintfunction displays the value of its argument directly.