3
$\begingroup$

I have a really complex function that takes a few hours to plot as a function of a parameter. Few days later I realised that I named the axes wrong. Is there an easy way to edit the AxesLabels without running the plot again? (it takes too long!!) I tried Show[%, AxesLabel-> {newname, newname2}] but it doesn't change anything...

$\endgroup$
5
$\begingroup$

Very straightforward:

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

plot /. (AxesLabel -> _) -> (AxesLabel -> {"x", "y"})
| improve this answer | |
$\endgroup$
2
$\begingroup$

You can copy and paste your graphic, add /. {"oldName1" -> "newName1", "oldName2" -> "newName2"} after it, and evaluate :

enter image description here

| improve this answer | |
$\endgroup$
1
$\begingroup$

Is this what you want?

g = Plot[Sin[x], {x, 0, 2 \[Pi]}]
Graphics[Line@Cases[g, Line[x__] :> x, \[Infinity]], PlotLabel -> "New labels", Options[g]]
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.