Skip to main content

plotting - How to set the properties of a plot that's already been plotted?


Let's say I have a function that I've plotted, like so:


a = Plot[f, {x, 0, 5}, Background -> Blue]

enter image description here


So I don't really have access to the function anymore, but I want to replot it with a changed property of the graph, for example, I want to make the color of the line Black, or the background Red.


How can I do that without replotting it, or not having access to the function again?


I know I can access the original color using Option[], like:


Last@Last@Options[a, Background]


But SetOptions and SetProperty don't really work. It seems like SetOptions sets the general property for plots in general, and SetProperty isn't for this. (SetProperty[a, Background -> Red] gives the error that my plot isn't an object with properties. SetOptions[a, Background -> Red] says that my argument plot isn't a symbol or stream.)


Is there a way to do this?




Comments