Tag Info

Hot answers tagged

9

Two work-arounds: (1) Use TickLabels BarLegend[{"Rainbow", {-0.015, 0.015}}, ImageSize->300, Charting`TickLabels -> (Style[NumberForm[#, {Infinity, 3}],Bold,Black,12] & /@ Range[-.015, .015, .005])] (2) Use LabelingFunction: BarLegend[{"Rainbow", {-0.015, 0.015}}, ImageSize->300, LabelingFunction -> (Style[NumberForm[#, ...


8

After a rather long debugging session in our chat we could determine the reason of the problem and come up with a workaround. In short, we first tried whether the issue appears for the most basic Graphics[], which it didn't. As it turned out the gray background is introduced by using PlotLegends as in the example above. We went further by comparing ...


4

EDIT As Mr Wizard observed my original code is not self contained. For reasons that I fail to understand this seemed to work with what seemed a fresh session. The code works if you move the gauge marker but to post correct code (I leave the animated gif as it is the same outcome): DynamicModule[{s = 0}, Framed[Row[{VerticalGauge[Dynamic[s], {0, 1}, ...


4

This bug was fixed in version 10. Plot[{Sin[x], Cos[x]}, {x, 0, 5}, BaseStyle -> AbsoluteDashing[{5, 6}], PlotStyle -> {Orange, Brown}, PlotLegends -> LineLegend["Expressions"]] However, AbsoluteThickness does not seem to propagate as a BaseStyle. This might have something to do with the new plot themes. Plot[{Sin[x], Cos[x]}, {x, 0, 5}, ...


3

This works automatically in Mathematica 10. Using your original input: line = {{0, 2.15}, {0.05, 2.03}, {0.1, 1.94}, {0.2, 1.8}, {0.3, 1.68}, {0.4, 1.58}}; points = {{0.1009`, 1.206`}, {0.19455`, 1.4569`}, {0.3597`, 1.2315`}}; ListPlot[{line, points}, PlotRange -> {0, 2.5}, PlotLegends -> {"line", "points"}, PlotMarkers -> {" ", ...


3

ListLinePlot[Table[Accumulate[RandomReal[{-1, 1}, 250]], {10}], PlotStyle -> (Hue[#] & /@ Range[0., .9, .1]), ImageSize -> 500, PlotLegends -> BarLegend[{Hue, {0, 10}}, 10, ColorFunctionScaling -> True]]


3

Plot[{x, x^2, x^3}, {x, 0, 3}, Frame -> True, PlotLegends -> Placed[LineLegend[ColorData[1] /@ Range[3], {"long text 1", "long text 2", "long text 3"}, LegendLayout -> "Column"], Above]]


3

Plot[{x, x^2, x^3}, {x, 0, 3}, Frame -> True, PlotLegends -> Placed[SwatchLegend[{"long text 1", "long text 2", "long text 3"}, LegendMarkers -> "Line", LegendLayout -> "Column"], {{0.5, 1.3}, {0.5, 1}}]]


3

line = {{0, 2.15}, {0.05, 2.03}, {0.1, 1.94}, {0.2, 1.8}, {0.3, 1.68}, {0.4, 1.58}}; points = {{0.1009`, 1.206`}, {0.19455`, 1.4569`}, {0.3597`, 1.2315`}}; With markers on line ListPlot[{line, points}, PlotRange -> {0, 2.5}, PlotLegends -> {"line", "points"}, PlotMarkers -> {{■, 12}, {●, 12}}, Joined -> {True, False}] Without ...


3

Additional alternatives to mix different legends: lg1 = SwatchLegend[{Red}, {"sin"}]; lg2 = LineLegend[{Blue}, {"cos"}]; lg3 = PointLegend[{Green}, {"sinc"}, LegendMarkers -> "\[FilledCircle]"]; Plot[{Sin[x], Cos[x], 2 Sinc[x]}, {x, -2 Pi, 2 Pi}, PlotStyle -> Thread[{Thick, {Red, Blue, Green}}], ImageSize -> 400, PlotLegends -> ...


2

Here is the example of how to make this with Epilog: (* These are the list and a function to fit it that will be plotted *) lst = Transpose[{RandomReal[{0, 3}, 30], RandomReal[{-0.03, 0.03}, 30]}] /. {x_, y_} -> {x, x*Exp[-x] + y}; ft = FindFit[lst, a + b*x*Exp[-c*x], {a, b, c}, x]; (* End ofg the list and fitting function *) (* The show ...


2

You could combine all your data into list plot and then use PlotLegends. If you wish.need to use Show you could use Legended. Here is an example with toy data: data1 = MapThread[ 1/(1 + Exp[- #1 + #2]) &, {Range[0, 20, 1], RandomReal[{0, 1}, 21]}]; data2 = MapThread[ 1/(1 + Exp[- 1.4 #1 + #2]) &, {Range[0, 20, 1], RandomReal[{0, 1}, ...


1

The problem is with your ImageSize->Full option. Try leaving it out or specify your ImageSize to a certain size (e.g. 500) instead of Full. otherOptions = {MaxPlotPoints -> 1000, ColorFunction -> "ThermometerColors", PlotLabel -> Style["Array Plot of Raw Data", 11, Bold, Black], PlotRangePadding -> 0., ImageSize -> Full, ...


1

For illustrative purpose (please also search site and documentation): toy = Table[{j, j^2 + RandomReal[{-3, 3}]}, {j, -4, 4, 0.1}]; mod = LinearModelFit[toy, {1, x, x^2}, x]; lp = ListPlot[toy, PlotStyle -> Red]; modp = Plot[mod[x], {x, -4, 4}, PlotStyle -> Blue]; lgnd = Framed[ Column[{PointLegend[{Red}, {"data"}], LineLegend[{Blue}, ...


1

I don't have your actual data to work with them but I think that this is what you want S0 = ListLinePlot[{dataamountofruns1, dataamountofruns2, dataamountofruns3}, Joined -> False, PlotStyle -> {Blue, Green, Orange}, Axes -> False, AxesStyle -> Black, FrameLabel -> {"Generation","Population"}, Frame -> True, FrameTicks -> All, ...


1

Perhaps this contrived example will be helpful: lleg = LineLegend[{Red}, {"sin"}]; sleg = SwatchLegend[{Blue}, {"cos"}]; Legended[Show[Plot[Sin[x], {x, 0, 2 Pi}, PlotStyle -> Red], ListPlot[Table[{j, Cos[j]}, {j, 0 , 2 Pi, 0.11}]]], Framed[Column[{lleg, sleg}], RoundingRadius -> 10, Background -> LightBlue]]


1

The legends need to go into a Column[] ... PlotLegends -> Column[{LineLegend[{Blue}, {"First"},], SwatchLegend[{Opacity[0.3, Blue]}, {"Second"}, ]}]


1

This is a "cheat", if I interpret the desired visualization correctly. bc = BarChart[{{12, 14, 16, 18}, {8, 10, 11, 12}, {2, 5, 6, 7}, {1, 3, 5, 7}}, ChartStyle -> {Green, Blue, Red, Orange}] p = Plot[, {x, 0, 5}, PlotRange -> {0, 20}, PlotLegends -> MapThread[ Placed[PointLegend[{#1}, {TextCell[ Style[#2, FontColor ...


1

It doesn't pick up the line 'cause you telling not to do ... PlotMarkers -> {" ", ■} with the " " you just typeset an emty space. Try ListPlot[{line, points}, PlotRange -> {0, 2.5}, PlotLegends -> {"line", "points"}, PlotMarkers -> {●, ■}, Joined -> {True, False}] check this.


1

In earlier versions (and also v.9), to use a legend with Show use ShowLegend :- dataamountofruns1 = Table[4 Log[x], {x, 1, 700}]; dataamountofruns2 = Table[3 Log[x], {x, 1, 700}]; dataamountofruns3 = Table[2 Log[x], {x, 1, 700}]; Needs["PlotLegends`"]; ShowLegend[Show[ ListPlot[dataamountofruns1, PlotStyle -> Blue], ListPlot[dataamountofruns2, ...



Only top voted, non community-wiki answers of a minimum length are eligible