Group Abstract Group Abstract

Message Boards Message Boards

1
|
5.5K Views
|
2 Replies
|
4 Total Likes
View groups...
Share
Share this post:

How to label gridlined partitions in ListPlot?

Posted 5 years ago
POSTED BY: Richard Frost
2 Replies

Epilog->{Text[]} is probably the simplest way to label these regions.

I would also use Prologue->{Color, Rectangle[]} to make the regions even clearer but that might just be me.

POSTED BY: David Annetts
Posted 5 years ago

Expanding on David's first suggestion

epilog = MapIndexed[
  Text[Style[ToString@First@#2, Black], {Last@partitions[[1]] + 3, #1}] &, partitions[[2]]]

VSP = ListPlot[
  {cat1, cat2, cat3, cat4},
  PlotStyle -> ({#, PointSize[0.02]} &) /@ {Darker[Green], Orange, Cyan, Magenta},
  PlotRange -> {{0, Last[partitions[[1]]] + 2}, {0., 1.05*Last[partitions[[2]]]}},
  PlotRangeClipping -> False,
  Axes -> {True, True},
  AxesStyle -> {{Black, 12}, {Black, 12}},
  GridLines -> partitions,
  GridLinesStyle -> {Directive[GrayLevel[0.65], Thin], Directive[GrayLevel[0.65], Thin]},
  Ticks -> Automatic,
  AspectRatio -> 1,
  ImageSize -> {320, 320},
  PlotLegends -> {"cat1", "cat2", "cat3", "cat4"},
  PlotRangePadding -> Scaled[.02],
  Epilog -> epilog]

enter image description here

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard