Tag Info

New answers tagged

1

Use the option LineLegend with sub-option LegendMarkers as the setting for PlotLegends: NN = 15; data = {Table[{(n - 1/2)*1/1000, 0}, {n, 1, NN}], Transpose@{Table[(n - 1/2)*1/1000, {n, 1, NN}], -Sort[-RandomInteger[10, NN]]}}; ListPlot[data, Joined -> True, PlotMarkers -> Automatic, PlotStyle -> {{Blue, Thin}, {Blue, Thin}}, PlotRange ...


2

1. I doubt there is an easier way than what you did. One can wrap it up in a function: ClearAll[markerMesh]; SetAttributes[markerMesh, HoldAll]; markerMesh[Plot[fns_List, {x_, x1_, x2_}, opts : OptionsPattern[]], markerOpts : OptionsPattern[]] := Show[ Plot[fns, {x, x1, x2}, Evaluate@FilterRules[{opts}, Except[{Mesh}]]], ListPlot[MapThread[ ...


4

Most of the desired plot can be achieved using only options Mesh and MeshFunctions. Plot[{Sin[x], Cos[x]}, {x, -0.01, 4.01}, MeshFunctions -> {If[Abs[Sin[#] - #2] < .001 && Abs[Cos[#] - #2] > .0001, Sin[# 2 Pi] + 1, Sin[# Pi] - 1] &}, Mesh -> {{{1, Directive[Red, PointSize[0.02]]}, {-1, ...


4

You can change the legend using the LegendMarkers option to an explicitly constructed LineLegend. The points are a bit of a hack, but you can always explicitly create them as an Epilog collection of points. I couldn't work out which colour scheme is the default in version 10, so I used the first indexed colour scheme, which replicates the default styles used ...


1

LegendMarkerSize is the key as Virgil said. Besides that, the legend system is smart enough to combine legends if they are placed at the same position. So, instead of specifying one legend at {0.8, 0.3} and one at {0.8, 0.2}, put them both at {0.8, 0.2} and then they will be combined automatically reasonably. p1 = ListPlot[{list1, list2}, PlotRange -> ...


2

LegendMarkerSize is the key. As an alternative to configuring the size manually, we can simply redraw a new combined legend with a single new legend using a single LegendMarkerSize. Although kguler's answer shows how to do this, I would like to point out here that it is possible to do this only using the two plots p1 and p2 supplied originally. First note ...


3

Update: A much easier way is to use single LineLegend with point and line elements: mixedlegend = LineLegend[{White, White, Blue, Black}, {"Experimental data 1", "Experimental data 2", "Theoretical line for data 1", "Theoretical line for data 2"}, LegendMarkers -> {Graphics[{Red, Disk[]}], Graphics[{Orange, Disk[]}], None, None}] ...


1

ListLogLinearPlot[data1, Joined -> True, PlotStyle -> Dotted, PlotLegends -> LineLegend[{"data"}]]


1

This has been fixed in 10.1 code ListPlot[Table[{j, i}, {i, Range[20]}, {j, Range[3]}], Joined -> True, PlotMarkers -> {Automatic, Large}, PlotLegends -> Range[20]]


0

I modified the answer by belisarius for listdensityplot and moreover I rescaled the barlegend such that the desired result was obtained: All the data outside the desired range gets the same "bottom" color. data = Table[Sin[u + v^2], {u, 0, 3, .05}, {v, 0, 3, .05}]; zrange = {.5, 1.0} ListDensityPlot[data, ColorFunction -> ColorData[{"SolarColors", ...


1

DensityPlot[Sin[x^2 + y], {x, 0, Pi}, {y, 0, Pi}, ColorFunction -> (ColorData["TemperatureMap", Rescale[#, {0, 2}, {0, 1}]] &), PlotLegends -> BarLegend[{"TemperatureMap", {0, 2}}, 10]]


4

Here is a more formatted and styled legend: Legended[ grp, SwatchLegend[{Green, Blue, Red, Brown, Black, Orange}, {"A ", "B ", "C ", "D ", "E ", "F "}, LegendMarkerSize -> {{30, 30}}, LegendMarkers -> (Graphics[Text[Style[#, 20, Bold]], ImageSize -> 15] & /@ Range[6]), LegendFunction -> "Panel"]] it looks like this: instead of the ...


2

Easy as this... Legended[grp, Grid[{Range @ 6, {"this", "asd", "asdf", "blabla", "af", "asd"}} // Transpose]] grp is your Graphics, obviously. You may fiddle around with Grid at your will for formatting....hi,hi,hi



Top 50 recent answers are included