1
$\begingroup$

I found this answer below however I have a 2D data set.

ListPlot with plotmarkers determined by point

The first plot answer by KGLR (answered Jun 24 '12 at 14:40) looks suitable. However, I've a two dimension data set

data = {{1.704, 0.931508}, {3.6, 2.7256}, {4.568, 3.89257}, {6.016, 5.77674}, {5.92, 7.05187}, {6.0904, 7.05187}, {6.72, 6.23791}, {7.52, 6.23791}, {6.96, 7.16941}, {6.96, 7.16941}, {7.12, 7.16941}, {6.56, 7.16941}, {6.72, 7.16941}}

This list represents x-axis versus y-axis. I require to adapt the solution to plot the data. I would prefer a different colour scheme to HUE, and also add legend, with x and y axis labels

$\endgroup$
1
$\begingroup$

If you don't mind the clutter you can modify the linked answer as follows:

colors = ColorData[1, "ColorList"][[;; Length@data]]; 
labels = Range@Length@data;
legendlabels = "Case " <> ToString@# & /@ labels;

ListPlot[List /@ data, Frame -> True,  ImageSize -> 700,
 PlotMarkers -> (Style[Framed[#], "Panel", #2, Background -> Opacity[.1, #2]] & @@@ 
   Transpose[{labels, colors}]), 
 PlotLegends -> SwatchLegend[legendlabels, LegendLayout -> Grid], 
 FrameLabel -> {"X", "Y"}, PlotRange -> All, PlotRangeClipping -> False]

Mathematica graphics

$\endgroup$
  • $\begingroup$ .. perhaps new-in -version-10 Callout may be more useful for displaying your data. $\endgroup$ – kglr Mar 22 '17 at 12:54
  • $\begingroup$ Perhaps to reduce the clutter, you could you define a different shape marker for each point? Thanks again! $\endgroup$ – SPIL Mar 22 '17 at 15:15
  • $\begingroup$ Hi KGLR, Thanks for you efforts. My graph comes out different to yours, with the numbered boxes far larger and overlapping. How do I rescale? Also on the legend, how do I switch to list string "Case 1", "Case 2", "Case 3"......etc instead of the numerical values of the point. $\endgroup$ – SPIL Mar 22 '17 at 15:18
  • $\begingroup$ @SPIL, thank you for the accept. Please see the update regarding legend labels. $\endgroup$ – kglr Mar 22 '17 at 17:53

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.