How to change the plotstyle in mathematica?

In summary, the individual is running a notebook in Mathematica developed by someone else. They are trying to alter the title and/or style of the graph without modifying the messy notebook. They find success in altering the title using ShowMapping, but run into issues when trying to alter the plot style. The solution provided is to use ToExpression and ToString to insert the desired plot style into the notebook.
  • #1
KFC
488
4
I am running some notebook, developed by someone else, in mathematica. One of the function defined in the notebook will show a graph. Since the notebook is kinda messy and I don't want to modify it. To alter the title and/or style of the graph, I try the following

G = ShowMapping[2.3];
Show[G, PlotLabel->"Some title"];

This works great. But when I try the same way to alter the plot style, it doesn't work

Show[G, PlotStyle->{Thick}];

Any idea to alter the plot style in this case? Thanks
 
Physics news on Phys.org
  • #2
It is not very elegant, but you can use:

ToExpression[
ToString[Insert[InputForm[G], Thickness[0.02], {{1, 1, 1, 3, 1}}]]]
 
1.

What is the default plotstyle in Mathematica?

The default plotstyle in Mathematica is the "Automatic" style, which assigns different colors and designs to different plot elements. This can be changed by using the PlotStyle option.

2.

How do I change the plotstyle in Mathematica?

To change the plotstyle in Mathematica, you can use the PlotStyle option in the Plot function. For example, Plot[x^2, {x, 0, 10}, PlotStyle -> Red] will plot the function with a red color. You can also use a list of colors or designs to create a custom plotstyle.

3.

Can I change the plotstyle for specific elements in a plot?

Yes, you can change the plotstyle for specific elements in a plot by using the Style or PlotStyle options in the specific element's function. For example, Plot[{Sin[x], Style[Cos[x], Red]}, {x, 0, 2 Pi}] will plot the sine function in the default style and the cosine function in red.

4.

How can I save my custom plotstyle in Mathematica?

You can save your custom plotstyle in Mathematica by using the StyleDefinitions option in the Style environment. This will allow you to save your custom plotstyle for future use in your Mathematica notebook.

5.

Is it possible to change the plotstyle for multiple plots at once?

Yes, it is possible to change the plotstyle for multiple plots at once by using the SetOptions function. For example, SetOptions[Plot, PlotStyle -> Blue] will change the plotstyle for all future plots in the notebook to blue.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
145
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
10K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top