Mathematica Use a rule variable for AxesStyle->20

  • Thread starter Thread starter Swamp Thing
  • Start date Start date
  • Tags Tags
    Variable
AI Thread Summary
To set the AxesStyle in a plot using a variable rule, it is essential to ensure that the variable is evaluated correctly. The error message indicates that the variable "axs" is not being recognized as a valid option due to the HoldAll attribute of the Plot function, which prevents the evaluation of its arguments. To resolve this issue, the Evaluate function should be used to force the evaluation of "axs" before it is passed to Plot. This allows the AxesStyle to be set correctly without encountering the error regarding expected options.
Swamp Thing
Insights Author
Messages
1,028
Reaction score
767
TL;DR Summary
Why doesn't this work:
axs = AxesStyle -> 20;
Plot [ Sin[x], {x,0,10}, axs ]
How to use a variable rule, e.g. axs = AxesStyle->20 , to set the AxesStyle ? The code in the summary gives this error:

"Options expected (instead of axs) beyond position 2 in Plot[x x,{x,0,10}, axs]. An option must be a rule or a list of rules."

Isn't that "axs" a legit rule?
 
Last edited:
Physics news on Phys.org
Plot has the attribute HoldAll so axs is left unevaluated. You need to use Evaluate[axs] to force evaluation despite the HoldAll
 
  • Informative
Likes Swamp Thing

Similar threads

Replies
5
Views
2K
Replies
1
Views
2K
Replies
8
Views
3K
Replies
6
Views
4K
Replies
22
Views
3K
Back
Top