8
$\begingroup$

In my case, I need to use the following data file

Let's plot the basins

m = ReadList["LGs.dat", Number, RecordLists -> True];
getColor[m_List, i_Integer] := 
  Module[{s = m[[i, 3]]}, 
  Which[s == 4, Darker[Green], s == 6, Blue, s == 8, Cyan, s == 10, 
  Orange, s == 12, Purple, s == 14, Red, True, Black]];
data = Table[{PointSize[0.005], getColor[m, i], 
Point[{m[[i, 1]], m[[i, 2]]}]}, {i, 1, Length[m]}];
S0 = Graphics[data];
P0 = Show[{S0}, Axes -> False, Frame -> True, 
  FrameLabel -> {"α", "δ"}, FrameStyle -> Thick, 
  RotateLabel -> False, 
  LabelStyle -> Directive[FontFamily -> "Helvetica", 22], 
  AspectRatio -> 1, PlotRange -> All, PlotRangeClipping -> True, 
  PlotRangePadding -> 0, ImageSize -> 500]

enter image description here

My question is: how can I draw a black solid line, thus highlighting the basin boundaries?

EDIT

Following @yarchik 's suggestion I get the following output

enter image description here

As you can see, the boundary lines are very ugly. Is there a way to obtain nice, smooth solid lines inicating the basin boundaries?

$\endgroup$
0

1 Answer 1

5
$\begingroup$

Out-of-box solution (left figure):

ListContourPlot[m[[All, 1 ;; 3]], 
 ContourStyle -> Directive[Black, Dashed], 
 ColorFunction -> "Rainbow",
 ImageSize -> Small, 
 FrameLabel -> {"α", "δ"}, 
 PlotTheme -> "Monochrome"]

enter image description hereenter image description here

This is pure esthetics consideration that the contours are dashed, the image is small, the theme is monochrome. It is fully customizable within ListContourPlot as shown below for different colors.

Explicitly specify the ColorFunction(right figure)

ListContourPlot[m[[All, 1 ;; 3]], 
 ContourStyle -> Directive[Black, Dashed], 
 ColorFunction -> (Which[# < 5, Darker[Green], # < 7, Blue, # < 9, 
     Cyan, # < 11, Orange, # < 13, Purple, # < 15, Red, True, 
     Black] &), 
 ColorFunctionScaling -> False, 
 ImageSize -> Small, 
 FrameLabel -> {"α", "δ"}, 
 PlotTheme -> "Monochrome"]
$\endgroup$
3
  • $\begingroup$ Is there a way to control the choice of colors for each basin? $\endgroup$
    – Vaggelis_Z
    Feb 28, 2020 at 8:33
  • $\begingroup$ Could you please indicate how can I define the custom color function? $\endgroup$
    – Vaggelis_Z
    Feb 28, 2020 at 9:18
  • $\begingroup$ See also my edit. $\endgroup$
    – Vaggelis_Z
    Feb 28, 2020 at 10:22

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.