3
$\begingroup$

I have a complex plot of which’s calculation took quite a long time. Is it possible afterwards to modify certain attributes of the plot without the necessity to calculate it again?

Example:

p = Plot[Sin[x], {x, 0, 2 Pi}];

Question: How can I access and modify directly p to e.g. set PlotLabel of p, or some other attributes?

$\endgroup$
  • 1
    $\begingroup$ the following seems to work (to my surprise!) p[[2]]//FullForm displays the Plot options used for plotting; you could pick an option that is already present and replace it with something like eg p/.(DisplayFunction->Identity)->Sequence[DisplayFunction->Identity,PlotLabel->"just arrived!"]; if the option you want to change is already present then you can replace that directly eg p/.(PlotLabel->__)->(PlotLabel->"just arrived!") $\endgroup$ – user42582 Nov 23 '17 at 10:07
  • $\begingroup$ @user42582: thanks ... also this works: p /. (DisplayFunction -> Identity) -> Sequence[PlotLabel -> "j‌​ust arrived!"] ... please put your comment as an answer. $\endgroup$ – mrz Nov 23 '17 at 10:36
  • $\begingroup$ @mrz Show[p, PlotLabel -> "whatever"] $\endgroup$ – Kuba Nov 23 '17 at 10:36
  • $\begingroup$ @mrz you wouldn't want to do that because you would effectively not include the DisplayFunction->Identity option which is not what you want to do $\endgroup$ – user42582 Nov 23 '17 at 11:01
  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$ – Kuba Nov 23 '17 at 12:03

Browse other questions tagged or ask your own question.