2
$\begingroup$

Suppose I have data like this

ListPlot[{{1,2,3},{3,2,1}}].
I would like to change the point size of only first two points in both datasets. Although there are many examples similar to this, for example here and here, all of them talk about improving the point size on single dataset. However, in my case I have two datasets.

So, my question is how to control the pointsize of each point in multiple datasets in ListPlot

$\endgroup$

1 Answer 1

3
$\begingroup$

Post-process the output to change the styles of selected points:

ListPlot[list, PlotStyle -> {Red, Blue}, PlotRange -> {{0, 4}, {0, 4}}] /. 
 Point[x_] :> {x /. p : {_, _} :> If[p[[1]] <= 2, {PointSize[Large], Point[p]}, Point[p]]}

enter image description here

Create a new list wrappping desired data points with Style:

list2 = {{Style[1, Red, PointSize[Large]], Style[2, Red, PointSize[Large]], 3}, 
   {Style[3, Blue, PointSize[Large]], Style[2, Blue, PointSize[Large]], 1}};
ListPlot[list2, PlotStyle -> {Red, Blue},  PlotRange -> {{0, 4}, {0, 4}}]

same picture

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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