I wonder if it is possible to make a variable that holds info obout wanted style for Show[] function. So ewery time i want to display plots in Show[] i will insert that variable in Show[] to set options for style.
I want something like this...
OPTIONS=
AxesOrigin -> Automatic,
LabelStyle -> Directive[14, Black, Bold, Italic],
ImageSize -> {450}
Show[
ListLinePlot[data],
OPTIONS
]
The solution is simple but im green. :)
OPTIONS = {AxesOrigin -> Automatic,
LabelStyle -> Directive[14, Red, Bold, Italic], ImageSize -> {450}}
Show[ListLinePlot[{1, 2, 3, 4, 5}], OPTIONS]
Works for me.
You could apply Show with options to graphics automatically using $Post, e.g.
$Post := With[{opts = {
AxesOrigin -> Automatic,
LabelStyle -> Directive[14, Black, Bold, Italic],
ImageSize -> {250}}},
If[Head[#] === Graphics, Show[#, opts], #] &]
ListLinePlot[{1, 2, 3, 4, 5}]
Restoring $Post to default:
$Post =.
I am having trouble with the plotting functions in Mathematica.
I am attempting to plot several lists of data on a semilog plot, and then add a legend. The plot is fine:
Show[ListLogPlot[bead31, PlotStyle -> Black,
PlotMarkers -> {"\[FilledSmallSquare]"}],
ListLogPlot[bead27, PlotStyle -> Blue,
PlotMarkers -> {"\[FilledSmallSquare]"}],
ListLogPlot[A5, PlotStyle -> Red,
PlotMarkers -> {"\[FilledSmallSquare]"}],
ListLogPlot[A10, PlotStyle -> Green,
PlotMarkers -> {"\[FilledSmallSquare]"}],
ListLogPlot[A20, PlotStyle -> Gray,
PlotMarkers -> {"\[FilledSmallSquare]"}], Frame -> True,
FrameLabel -> {Subscript[t, norm], \[Kappa]}, RotateLabel -> False,
PlotRange -> Automatic]
However, any attempts to add a legend either fail, or are placed in the same scale - and since its a semilog plot, all I see is a line for a legend.
I tried to create my legend separately as a Graphics object:
but I can't figure out how to place it in the image (I was playing with Inset[] and Epilog[], but I think I'm using them wrong).
Show[Graphics[
Legend[{{Graphics[{Black, Rectangle[{-1, -1}, {1, 1}]}],
"31 beads"}, {Graphics[{Blue, Rectangle[{-1, -1}, {1, 1}]}],
"27 beads"},
{Graphics[{Red, Rectangle[{-1, -1}, {1, 1}]}], "A5"},
{Graphics[{Green, Rectangle[{-1, -1}, {1, 1}]}], "A10"},
{Graphics[{Gray, Rectangle[{-1, -1}, {1, 1}]}], "A20"}}]]]
If anyone knows of a way to add a legend properly into the first graph, any help would be much appreciated.
Perhaps:
Needs["PlotLegends`"];
ListLogPlot[{
Table[PartitionsQ[n], {n, 50}],
Table[{n, n!}, {n, 1, 20, .1}]},
PlotLegend -> {"Parts", "Fact"}, LegendPosition -> {0.8, -0.8}]
Can I apply Style to the output of "Labeled" in the below ?
Manipulate[\[Lambda],
Control#{{\[Lambda], 401,
Style[" \[Lambda]", Black, Bold, 24]},
Range[401, 570, 1],
ControlType -> Slider,
ControlPlacement -> Bottom,
Appearance -> "Labeled",
ImageSize -> 200}]
That is on the right part of the Slider :
You want the option BaseStyle (which appears in Options[Slider]). E.g.
Manipulate[
Plot[Cos[k x], {x, 0, 2 Pi}, PlotLabel -> "Cosine"],
{{k, 1, Style["x", Black, Bold, 24]}, 0, 4,
ControlType -> Slider, Appearance -> "Labeled",
ControlPlacement -> Bottom, ImageSize -> 200,
BaseStyle -> {Red, Large, Italic, FontFamily -> "Times"}}]
When looking at this I noticed that you can also use the almost undocumented ControlType -> LabeledSlider, just for something different.
It seems to be at least partially affected by LabelStyle and BaseStyle. (I'm having trouble changing the font, for some reason, but size, weight, color seem to work fine.)
Please Consider :
Manipulate[Rasterize[Graphics[{
Black, Rectangle[{0, 0}, {6, 10}],
Red, Rectangle[{0, 0}, {2, L}],
Green, Rectangle[{2, 0}, {4, M}],
Blue, Rectangle[{4, 0}, {6, S}]},
ImageSize -> {200, 270},
ImageSize -> 50]],
Control#{{L, 1, Style["L", Red, Bold, 24]}, Range[10],
ControlType -> Slider, ControlPlacement -> Top,
DefaultBaseStyle -> {Bold, 16, FontFamily -> "Helvetica"},
Appearance -> "Labeled", ImageSize -> 200},
Control#{{M, 1, Style["M", Green, Bold, 24]}, Range[10],
ControlType -> Slider, ControlPlacement -> Top,
DefaultBaseStyle -> {Bold, 16, FontFamily -> "Helvetica"},
Appearance -> "Labeled", ImageSize -> 200},
Control#{{S, 1, Style["S", Blue, Bold, 24]}, Range[10],
ControlType -> Slider, ControlPlacement -> Top,
DefaultBaseStyle -> {Bold, 16, FontFamily -> "Helvetica"},
Appearance -> "Labeled", ImageSize -> 200}]
Can I change the Background Color : Black instead of White for example.
Why is there so much empty space on the right. I have never been able to match the slider size with the width of the Manipulate being just enveloping the graphics contained?
If you set Paneled -> False in Manipulate, it shrinks the white space around the Graphics. The remaining white can be easily set to have a different background by setting it appropriately in the Graphics[...] command. You can also style the outer panel by setting the background in the BaseStyle for Manipulate. Here's a slight modification of your code:
Manipulate[
Graphics[{Black, Rectangle[{0, 0}, {6, 10}], Red,
Rectangle[{0, 0}, {2, L}], Green, Rectangle[{2, 0}, {4, M}], Blue,
Rectangle[{4, 0}, {6, S}]}, ImageSize -> {200, 300},
Background -> LightOrange],
Control#{{L, 1, Style["L", Red, Bold, 24]}, Range[10],
ControlType -> Slider, ImageSize -> Small, ControlPlacement -> Top,
DefaultBaseStyle -> {Bold, 16, FontFamily -> "Helvetica"},
Appearance -> "Labeled"},
Control#{{M, 1, Style["M", Green, Bold, 24]}, Range[10],
ControlType -> Slider, ImageSize -> Small, ControlPlacement -> Top,
DefaultBaseStyle -> {Bold, 16, FontFamily -> "Helvetica"},
Appearance -> "Labeled"},
Control#{{S, 1, Style["S", Blue, Bold, 24]}, Range[10],
ControlType -> Slider, ImageSize -> Small, ControlPlacement -> Top,
DefaultBaseStyle -> {Bold, 16, FontFamily -> "Helvetica"},
Appearance -> "Labeled"}, BaseStyle -> {Background -> LightPurple},
Paneled -> False, ImageMargins -> 10]
I hadn't noticed in my previous example that the labels had moved slightly upwards. In any case, belisarius' suggestion of using ImageSize -> Small is simpler, so I've adopted it.
I think you overused the ImageSize option:
Manipulate[
Graphics[{Black, Rectangle[{0, 0}, {6, 10}], Red,
Rectangle[{0, 0}, {2, L}], Green, Rectangle[{2, 0}, {4, M}], Blue,
Rectangle[{4, 0}, {6, S}]}, ImageSize -> {200, 300}],
Control#{{L, 1, Style["L", Red, Bold, 24]}, Range[10],
ControlType -> Slider, ImageSize -> Small, ControlPlacement -> Top,
DefaultBaseStyle -> {Bold, 16, FontFamily -> "Helvetica"},
Appearance -> "Labeled"},
Control#{{M, 1, Style["M", Green, Bold, 24]}, Range[10],
ControlType -> Slider, ImageSize -> Small, ControlPlacement -> Top,
DefaultBaseStyle -> {Bold, 16, FontFamily -> "Helvetica"},
Appearance -> "Labeled"},
Control#{{S, 1, Style["S", Blue, Bold, 24]}, Range[10],
ControlType -> Slider, ImageSize -> Small, ControlPlacement -> Top,
DefaultBaseStyle -> {Bold, 16, FontFamily -> "Helvetica"},
Appearance -> "Labeled"}]