Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p = Plot[Sin[x], {x, 0, 1}]
- Show[p, (* Option?? *)]
- p = Plot[Sin[x], {x, 0, 1}]
- col = Cases[p, _Hue, Infinity][[1]];
- Show[p /. col -> Red]
- myplot = Plot[{Cos[x], Sin[x]}, {x, 0, 2 Pi},
- PlotStyle -> {{Red, Dashing[None]}, {Green, Dashing[None]}}]
- newstyles = Directive @@@ {
- {Green, Thickness[.02], Dashing[Tiny]},
- {Thickness[Large], Red}
- };
- i = 1;
- MapAt[# /. {__, ln__Line} :> {newstyles[[i++]], ln} &, myplot, {1, 1}]
- restylePlot[plot_Graphics, styles_List, op : OptionsPattern[Graphics]] :=
- Module[{x = styles}, Show[
- MapAt[# /. {__, ln__Line} :> {Directive @ Last[x = RotateLeft@x], ln} &, plot, 1],
- op
- ]]
- myplot2 = Plot[Evaluate[Table[BesselJ[n, x], {n, 4}]], {x, 0, 10}, Filling -> Axis]
- restylePlot[myplot2,
- {
- {Green, Thickness[.02], Dashing[Tiny]},
- {Thickness[Large], Red},
- Blue
- },
- Axes -> False,
- Frame -> True,
- FrameStyle -> Directive[20, FontColor -> Orange]
- ]
- restylePlot2[p_, op : OptionsPattern[Plot]] :=
- ListPlot[Cases[Normal@p, Line[x__] :> x, ∞], op, Options[p]]
- restylePlot2[myplot2,
- PlotStyle -> {{Green, Thick, Dashed}, {Thickness[Large], Red}, Blue},
- Filling -> Axis, FrameStyle -> Directive[20, FontColor -> Orange],
- PlotLegends -> LineLegend[{"1", "2", "3", "4"}]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement