8
$\begingroup$

I have large data consisting of values obtained by sweeping across three parameters (e, w, and f). I want to plot all this data on one graph using different shapes for e (e.g., circle, triangle, square, and diamond), different colors for w, and a letter inside the shape for f. So far I have

Jw1e1 = {{16, 832}, {32, 3150}, {64, 12237}, {128, 48212}};
J1 = ListLogPlot[Jw1e1, PlotMarkers -> (Style[Framed[H], Red]), 
  Frame -> True]
Jw1e3 = {{16, 826}, {32, 3127}, {64, 12145}, {128, 47851}};
J3 = ListLogPlot[Jw1e1, PlotMarkers -> (Style[Framed[H], Blue]), 
  Frame -> True]
Show[J1, J3]

I cannot figure out how have a square, circle, etc. appear as the specified shape by changing Framed[H]. If I replace Framed[H] by Circle[], Circle[{0, 0}] appears on my plots and replacing by Circle[H], Circle[H] appears.

$\endgroup$
10
$\begingroup$

Update: Using some of the ideas in the linked Q/As, you can get a finer customization of your markers:

Jw1e1 = {{16, 832}, {32, 3150}, {64, 12237}, {128, 48212}};
Jw1e3 = {{16, 826}, {32, 3127}, {64, 12145}, {128, 47851}};
(* second list modified so that the two plots do not overlap*)
lists = {Jw1e1, {1, .1} # & /@ Jw1e3} ;
markerDisk = Graphics[{Opacity[.6],
 Dynamic@EdgeForm[{clr = CurrentValue["Color"], Thick}],
 Dynamic[FaceForm[{Opacity[1], Lighter[clr, .3]}]], Disk[], Opacity[1],
 Style[Text[#], White, Bold, 16]}, ImagePadding -> Scaled[.01]] &;

ListLogPlot[lists, Joined -> True, ImageSize -> 500,
 PlotRangeClipping -> False, ImagePadding -> 35,
 PlotMarkers :> ({markerDisk[#], 0.15} & /@ {A, B})]]

enter image description here


From Docs > PlotMarkers > Details:

enter image description here

mrkr = Graphics[{Red, Thick, Circle[], Style[Text[H], Red, Bold, 24]}]; 
ListLogPlot[Jw1e1, PlotMarkers -> {mrkr, .2}, Frame -> True]

enter image description here

Related Q/As

Why doesn' t PlotMarker option None return no PlotMarkers?

ListPlot with plotmarkers determined by point

$\endgroup$
  • $\begingroup$ Quick question. Why does the command markerDisk2 = Graphics[{Opacity[.5], Dynamic@EdgeForm[{clr = CurrentValue["Color"], Thick}], Dynamic[FaceForm@Lighter@clr], Rectangle[], Opacity[1], Style[Text[A], Black, Bold, 18]}, ImagePadding -> Scaled[.2]] &; ListLogPlot[Je1w1H, Joined -> True, ImageSize -> 500, PlotRangeClipping -> False, ImagePadding -> 35, PlotMarkers :> ({markerDisk2[#], 0.15} & /@ {A, B})] have the letters offset from the Rectangle? $\endgroup$ – namu Feb 3 '13 at 6:40
6
$\begingroup$

You were nearly there:

Jw1e1 = {{16, 832}, {32, 3150}, {64, 12237}, {128, 48212}};

J1 = ListLogPlot[Jw1e1, 

  PlotMarkers -> (Style[Framed[H, RoundingRadius -> 20], Red]), 

  Frame -> True]

The nice thing here is that you can play around with RoundingRadius and that longer/larger text markers will be properly framed as well.

J1 = ListLogPlot[Jw1e1, 

  PlotMarkers -> (Style[

     Framed["Longer than strictly necessary", RoundingRadius -> 20], 

     Red]), Frame -> True]

Driving it home:

J1 = ListLogPlot[Jw1e1, 

  PlotMarkers -> 

   Framed[Style["Larger than \n strictly necessary", Large, Red], 

    RoundingRadius -> 20], Frame -> True]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Interesting these RoundingRadius property. 1+ $\endgroup$ – Murta Jan 31 '13 at 23:37
  • $\begingroup$ Unfortunately with this method plot markers will be positioned imprecisely, so the approach suggested by @kglr is preferred. $\endgroup$ – Alexey Popkov Sep 30 '17 at 2:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.